|
Bugzilla – Full Text Bug Listing |
| Summary: | Connecting a USB disk udev rule produces wrong symlink: was: /dev/USBDRIVE -> /dev/sdxx, Now produces /dev/USBDRIVE -> bus/usb/002/005 | ||
|---|---|---|---|
| Product: | [openSUSE] openSUSE Distribution | Reporter: | Robert von Knobloch <suse> |
| Component: | Basesystem | Assignee: | systemd maintainers <systemd-maintainers> |
| Status: | RESOLVED INVALID | QA Contact: | E-mail List <qa-bugs> |
| Severity: | Normal | ||
| Priority: | P5 - None | CC: | fbui |
| Version: | Leap 15.4 | ||
| Target Milestone: | --- | ||
| Hardware: | 64bit | ||
| OS: | Other | ||
| Whiteboard: | |||
| Found By: | --- | Services Priority: | |
| Business Priority: | Blocker: | --- | |
| Marketing QA Status: | --- | IT Deployment: | --- |
Which version of systemd/udev please ? Systemd version: bob@arwen:~> systemctl --version systemd 249 (249.16+suse.195.gb473c02cc0) +PAM +AUDIT +SELINUX +APPARMOR -IMA -SMACK +SECCOMP +GCRYPT +GNUTLS +OPENSSL +ACL +BLKID +CURL +ELFUTILS +FIDO2 +IDN2 -IDN +IPTC +KMOD +LIBCRYPTSETUP +LIBFDISK +PCRE2 +PWQUALITY +P11KIT +QRENCODE +TPM2 +BZIP2 +LZ4 +XZ +ZLIB +ZSTD -XKBCOMMON +UTMP +SYSVINIT default-hierarchy=hybrid udev: bob@arwen:~> udevadm --version 249 (In reply to Robert von Knobloch from comment #0) > Now produces /dev/USBDRIVE -> bus/usb/002/005 > > Which stops backup scripts from working. Do you know since when the symlink points to bus/usb/xxx or the last version of systemd/udev that generated the "correct" symlink ? I can't pinpoint _exactly_ when this behaviour appeared, but I have a version of suse 15.4 with systemd version: irmus:~ # systemctl --version systemd 249 (249.12+suse.135.g7b70d88264) +PAM +AUDIT +SELINUX +APPARMOR -IMA -SMACK +SECCOMP +GCRYPT +GNUTLS +OPENSSL +ACL +BLKID +CURL +ELFUTILS +FIDO2 +IDN2 -IDN +IPTC +KMOD +LIBCRYPTSETUP +LIBFDISK +PCRE2 +PWQUALITY +P11KIT +QRENCODE +TPM2 +BZIP2 +LZ4 +XZ +ZLIB +ZSTD -XKBCOMMON +UTMP +SYSVINIT default-hierarchy=hybrid This version works correctly. Merry Christmas belatedly and a happy new year to you. Bob (In reply to Robert von Knobloch from comment #4) > Merry Christmas belatedly and a happy new year to you. Thank you and I wish you an happy new year too :) (In reply to Robert von Knobloch from comment #0) > Used to result in: /dev/USBDRIVE -> /dev/sdxx > Now produces /dev/USBDRIVE -> bus/usb/002/005 Can you please the show the output of `udevadm info /dev/sdxx` after replacing 'sdxx' with the relevant device name ? If you can run the command on both versions of systemd/udev (with and without the unexpected symlink) that would allow us to compare the outputs and see what exactly changed between the 2 versions. Thanks. ok info for the non-working symlink: bob@arwen:~> udevadm info /dev/sdd P: /devices/pci0000:00/0000:00:14.0/usb2/2-1/2-1:1.0/host6/target6:0:0/6:0:0:0/block/sdd N: sdd L: 0 S: USBDRIVE S: disk/by-id/ata-ST4000VN008-2DR166_ZDH32CMC S: disk/by-path/pci-0000:00:14.0-usb-0:1:1.0-scsi-0:0:0:0 S: disk/by-id/wwn-0x5000c500af62f8ec E: DEVPATH=/devices/pci0000:00/0000:00:14.0/usb2/2-1/2-1:1.0/host6/target6:0:0/6:0:0:0/block/sdd E: DEVNAME=/dev/sdd E: DEVTYPE=disk E: MAJOR=8 E: MINOR=48 E: SUBSYSTEM=block E: USEC_INITIALIZED=32032177228 E: DONT_DEL_PART_NODES=1 E: ID_ATA=1 E: ID_TYPE=disk E: ID_BUS=ata E: ID_MODEL=ST4000VN008-2DR166 E: ID_MODEL_ENC=ST4000VN008-2DR166\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20 E: ID_REVISION=SC60 E: ID_SERIAL=ST4000VN008-2DR166_ZDH32CMC E: ID_SERIAL_SHORT=ZDH32CMC E: ID_ATA_WRITE_CACHE=1 E: ID_ATA_WRITE_CACHE_ENABLED=1 E: ID_ATA_FEATURE_SET_HPA=1 E: ID_ATA_FEATURE_SET_HPA_ENABLED=1 E: ID_ATA_FEATURE_SET_PM=1 E: ID_ATA_FEATURE_SET_PM_ENABLED=1 E: ID_ATA_FEATURE_SET_SECURITY=1 E: ID_ATA_FEATURE_SET_SECURITY_ENABLED=0 E: ID_ATA_FEATURE_SET_SECURITY_ERASE_UNIT_MIN=456 E: ID_ATA_FEATURE_SET_SECURITY_ENHANCED_ERASE_UNIT_MIN=456 E: ID_ATA_FEATURE_SET_SMART=1 E: ID_ATA_FEATURE_SET_SMART_ENABLED=1 E: ID_ATA_FEATURE_SET_PUIS=1 E: ID_ATA_FEATURE_SET_PUIS_ENABLED=0 E: ID_ATA_FEATURE_SET_APM=1 E: ID_ATA_FEATURE_SET_APM_ENABLED=1 E: ID_ATA_FEATURE_SET_APM_CURRENT_VALUE=128 E: ID_ATA_DOWNLOAD_MICROCODE=1 E: ID_ATA_SATA=1 E: ID_ATA_SATA_SIGNAL_RATE_GEN2=1 E: ID_ATA_SATA_SIGNAL_RATE_GEN1=1 E: ID_ATA_ROTATION_RATE_RPM=5980 E: ID_WWN=0x5000c500af62f8ec E: ID_WWN_WITH_EXTENSION=0x5000c500af62f8ec E: ID_PATH=pci-0000:00:14.0-usb-0:1:1.0-scsi-0:0:0:0 E: ID_PATH_TAG=pci-0000_00_14_0-usb-0_1_1_0-scsi-0_0_0_0 E: SCSI_TPGS=0 E: SCSI_TYPE=disk E: SCSI_VENDOR=ASMT E: SCSI_VENDOR_ENC=ASMT\x20\x20\x20\x20 E: SCSI_MODEL=2115 E: SCSI_MODEL_ENC=2115\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20 E: SCSI_REVISION=0 E: ID_SCSI=1 E: ID_SCSI_INQUIRY=1 E: ID_VENDOR=ASMT E: ID_VENDOR_ENC=ASMT\x20\x20\x20\x20 E: MPATH_SBIN_PATH=/sbin E: DM_MULTIPATH_DEVICE_PATH=0 E: ID_PART_TABLE_UUID=94a1945a-6629-460f-8eff-a020d0300adb E: ID_PART_TABLE_TYPE=gpt E: COMPAT_SYMLINK_GENERATION=2 E: DEVLINKS=/dev/USBDRIVE /dev/disk/by-id/ata-ST4000VN008-2DR166_ZDH32CMC /dev/disk/by-path/pci-0000:00:14.0-usb-0:1:1.0-scsi-0:0:0:0 /dev/disk/by-id/wwn-0x5000c500af62f8ec E: TAGS=:systemd: E: CURRENT_TAGS=:systemd: and the version that works: bob@irmus:~> udevadm info /dev/sdb P: /devices/pci0000:00/0000:00:14.0/usb2/2-8/2-8:1.0/host6/target6:0:0/6:0:0:0/block/sdb N: sdb L: 0 S: USBDRIVE E: DEVPATH=/devices/pci0000:00/0000:00:14.0/usb2/2-8/2-8:1.0/host6/target6:0:0/6:0:0:0/block/sdb E: DEVNAME=/dev/sdb E: DEVTYPE=disk E: MAJOR=8 E: MINOR=16 E: SUBSYSTEM=block E: USEC_INITIALIZED=4443172754243 E: DONT_DEL_PART_NODES=1 E: ID_ATA=1 E: ID_TYPE=disk E: ID_BUS=ata E: ID_MODEL=ST4000VN008-2DR166 E: ID_MODEL_ENC=ST4000VN008-2DR166\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20 E: ID_REVISION=SC60 E: ID_SERIAL=ST4000VN008-2DR166_ZDH32CMC E: ID_SERIAL_SHORT=ZDH32CMC E: ID_ATA_WRITE_CACHE=1 E: ID_ATA_WRITE_CACHE_ENABLED=1 E: ID_ATA_FEATURE_SET_HPA=1 E: ID_ATA_FEATURE_SET_HPA_ENABLED=1 E: ID_ATA_FEATURE_SET_PM=1 E: ID_ATA_FEATURE_SET_PM_ENABLED=1 E: ID_ATA_FEATURE_SET_SECURITY=1 E: ID_ATA_FEATURE_SET_SECURITY_ENABLED=0 E: ID_ATA_FEATURE_SET_SECURITY_ERASE_UNIT_MIN=456 E: ID_ATA_FEATURE_SET_SECURITY_ENHANCED_ERASE_UNIT_MIN=456 E: ID_ATA_FEATURE_SET_SMART=1 E: ID_ATA_FEATURE_SET_SMART_ENABLED=1 E: ID_ATA_FEATURE_SET_PUIS=1 E: ID_ATA_FEATURE_SET_PUIS_ENABLED=0 E: ID_ATA_FEATURE_SET_APM=1 E: ID_ATA_FEATURE_SET_APM_ENABLED=1 E: ID_ATA_FEATURE_SET_APM_CURRENT_VALUE=128 E: ID_ATA_DOWNLOAD_MICROCODE=1 E: ID_ATA_SATA=1 E: ID_ATA_SATA_SIGNAL_RATE_GEN2=1 E: ID_ATA_SATA_SIGNAL_RATE_GEN1=1 E: ID_ATA_ROTATION_RATE_RPM=5980 E: ID_WWN=0x5000c500af62f8ec E: ID_WWN_WITH_EXTENSION=0x5000c500af62f8ec E: ID_PATH=pci-0000:00:14.0-usb-0:8:1.0-scsi-0:0:0:0 E: ID_PATH_TAG=pci-0000_00_14_0-usb-0_8_1_0-scsi-0_0_0_0 E: SCSI_TPGS=0 E: SCSI_TYPE=disk E: SCSI_VENDOR=ASMT E: SCSI_VENDOR_ENC=ASMT\x20\x20\x20\x20 E: SCSI_MODEL=2115 E: SCSI_MODEL_ENC=2115\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20 E: SCSI_REVISION=0 E: ID_SCSI=1 E: ID_SCSI_INQUIRY=1 E: ID_VENDOR=ASMT E: ID_VENDOR_ENC=ASMT\x20\x20\x20\x20 E: MPATH_SBIN_PATH=/sbin E: DM_MULTIPATH_DEVICE_PATH=0 E: ID_PART_TABLE_UUID=94a1945a-6629-460f-8eff-a020d0300adb E: ID_PART_TABLE_TYPE=gpt E: COMPAT_SYMLINK_GENERATION=2 E: DEVLINKS=/dev/USBDRIVE E: TAGS=:systemd: E: CURRENT_TAGS=:systemd: Hope this helps, Greetings, Bob Thanks. In the non-working case, can you please show the output of: # ls -l /run/udev/links/USBDRIVE/ Thanks. Sure: arwen:~ # ls -l /run/udev/links/USBDRIVE/ total 0 -r--r--r-- 1 root root 0 Dec 30 09:36 b8:48 -r--r--r-- 1 root root 0 Dec 30 09:36 b8:49 -r--r--r-- 1 root root 0 Dec 30 09:36 c189:131 -r--r--r-- 1 root root 0 Dec 30 09:36 c21:4 -r--r--r-- 1 root root 0 Dec 30 09:36 c246:4 and arwen:~ # ll /dev/USB* lrwxrwxrwx 1 root root 15 Dec 30 09:36 /dev/USBDRIVE -> bus/usb/002/004 Thanks.
Apparently several devices match your rule:
SUBSYSTEMS=="usb",ATTRS{product}=="AS2115",GROUP="users",SYMLINK="USBDRIVE"
If that's the case then the rule should be refined so it matches /dev/sdx device only without any ambiguity as otherwise the device that "wins" the symlink is undefined (see udev manpage).
Can you please show the output of `ls -l /dev/block` so we can see which block devices are maching the rule ?
bob@arwen:~> ls -l /dev/block total 0 lrwxrwxrwx 1 root root 6 Dec 30 09:32 11:0 -> ../sr0 lrwxrwxrwx 1 root root 6 Dec 30 09:32 8:0 -> ../sda lrwxrwxrwx 1 root root 7 Dec 30 09:32 8:1 -> ../sda1 lrwxrwxrwx 1 root root 6 Dec 30 09:32 8:16 -> ../sdb lrwxrwxrwx 1 root root 7 Dec 30 09:32 8:17 -> ../sdb1 lrwxrwxrwx 1 root root 7 Dec 30 09:32 8:2 -> ../sda2 lrwxrwxrwx 1 root root 6 Dec 30 09:32 8:32 -> ../sdc lrwxrwxrwx 1 root root 7 Dec 30 09:32 8:33 -> ../sdc1 lrwxrwxrwx 1 root root 7 Dec 30 09:32 8:34 -> ../sdc2 lrwxrwxrwx 1 root root 7 Dec 30 09:32 8:35 -> ../sdc3 lrwxrwxrwx 1 root root 7 Dec 30 09:32 8:36 -> ../sdc4 lrwxrwxrwx 1 root root 7 Dec 30 09:32 8:4 -> ../sda4 lrwxrwxrwx 1 root root 6 Dec 30 09:36 8:48 -> ../sdd lrwxrwxrwx 1 root root 7 Dec 30 09:36 8:49 -> ../sdd1 p.s. I tried adding the serial number as a condition, but had no luck. Thanks, Bob (In reply to Robert von Knobloch from comment #11) > lrwxrwxrwx 1 root root 6 Dec 30 09:36 8:48 -> ../sdd > lrwxrwxrwx 1 root root 7 Dec 30 09:36 8:49 -> ../sdd1 Here it shows that your rule matches both the block device itself as well as the partition one, which is quite expected since both share the same product name. You should fix it. > p.s. I tried adding the serial number as a condition, but had no luck. Same remark as above, the serial number is an HW property shared by both devices. I forgot to ask the output of: # ls -l /dev/char/ | egrep "189:131|21:4|246:4" One of them most likely points to "bus/usb/002/004" but I'd like to be sure. Thanks. Yes, it does arwen:~ # ls -l /dev/char/ | egrep "189:131|21:4|246:4" lrwxrwxrwx 1 root root 18 Jan 5 14:43 189:131 -> ../bus/usb/002/004 lrwxrwxrwx 1 root root 6 Jan 5 14:44 21:4 -> ../sg4 lrwxrwxrwx 1 root root 14 Jan 5 14:44 246:4 -> ../bsg/6:0:0:0 What I don't understand is that it worked in the past (and also on Debian). The hardware has not changed. OK, I must try to find an appropriate attribute. Many thanks, in any case, Franck. Bob (In reply to Robert von Knobloch from comment #13) > What I don't understand is that it worked in the past (and also on Debian). > The hardware has not changed. Yes it worked but most likely by "luck": your rule is too ambiguous and matches several devices and as mentioned earlier the device that will own the symlink is undefined in such case as it depends on some implementation details of udev. (In reply to Robert von Knobloch from comment #13) > OK, I must try to find an appropriate attribute. See https://reactivated.net/writing_udev_rules.html#example-usbhdd for a different approach. Robert you might want to give the following rule a try:
> SUBSYSTEM=="block",DRIVERS=="usb",ATTRS{product}=="AS2115",ENV{DEVTYPE}=="partition",GROUP="users",SYMLINK="USBDRIVE-part%n"
It should target the partition block device more accurately. Note that the symlink has been renamed "USBDRIVE-part1" so it reflects the fact that the symlink points to the partition block device and not to the whole disk.
I'm closing this bug as INVALID since the problem lied in the udev rule rather than in udev.
Hope that makes sense.
Yes Franck, it makes perfect sense. Apologies (but thanks) for causing you to expend effort on my behalf. Your rule works perfectly, thank you very much. Robert von Knobloch |
Has worked for some years, now no longer. udev Rule: SUBSYSTEMS=="usb",ATTRS{product}=="AS2115",GROUP="users",SYMLINK="USBDRIVE" Used to result in: /dev/USBDRIVE -> /dev/sdxx Now produces /dev/USBDRIVE -> bus/usb/002/005 Which stops backup scripts from working. Same using LEAP 15.5 Debian 10 and 12 produce the 'correct' response /dev/USBDRIVE -> /dev/sdx, so seems to me to be a change in systemd/udev? Thanks, Bob von Knobloch