[systemd-devel] LibUdev: serial not displayed properly for scsi devices

Sven Wiltink swiltink at transip.nl
Thu Feb 7 14:39:37 UTC 2019


Hey all,

We've been running into the issue where lblk -O outputs the wwn instead of the serial for scsi devices. After some debugging I've come to the conclusing that /lib/udev/scsi_id is the underlying cause. It outputs the wwn of a disk in the ID_SERIAL_SHORT field, but does also export the actual serial in a separate field (ID_SCSI_SERIAL).

sample output during udevadm test:
IMPORT 'scsi_id --export --whitelisted -d /dev/sdas' /lib/udev/rules.d/60-persistent-storage.rules:50
starting 'scsi_id --export --whitelisted -d /dev/sdas'
'scsi_id --export --whitelisted -d /dev/sdas'(out) 'ID_SCSI=1'
'scsi_id --export --whitelisted -d /dev/sdas'(out) 'ID_VENDOR=HGST'
'scsi_id --export --whitelisted -d /dev/sdas'(out) 'ID_VENDOR_ENC=HGST\x20\x20\x20\x20'
'scsi_id --export --whitelisted -d /dev/sdas'(out) 'ID_MODEL=HUS726060ALS640'
'scsi_id --export --whitelisted -d /dev/sdas'(out) 'ID_MODEL_ENC=HUS726060ALS640\x20'
'scsi_id --export --whitelisted -d /dev/sdas'(out) 'ID_REVISION=A280'
'scsi_id --export --whitelisted -d /dev/sdas'(out) 'ID_TYPE=disk'
'scsi_id --export --whitelisted -d /dev/sdas'(out) 'ID_SERIAL=35000cca232ab84ac'
'scsi_id --export --whitelisted -d /dev/sdas'(out) 'ID_SERIAL_SHORT=5000cca232ab84ac'
'scsi_id --export --whitelisted -d /dev/sdas'(out) 'ID_WWN=0x5000cca232ab84ac'
'scsi_id --export --whitelisted -d /dev/sdas'(out) 'ID_WWN_WITH_EXTENSION=0x5000cca232ab84ac'
'scsi_id --export --whitelisted -d /dev/sdas'(out) 'ID_SCSI_SERIAL=        1EK1A65J'

ata devices to not have this issue because they use ata_id:
IMPORT 'ata_id --export /dev/sdad' /lib/udev/rules.d/60-persistent-storage.rules:38
starting 'ata_id --export /dev/sdad'
'ata_id --export /dev/sdad'(out) 'ID_ATA=1'
'ata_id --export /dev/sdad'(out) 'ID_TYPE=disk'
'ata_id --export /dev/sdad'(out) 'ID_BUS=ata'
'ata_id --export /dev/sdad'(out) 'ID_MODEL=HGST_HDN726060ALE614'
'ata_id --export /dev/sdad'(out) 'ID_MODEL_ENC=HGST\x20HDN726060ALE614\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20'
'ata_id --export /dev/sdad'(out) 'ID_REVISION=APGNW7JH'
'ata_id --export /dev/sdad'(out) 'ID_SERIAL=HGST_HDN726060ALE614_NAHTWX0X'
'ata_id --export /dev/sdad'(out) 'ID_SERIAL_SHORT=NAHTWX0X'
<snip>
'ata_id --export /dev/sdad'(out) 'ID_WWN=0x5000cca242d96928'
'ata_id --export /dev/sdad'(out) 'ID_WWN_WITH_EXTENSION=0x5000cca242d96928'



I am unsure if the fix should be in udev or lsblk, but I wanted to bring it up for discussion because the serial not being displayed properly.

Kind regards,
Sven Wiltink

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/systemd-devel/attachments/20190207/b1f2e88f/attachment.html>


More information about the systemd-devel mailing list