From 479da1107a0d4e2f7ef5cd938512b87a0e45f180 Mon Sep 17 00:00:00 2001 From: Yu Watanabe Date: Sun, 30 Oct 2022 09:43:05 +0900 Subject: udev: always create device symlinks for USB disks Previously, ata_id might not be able to retrieve attributes correctly, and properties from usb_id were used as a fallback. See issue #24921 and PR #24923. To keep backward compatibility, still we need to create symlinks based on USB serial. Fixes #25179. --- rules.d/60-persistent-storage.rules | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'rules.d') diff --git a/rules.d/60-persistent-storage.rules b/rules.d/60-persistent-storage.rules index 64a2409196..18588e4c45 100644 --- a/rules.d/60-persistent-storage.rules +++ b/rules.d/60-persistent-storage.rules @@ -59,14 +59,20 @@ KERNEL=="sd*[!0-9]|sr*", ENV{ID_SERIAL}!="?*", SUBSYSTEMS=="scsi", ATTRS{type}== # Run ata_id on non-removable USB Mass Storage (SATA/PATA disks in enclosures) KERNEL=="sd*[!0-9]|sr*", ENV{ID_SERIAL}!="?*", ATTR{removable}=="0", SUBSYSTEMS=="usb", IMPORT{program}="ata_id --export $devnode" -# Fall back usb_id for USB devices -KERNEL=="sd*[!0-9]|sr*", ENV{ID_SERIAL}!="?*", SUBSYSTEMS=="usb", IMPORT{builtin}="usb_id" +# Also import properties from usb_id for USB devices +KERNEL=="sd*[!0-9]|sr*", SUBSYSTEMS=="usb", IMPORT{builtin}="usb_id" # SCSI devices KERNEL=="sd*[!0-9]|sr*", ENV{ID_SERIAL}!="?*", IMPORT{program}="scsi_id --export --whitelisted -d $devnode", ENV{ID_BUS}="scsi" KERNEL=="cciss*", ENV{DEVTYPE}=="disk", ENV{ID_SERIAL}!="?*", IMPORT{program}="scsi_id --export --whitelisted -d $devnode", ENV{ID_BUS}="cciss" KERNEL=="sd*|sr*|cciss*", ENV{DEVTYPE}=="disk", ENV{ID_SERIAL}=="?*", SYMLINK+="disk/by-id/$env{ID_BUS}-$env{ID_SERIAL}" KERNEL=="sd*|cciss*", ENV{DEVTYPE}=="partition", ENV{ID_SERIAL}=="?*", SYMLINK+="disk/by-id/$env{ID_BUS}-$env{ID_SERIAL}-part%n" +# Previously, ata_id in the above might not be able to retrieve attributes correctly, +# and properties from usb_id were used as a fallback. See issue #24921 and PR #24923. +# To keep backward compatibility, still we need to create symlinks based on USB serial. +# See issue #25179. +KERNEL=="sd*|sr*|cciss*", ENV{DEVTYPE}=="disk", ENV{ID_USB_SERIAL}=="?*", SYMLINK+="disk/by-id/usb-$env{ID_USB_SERIAL}" +KERNEL=="sd*|cciss*", ENV{DEVTYPE}=="partition", ENV{ID_USB_SERIAL}=="?*", SYMLINK+="disk/by-id/usb-$env{ID_USB_SERIAL}-part%n" # PMEM devices KERNEL=="pmem*", ENV{DEVTYPE}=="disk", ATTRS{uuid}=="?*", SYMLINK+="disk/by-id/pmem-$attr{uuid}" -- cgit v1.2.1