create driver links

Benutzeravatar
SisterOfMercy
Beiträge: 1016
Registriert: 22 Jun 2012, 19:18

create driver links

Beitragvon SisterOfMercy » 11 Okt 2019, 21:17

A new opsi server has a problem with creating the correct driver links for hdaudio devices.

Code: Alles auswählen

# ./show_drivers.py hostname.blah.nl
Additional drivers for integration byAudit found for vendor: 'Supermicro' model : 'Super Server (Default string)'  Check if drivers are available.
Additional drivers for integration byAudit-Baseboard found for vendor: 'Supermicro' model : 'X11SCQ' Check if drivers are available. .

PCI-Devices
   [8086:3EC2]  Intel Corporation : 8th Gen Core Processor Host Bridge/DRAM Registers
      /var/lib/opsi/depot/win10-x64/drivers/drivers/preferred/Intel Chipset 10.1.18010.8141/Coffeelake
   [8086:3E98]  Intel Corporation : UHD Graphics 630 (Desktop 9 Series)
      /var/lib/opsi/depot/win10-x64/drivers/drivers/preferred/Intel Graphics 26.20.100.7212/Graphics
   [8086:1911]  Intel Corporation : Xeon E3-1200 v5/v6 / E3-1500 v5 / 6th/7th Gen Core Processor Gaussian Mixture Model
      /var/lib/opsi/depot/win10-x64/drivers/drivers/preferred/Intel Chipset 10.1.18010.8141/Skylake
   [8086:A379]  Intel Corporation : Cannon Lake PCH Thermal Controller
      /var/lib/opsi/depot/win10-x64/drivers/drivers/preferred/Intel Chipset 10.1.18010.8141/CannonLake-H
   [8086:A36D]  Intel Corporation : Cannon Lake PCH USB 3.1 xHCI Host Controller
      No driver - device directory '/var/lib/opsi/depot/win10-x64/drivers/pciids/8086/A36D' not found
   [8086:A36F]  Intel Corporation : Cannon Lake PCH Shared SRAM
      No driver - device directory '/var/lib/opsi/depot/win10-x64/drivers/pciids/8086/A36F' not found
   [8086:A352]  Intel Corporation : Cannon Lake PCH SATA AHCI Controller
      No driver - device directory '/var/lib/opsi/depot/win10-x64/drivers/pciids/8086/A352' not found
   [8086:A340]  Intel Corporation : Cannon Lake PCH PCI Express Root Port #17
      /var/lib/opsi/depot/win10-x64/drivers/drivers/preferred/Intel Chipset 10.1.18010.8141/CannonLake-H
   [8086:A32C]  Intel Corporation : Cannon Lake PCH PCI Express Root Port #21
      /var/lib/opsi/depot/win10-x64/drivers/drivers/preferred/Intel Chipset 10.1.18010.8141/CannonLake-H
   [8086:F1A6]  Intel Corporation : SSD Pro 7600p/760p/E 6100p Series
      /var/lib/opsi/depot/win10-x64/drivers/drivers/preferred/Intel NVMe 4.3.0.1006
   [8086:A330]  Intel Corporation : Cannon Lake PCH PCI Express Root Port #9
      /var/lib/opsi/depot/win10-x64/drivers/drivers/preferred/Intel Chipset 10.1.18010.8141/CannonLake-H
   [8086:A332]  Intel Corporation : Cannon Lake PCH PCI Express Root Port #11
      /var/lib/opsi/depot/win10-x64/drivers/drivers/preferred/Intel Chipset 10.1.18010.8141/CannonLake-H
   [8086:1533]  Intel Corporation : I210 Gigabit Network Connection
      /var/lib/opsi/depot/win10-x64/drivers/drivers/preferred/Intel LAN 24.2/PRO1000/Winx64/NDIS65
   [8086:A306]  Intel Corporation : Q370 Chipset LPC/eSPI Controller
      /var/lib/opsi/depot/win10-x64/drivers/drivers/preferred/Intel Chipset 10.1.18010.8141/CannonLake-H
   [8086:A348]  Intel Corporation : Cannon Lake PCH cAVS
      /var/lib/opsi/depot/win10-x64/drivers/drivers/preferred/Intel Graphics 26.20.100.7212/Graphics
   [8086:A323]  Intel Corporation : Cannon Lake PCH SMBus Controller
      /var/lib/opsi/depot/win10-x64/drivers/drivers/preferred/Intel Chipset 10.1.18010.8141/CannonLake-H
   [8086:A324]  Intel Corporation : Cannon Lake PCH SPI Controller
      /var/lib/opsi/depot/win10-x64/drivers/drivers/preferred/Intel Chipset 10.1.18010.8141/CannonLake-H
   [8086:15BB]  Intel Corporation : Ethernet Connection (7) I219-LM
      /var/lib/opsi/depot/win10-x64/drivers/drivers/preferred/Intel LAN 24.2/PRO1000/Winx64/NDIS65

USB-Devices
   No devices installed

HD-Audio-Devices
   [10EC:0888]  Realtek ALC888-VD
      No driver - vendor directory '/var/lib/opsi/depot/win10-x64/drivers/hdaudioids/10EC' not found
   [8086:280B]  Intel Kabylake HDMI
      No driver - vendor directory '/var/lib/opsi/depot/win10-x64/drivers/hdaudioids/8086' not found


Package used:
win10-x64 4.1.0.1-3

This realtek driver is copied from an older opsi server which does create the hdaudioids directory/symbolic links.
I currently can not check which package is on the older server, but create_driver_links.py was only changed by three characters.

old (going on memory):

Code: Alles auswählen


def setRights():
   uid = -1
   if (os.geteuid() == 0):
      uid = pwd.getpwnam(DEFAULT_CLIENT_DATA_USER)[2]
   gid = grp.getgrnam(DEFAULT_CLIENT_DATA_GROUP)[2]

   for path in findFiles(prefix=DST_DIR, directory=DST_DIR, returnLinks=False):
      logger.info(u"Setting owner of '%s' to '%s:%s'" % (path, uid, gid))
      try:
         os.chown(path, uid, gid)
      except Exception as e:
         logger.warning(u"Failed to change owner of '%s' to '%s:%s': %s" % (path, uid, gid, e))

      try:
         if os.path.islink(path):
            continue
         elif os.path.isdir(path):
            logger.debug(u"Setting rights on directory '%s'" % path)
            os.chmod(path, 02770)
         elif os.path.isfile(path):
            logger.debug(u"Setting rights on file '%s'" % path)
            os.chmod(path, (os.stat(path)[0] | 0660) & 0770)
      except Exception as e:
         logger.warning(u"Failed to set access rights of '%s' : %s" % (path, e))


new:

Code: Alles auswählen


def setRights():
   uid = -1
   if (os.geteuid() == 0):
      uid = pwd.getpwnam(DEFAULT_CLIENT_DATA_USER)[2]
   gid = grp.getgrnam(DEFAULT_CLIENT_DATA_GROUP)[2]

   for path in findFiles(prefix=DST_DIR, directory=DST_DIR, returnLinks=False):
      logger.info(u"Setting owner of '%s' to '%s:%s'" % (path, uid, gid))
      try:
         os.chown(path, uid, gid)
      except Exception as e:
         logger.warning(u"Failed to change owner of '%s' to '%s:%s': %s" % (path, uid, gid, e))

      try:
         if os.path.islink(path):
            continue
         elif os.path.isdir(path):
            logger.debug(u"Setting rights on directory '%s'" % path)
            os.chmod(path, 0o2770)
         elif os.path.isfile(path):
            logger.debug(u"Setting rights on file '%s'" % path)
            os.chmod(path, (os.stat(path)[0] | 0o660) & 0o770)
      except Exception as e:
         logger.warning(u"Failed to set access rights of '%s' : %s" % (path, e))


This change doesn't look like something that matters to this issue. Does it import other python stuff that has changed?

This is what I find when changing the verbosity:

old (working):

Code: Alles auswählen

File 'drivers/preferred/Intel Graphics 26.20.100.6709/Graphics/DisplayAudio/10.26/IntcDAud.inf' locked after 0 millis
   - Getting strings
   - Getting devices
      - Device sections: NTAMD64, 2, Intel, 6
   - Parsing device section: Intel
   - Parsing device section: Intel.NTAMD64.6.2
      - Processing device string: HDAUDIO\FUNC_01&VEN_8086&DEV_2809&SUBSYS_80860101
         - Device type is HDAUDIO
         - Found HDAUDIO device: 8086:2809


new:

Code: Alles auswählen

File 'drivers/preferred/Intel Graphics 26.20.100.7212/Graphics/DisplayAudio/10.26/IntcDAud.inf' locked after 0 millis
   - Getting strings
   - Getting devices
      - Device sections: NTAMD64, 2, Intel, 6
   - Parsing device section: Intel
   - Parsing device section: Intel.NTAMD64.6.2
      - Processing device string: HDAUDIO\FUNC_01&VEN_8086&DEV_2809&SUBSYS_80860101
         - Device type is PCI
         - Found PCI device: 8086:2809
Bitte schreiben Sie Deutsch, when I'm responding in the German-speaking part of the forum!

Benutzeravatar
SisterOfMercy
Beiträge: 1016
Registriert: 22 Jun 2012, 19:18

Re: create driver links

Beitragvon SisterOfMercy » 13 Okt 2019, 17:43

It seems the regex does not match.

https://github.com/opsi-org/python-opsi ... _init__.py
somewhere around line 666 ;)

Code: Alles auswählen

class InfFile(ConfigFile):
   sectionRegex = re.compile('\[\s*([^\]]+)\s*\]')
   pciDeviceRegex = re.compile('VEN_([\da-fA-F]+)&DEV_([\da-fA-F]+)', re.IGNORECASE)
   hdaudioDeviceRegex = re.compile('HDAUDIO\\\.*VEN_([\da-fA-F]+)&DEV_([\da-fA-F]+)', re.IGNORECASE)
   usbDeviceRegex = re.compile('USB.*VID_([\da-fA-F]+)&PID_([\da-fA-F]+)', re.IGNORECASE)
   acpiDeviceRegex = re.compile('ACPI\\\(\S+)_-_(\S+)', re.IGNORECASE)
   varRegex = re.compile('\%([^\%]+)\%')
   classRegex = re.compile('class\s*=')


I used this tester:
https://regex101.com/

Code: Alles auswählen

VEN_([\da-fA-F]+)&DEV_([\da-fA-F]+)
shows matches in:

Code: Alles auswählen

[AzaliaManufacturerID.NTamd64.6.0]
"Realtek High Definition Audio" = IntcAzAudModel, HDAUDIO\FUNC_01&VEN_10EC&DEV_0233&SUBSYS_10CF1506
"Realtek High Definition Audio" = IntcAzAudModel, HDAUDIO\FUNC_01&VEN_10EC&DEV_0233&SUBSYS_10CF1507
"Realtek High Definition Audio" = IntcAzAudModel, HDAUDIO\FUNC_01&VEN_10EC&DEV_0269&SUBSYS_10CF2000


Code: Alles auswählen

HDAUDIO\\\.*VEN_([\da-fA-F]+)&DEV_([\da-fA-F]+)
does not show these matches.

Also, the code looks like it should detect ACPI devices, but it never does.
Bitte schreiben Sie Deutsch, when I'm responding in the German-speaking part of the forum!

Benutzeravatar
SisterOfMercy
Beiträge: 1016
Registriert: 22 Jun 2012, 19:18

Re: create driver links

Beitragvon SisterOfMercy » 13 Okt 2019, 17:45

Code: Alles auswählen

HDAUDIO\\.*VEN_([\da-fA-F]+)&DEV_([\da-fA-F]+)
also matches, with one backslash less.
Bitte schreiben Sie Deutsch, when I'm responding in the German-speaking part of the forum!

Benutzeravatar
SisterOfMercy
Beiträge: 1016
Registriert: 22 Jun 2012, 19:18

Re: create driver links

Beitragvon SisterOfMercy » 13 Okt 2019, 17:58

Information about this system:

Code: Alles auswählen

# uname -a
Linux opsi-home 3.10.0-1062.1.2.el7.x86_64 #1 SMP Mon Sep 30 14:19:46 UTC 2019 x86_64 x86_64 x86_64 GNU/Linux
# cat /etc/redhat-release
CentOS Linux release 7.7.1908 (Core)


Code: Alles auswählen

# yum list installed | grep -i pyth
MySQL-python.x86_64                     1.2.5-1.el7                    @base
audit-libs-python.x86_64                2.8.5-4.el7                    @base
dbus-python.x86_64                      1.1.1-9.el7                    @anaconda
libselinux-python.x86_64                2.5-14.1.el7                   @base
libsemanage-python.x86_64               2.5-14.el7                     @base
libxml2-python.x86_64                   2.9.1-6.el7_2.3                @base
newt-python.x86_64                      0.52.15-4.el7                  @anaconda
policycoreutils-python.x86_64           2.5-33.el7                     @base
python.x86_64                           2.7.5-86.el7                   @anaconda
python-GnuPGInterface.noarch            0.3.2-11.el7                   @epel7
python-IPy.noarch                       0.75-6.el7                     @base
python-Twisted.x86_64                   12.0.0-2.6                     @opsi4
python-backports.x86_64                 1.0-8.el7                      @base
python-backports-ssl_match_hostname.noarch
python-cffi.x86_64                      1.6.0-5.el7                    @base
python-chardet.noarch                   2.2.1-3.el7                    @base
python-configobj.noarch                 4.7.2-7.el7                    @anaconda
python-decorator.noarch                 3.4.0-3.el7                    @anaconda
python-enum34.noarch                    1.0.4-1.el7                    @base
python-fasteners.noarch                 0.9.0-2.el7                    @epel7
python-gobject-base.x86_64              3.22.0-1.el7_4.1               @anaconda
python-httplib2.noarch                  0.9.2-1.el7                    @extras
python-idna.noarch                      2.4-1.el7                      @base
python-iniparse.noarch                  0.4-9.el7                      @anaconda
python-ipaddress.noarch                 1.0.16-2.el7                   @base
python-ldaptor.x86_64                   0.0.43-3.7                     @opsi4
python-libs.x86_64                      2.7.5-86.el7                   @anaconda
python-linux-procfs.noarch              0.4.11-4.el7                   @anaconda
python-lockfile.noarch                  1:0.9.1-4.el7.centos           @extras
python-magic.noarch                     5.11-35.el7                    @base
python-opsi.noarch                      4.1.1.72-1.2                   @opsi4
python-pam.x86_64                       0.5.0-1.6                      @opsi4
python-paramiko.noarch                  2.1.1-9.el7                    @base
python-perf.x86_64                      3.10.0-1062.1.2.el7            @updates
python-ply.noarch                       3.4-11.el7                     @base
python-pycparser.noarch                 2.14-1.el7                     @base
python-pycurl.x86_64                    7.19.0-19.el7                  @anaconda
python-pyudev.noarch                    0.15-9.el7                     @anaconda
python-requests.noarch                  2.6.0-5.el7                    @base
python-schedutils.x86_64                0.4-6.el7                      @anaconda
python-setuptools.noarch                0.9.8-7.el7                    @base
python-six.noarch                       1.9.0-2.el7                    @base
python-slip.noarch                      0.4.0-4.el7                    @base
python-slip-dbus.noarch                 0.4.0-4.el7                    @base
python-sqlalchemy.x86_64                0.9.8-2.el7                    @base
python-urlgrabber.noarch                3.10-9.el7                     @anaconda
python-urllib3.noarch                   1.10.2-7.el7                   @base
python-zope-interface.x86_64            4.0.5-4.el7                    @base
python2-PyDrive.noarch                  1.3.1-3.el7                    @epel7
python2-boto.noarch                     2.45.0-3.el7                   @epel7
python2-crypto.x86_64                   2.6.1-16.el7                   @epel7
python2-cryptography.x86_64             1.7.2-2.el7                    @base
python2-gflags.noarch                   2.0-5.el7                      @epel7
python2-google-api-client.noarch        1.6.3-1.el7                    @epel7
python2-keyring.noarch                  5.0-4.el7                      @epel7
python2-oauth2client.noarch             4.0.0-2.el7                    @epel7
python2-pyasn1.noarch                   0.1.9-7.el7                    @base
python2-pyasn1-modules.noarch           0.1.9-7.el7                    @base
python2-rsa.noarch                      3.4.1-1.el7                    @epel7
python2-uritemplate.noarch              3.0.0-1.el7                    @epel7
rpm-python.x86_64                       4.11.3-40.el7                  @anaconda
systemd-python.x86_64                   219-67.el7_7.1                 @updates


Code: Alles auswählen

# yum list installed | grep -i opsi
libwim15.x86_64                         1.9.2-1.8                      @opsi4
opsi-linux-bootimage.noarch             20190805-3.2                   @opsi4
opsi-linux-support.noarch               4.1.1-3.2                      @opsi4
opsi-server.noarch                      4.1.1.8-1.2                    @opsi4
opsi-tftp-hpa-server.x86_64             5.2.8-50.2                     @opsi4
opsi-utils.noarch                       4.1.1.33-2.2                   @opsi4
opsi-windows-support.noarch             4.1.1-8.4                      @opsi4
opsiconfd.noarch                        4.1.1.18-4.4                   @opsi4
opsipxeconfd.noarch                     4.1.1.14-2.2                   @opsi4
python-Twisted.x86_64                   12.0.0-2.6                     @opsi4
python-ldaptor.x86_64                   0.0.43-3.7                     @opsi4
python-opsi.noarch                      4.1.1.72-1.2                   @opsi4
python-pam.x86_64                       0.5.0-1.6                      @opsi4
wimlib.x86_64                           1.9.2-1.8                      @opsi4
winexe.x86_64                           4.8.0.0-23.4                   @opsi4
zsync.x86_64                            0.6.2-2.6                      @opsi4
Bitte schreiben Sie Deutsch, when I'm responding in the German-speaking part of the forum!