udev has truncated ID_SERIAL value for scsi disk

Bug #1859858 reported by Ryan Harper
10
This bug affects 1 person
Affects Status Importance Assigned to Milestone
sg3-utils (Ubuntu)
Fix Released
High
Unassigned
Bionic
Fix Released
Undecided
Unassigned
Eoan
Fix Released
Undecided
Unassigned
Focal
Fix Released
High
Unassigned

Bug Description

[impact]
ID_SERIAL in udev for scsi disks is truncated.

[test case]
1. boot a vm with a scsi disk attached, e.g.

kvm -m 1024 -hda ~/images/focal.img -device virtio-scsi-pci,id=scsi0 -device scsi-hd,drive=drv4,serial=0x22dc58dc023c7008,wwn=0x22dc58dc023c7008 -drive file=extra_disk_1.img,id=drv4,if=none,format=raw,index=4,cache=unsafe

2. make sure sg3-utils is installed (it probably will be for eoan and will not for bionic)

3. reboot

4. check udevadm info --query=property /dev/sdX | grep ID_SERIAL=.

5. the value should be "322dc58dc023c7008", not "3"

[regression potential]
it's a one line change in a udev rule. It's possible some users have inadvertently depended on the serial being the same for all disks but it seems very unlikely. No other behaviour should change as a result of this fix.

[original report]

1.
root@ubuntu:/home/ubuntu# cat /etc/cloud/build.info
build_name: server
serial: 20200106
root@ubuntu:/home/ubuntu# lsb_release -rd
Description: Ubuntu Focal Fossa (development branch)
Release: 20.04

2.
root@ubuntu:/home/ubuntu# apt-cache policy systemd
systemd:
  Installed: 244-3ubuntu1
  Candidate: 244-3ubuntu1
  Version table:
 *** 244-3ubuntu1 500
        500 http://archive.ubuntu.com/ubuntu focal/main amd64 Packages
        100 /var/lib/dpkg/status

3. ID_SERIAL value should be 322dc58dc023c7008
4. ID_SERIAL value is 3

--
Launching a qemu VM with the same extra scsi disk like so:

-drive file=extra_disk_1.img,id=drv4,if=none,format=raw,index=4,cache=unsafe \
-device scsi-hd,drive=drv4,serial=0x22dc58dc023c7008,wwn=0x22dc58dc023c7008

On Focal udevadm info output:
root@ubuntu:/home/ubuntu# udevadm info --query=property /dev/sdc
DEVPATH=/devices/pci0000:00/0000:00:03.0/virtio0/host2/target2:0:2/2:0:2:0/block/sdc
DEVNAME=/dev/sdc
DEVTYPE=disk
MAJOR=8
MINOR=32
SUBSYSTEM=block
USEC_INITIALIZED=1497555
SCSI_TPGS=0
SCSI_TYPE=disk
SCSI_VENDOR=QEMU
SCSI_VENDOR_ENC=QEMU\x20\x20\x20\x20
SCSI_MODEL=QEMU_HARDDISK
SCSI_MODEL_ENC=QEMU\x20HARDDISK\x20\x20\x20
SCSI_REVISION=2.5+
ID_SCSI=1
ID_SCSI_INQUIRY=1
ID_VENDOR=QEMU
ID_VENDOR_ENC=QEMU\x20\x20\x20\x20
ID_MODEL=QEMU_HARDDISK
ID_MODEL_ENC=QEMU\x20HARDDISK\x20\x20\x20
ID_REVISION=2.5+
ID_TYPE=disk
SCSI_IDENT_SERIAL=0x22dc58dc023c7008
SCSI_IDENT_LUN_VENDOR=0x22dc58dc023c7008
SCSI_IDENT_LUN_NAA_EXT=22dc58dc023c7008
ID_WWN=0x22dc58dc023c7008
ID_WWN_WITH_EXTENSION=0x22dc58dc023c7008
ID_BUS=scsi
ID_SERIAL=3
ID_SERIAL_SHORT=22dc58dc023c7008
MPATH_SBIN_PATH=/sbin
DM_MULTIPATH_DEVICE_PATH=0
ID_PATH=pci-0000:00:03.0-scsi-0:0:2:0
ID_PATH_TAG=pci-0000_00_03_0-scsi-0_0_2_0
ID_FS_UUID=b20cf5c1-15ae-48a7-a5d9-dfcfd37df494
ID_FS_UUID_ENC=b20cf5c1-15ae-48a7-a5d9-dfcfd37df494
ID_FS_UUID_SUB=e06d861c-c6e2-497c-b14f-265ae37060e2
ID_FS_UUID_SUB_ENC=e06d861c-c6e2-497c-b14f-265ae37060e2
ID_FS_TYPE=btrfs
ID_FS_USAGE=filesystem
ID_BTRFS_READY=1
DEVLINKS=/dev/disk/by-id/scsi-3 /dev/disk/by-id/scsi-0QEMU_QEMU_HARDDISK_0x22dc58dc023c7008 /dev/disk/by-path/pci-0000:00:03.0-scsi-0:0:2:0 /dev/disk/by-id/wwn-0x22dc58dc023c7008 /dev/disk/by-id/scsi-SQEMU_QEMU_HARDDISK_0x22dc58dc023c7008 /dev/disk/by-uuid/b20cf5c1-15ae-48a7-a5d9-dfcfd37df494 /dev/disk/by-id/scsi-322dc58dc023c7008
TAGS=:systemd:

On Bionic:
root@ubuntu:~# cat /etc/cloud/build.info
build_name: server
serial: 20200112
root@ubuntu:~# lsb_release -rd
Description: Ubuntu 18.04.3 LTS
Release: 18.04
root@ubuntu:~# apt-cache policy systemd
systemd:
  Installed: 237-3ubuntu10.33
  Candidate: 237-3ubuntu10.33
  Version table:
 *** 237-3ubuntu10.33 500
        500 http://archive.ubuntu.com/ubuntu bionic-updates/main amd64 Packages
        100 /var/lib/dpkg/status
     237-3ubuntu10.29 500
        500 http://security.ubuntu.com/ubuntu bionic-security/main amd64 Packages
     237-3ubuntu10 500
        500 http://archive.ubuntu.com/ubuntu bionic/main amd64 Packages
root@ubuntu:~# udevadm info --query=property /dev/sdc
DEVLINKS=/dev/disk/by-uuid/13a8a15f-4f6b-4904-b307-339b825c445b /dev/disk/by-path/pci-0000:00:03.0-scsi-0:0:2:0 /dev/disk/by-id/wwn-0x22dc58dc023c7008 /dev/disk/by-id/scsi-322dc58dc023c7008
DEVNAME=/dev/sdc
DEVPATH=/devices/pci0000:00/0000:00:03.0/virtio0/host2/target2:0:2/2:0:2:0/block/sdc
DEVTYPE=disk
ID_BTRFS_READY=1
ID_BUS=scsi
ID_FS_TYPE=btrfs
ID_FS_USAGE=filesystem
ID_FS_UUID=13a8a15f-4f6b-4904-b307-339b825c445b
ID_FS_UUID_ENC=13a8a15f-4f6b-4904-b307-339b825c445b
ID_FS_UUID_SUB=81178585-f7c0-429a-b02d-aeb2f245342c
ID_FS_UUID_SUB_ENC=81178585-f7c0-429a-b02d-aeb2f245342c
ID_MODEL=QEMU_HARDDISK
ID_MODEL_ENC=QEMU\x20HARDDISK\x20\x20\x20
ID_PATH=pci-0000:00:03.0-scsi-0:0:2:0
ID_PATH_TAG=pci-0000_00_03_0-scsi-0_0_2_0
ID_REVISION=2.5+
ID_SCSI=1
ID_SCSI_SERIAL=0x22dc58dc023c7008
ID_SERIAL=322dc58dc023c7008
ID_SERIAL_SHORT=22dc58dc023c7008
ID_TYPE=disk
ID_VENDOR=QEMU
ID_VENDOR_ENC=QEMU\x20\x20\x20\x20
ID_WWN=0x22dc58dc023c7008
ID_WWN_WITH_EXTENSION=0x22dc58dc023c7008
MAJOR=8
MINOR=32
SUBSYSTEM=block
TAGS=:systemd:
USEC_INITIALIZED=2069797

ProblemType: Bug
DistroRelease: Ubuntu 20.04
Package: udev 244-3ubuntu1
ProcVersionSignature: Ubuntu 5.3.0-24.26-lowlatency 5.3.10
Uname: Linux 5.3.0-24-lowlatency x86_64
NonfreeKernelModules: zfs zunicode zavl icp zcommon znvpair
ApportVersion: 2.20.11-0ubuntu15
Architecture: amd64
Date: Wed Jan 15 18:17:35 2020
Lsusb: Error: command ['lsusb'] failed with exit code 1:
Lsusb-t:

Lsusb-v: Error: command ['lsusb', '-v'] failed with exit code 1:
MachineType: QEMU Standard PC (i440FX + PIIX, 1996)
ProcEnviron:
 TERM=xterm
 PATH=(custom, no user)
 LANG=C.UTF-8
 SHELL=/bin/bash
ProcKernelCmdLine: root=squash:http://10.245.168.20:41815/root/squashfs ds=nocloud-net;seedfrom=http://10.245.168.20:41815/ console=ttyS0 overlayroot=tmpfs ro --- systemd.mask=snapd.seeded.service systemd.mask=snapd.service ip=:::::BOOTIF:dhcp BOOTIF=01-52-54-00-12-34-01
SourcePackage: systemd
UpgradeStatus: No upgrade log present (probably fresh install)
dmi.bios.date: 04/01/2014
dmi.bios.vendor: SeaBIOS
dmi.bios.version: 1.13.0-1
dmi.chassis.type: 1
dmi.chassis.vendor: QEMU
dmi.chassis.version: pc-i440fx-eoan
dmi.modalias: dmi:bvnSeaBIOS:bvr1.13.0-1:bd04/01/2014:svnQEMU:pnStandardPC(i440FX+PIIX,1996):pvrpc-i440fx-eoan:cvnQEMU:ct1:cvrpc-i440fx-eoan:
dmi.product.name: Standard PC (i440FX + PIIX, 1996)
dmi.product.version: pc-i440fx-eoan
dmi.sys.vendor: QEMU

Related branches

Revision history for this message
Ryan Harper (raharper) wrote :
Ryan Harper (raharper)
tags: added: rls-ff-incoming
tags: removed: rls-ff-incoming
tags: added: id-5e3321e6edacef1db146c8bf
Steve Langasek (vorlon)
Changed in systemd (Ubuntu Focal):
importance: Undecided → High
Revision history for this message
Michael Hudson-Doyle (mwhudson) wrote :

Fairly sure the problem is this line from https://git.launchpad.net/ubuntu/+source/sg3-utils/tree/scripts/55-scsi-sg3_id.rules?h=applied/1.44-1ubuntu1#n48:

ENV{ID_SERIAL}!="?*", ENV{SCSI_IDENT_LUN_NAA_EXT}=="?*", ENV{ID_BUS}="scsi", ENV{ID_SERIAL}="3$env{SCSI_IDENT_LUN_NAA}", ENV{ID_SERIAL_SHORT}="$env{SCSI_IDENT_LUN_NAA_EXT}"

(the variable being checked for and used are different). This appears to be fixed in a recent upstream commit https://github.com/hreinecke/sg3_utils/commit/c4c6af020963d11b624da6abb53f792074f943b2#diff-20e0363765997dae20aaceb68ba039e3 that contains a whole bunch of other stuff. Cherry-picking just that fix would presumably help (and then the patch can be removed when next upstream release is uploaded).

FWIW, this buggy rule is present in bionic too, but I guess it doesn't fire for some reason -- I guess SCSI_IDENT_LUN_NAA_EXT isn't being emitted for some reason, but I haven't actually checked.

affects: systemd (Ubuntu Focal) → sg3-utils (Ubuntu Focal)
Revision history for this message
Ryan Harper (raharper) wrote :

That sounds like a good fix. It will trip in bionic, but ubuntu images don't include multipath package by default (which pulls in sg3-utils). If you install this in bionic, I suspect it will fail just the same.

description: updated
Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package sg3-utils - 1.44-1ubuntu2

---------------
sg3-utils (1.44-1ubuntu2) focal; urgency=medium

  * Fix a typo in a udev rule that leads to truncated ID_SERIAL values in
    udev. (LP: #1859858)

 -- Michael Hudson-Doyle <email address hidden> Tue, 25 Feb 2020 11:00:07 +1300

Changed in sg3-utils (Ubuntu Focal):
status: New → Fix Released
Revision history for this message
Michael Hudson-Doyle (mwhudson) wrote :

Verified that the fix in focal works, have now uploaded it to bionic and eoan proposed.

Changed in sg3-utils (Ubuntu Bionic):
status: New → In Progress
Changed in sg3-utils (Ubuntu Eoan):
status: New → In Progress
Revision history for this message
Robie Basak (racb) wrote :

> It's possible some users have inadvertently depended on the serial being the same for all disks but it seems very unlikely.

I think it's also possible some users are relying on the serial number of some disk somehow, and that's about to change. But on balance I think this is acceptable, since we're fixing the serial number value to the correct one, and it's the same dilemma as users relying on any other bug.

Changed in sg3-utils (Ubuntu Bionic):
status: In Progress → Fix Committed
tags: added: verification-needed verification-needed-bionic
Revision history for this message
Robie Basak (racb) wrote : Please test proposed package

Hello Ryan, or anyone else affected,

Accepted sg3-utils into bionic-proposed. The package will build now and be available at https://launchpad.net/ubuntu/+source/sg3-utils/1.42-2ubuntu1.18.04.2 in a few hours, and then in the -proposed repository.

Please help us by testing this new package. See https://wiki.ubuntu.com/Testing/EnableProposed for documentation on how to enable and use -proposed. Your feedback will aid us getting this update out to other Ubuntu users.

If this package fixes the bug for you, please add a comment to this bug, mentioning the version of the package you tested and change the tag from verification-needed-bionic to verification-done-bionic. If it does not fix the bug for you, please add a comment stating that, and change the tag to verification-failed-bionic. In either case, without details of your testing we will not be able to proceed.

Further information regarding the verification process can be found at https://wiki.ubuntu.com/QATeam/PerformingSRUVerification . Thank you in advance for helping!

N.B. The updated package will be released to -updates after the bug(s) fixed by this package have been verified and the package has been in -proposed for a minimum of 7 days.

Changed in sg3-utils (Ubuntu Eoan):
status: In Progress → Fix Committed
tags: added: verification-needed-eoan
Revision history for this message
Robie Basak (racb) wrote :

Hello Ryan, or anyone else affected,

Accepted sg3-utils into eoan-proposed. The package will build now and be available at https://launchpad.net/ubuntu/+source/sg3-utils/1.44-1ubuntu1.1 in a few hours, and then in the -proposed repository.

Please help us by testing this new package. See https://wiki.ubuntu.com/Testing/EnableProposed for documentation on how to enable and use -proposed. Your feedback will aid us getting this update out to other Ubuntu users.

If this package fixes the bug for you, please add a comment to this bug, mentioning the version of the package you tested and change the tag from verification-needed-eoan to verification-done-eoan. If it does not fix the bug for you, please add a comment stating that, and change the tag to verification-failed-eoan. In either case, without details of your testing we will not be able to proceed.

Further information regarding the verification process can be found at https://wiki.ubuntu.com/QATeam/PerformingSRUVerification . Thank you in advance for helping!

N.B. The updated package will be released to -updates after the bug(s) fixed by this package have been verified and the package has been in -proposed for a minimum of 7 days.

Revision history for this message
Michael Hudson-Doyle (mwhudson) wrote :

Verified on eoan:

m@m:~$ dpkg -l sg3-utils-udev
Desired=Unknown/Install/Remove/Purge/Hold
| Status=Not/Inst/Conf-files/Unpacked/halF-conf/Half-inst/trig-aWait/Trig-pend
|/ Err?=(none)/Reinst-required (Status,Err: uppercase=bad)
||/ Name Version Architecture Description
+++-==============-=============-============-=============================================================
ii sg3-utils-udev 1.44-1ubuntu1 all utilities for devices using the SCSI command set (udev rules)
m@m:~$ udevadm info --query=property /dev/sdb | grep ID_SERIAL=
ID_SERIAL=3
m@m:~$ sudo apt install sg3-utils-udev/eoan-proposed
[elided]
m@m:~$ sudo udevadm trigger /dev/sdb
m@m:~$ dpkg -l sg3-utils-udev
Desired=Unknown/Install/Remove/Purge/Hold
| Status=Not/Inst/Conf-files/Unpacked/halF-conf/Half-inst/trig-aWait/Trig-pend
|/ Err?=(none)/Reinst-required (Status,Err: uppercase=bad)
||/ Name Version Architecture Description
+++-==============-===============-============-=============================================================
ii sg3-utils-udev 1.44-1ubuntu1.1 all utilities for devices using the SCSI command set (udev rules)
m@m:~$ udevadm info --query=property /dev/sdb | grep ID_SERIAL=
ID_SERIAL=322dc58dc023c7008

Revision history for this message
Michael Hudson-Doyle (mwhudson) wrote :

And bionic:

Desired=Unknown/Install/Remove/Purge/Hold
| Status=Not/Inst/Conf-files/Unpacked/halF-conf/Half-inst/trig-aWait/Trig-pend
|/ Err?=(none)/Reinst-required (Status,Err: uppercase=bad)
||/ Name Version Architecture Description
+++-=====================================-=======================-=======================-================================================================================
ii sg3-utils-udev 1.42-2ubuntu1.18.04.1 all utilities for devices using the SCSI command set (udev rules)
m@m:~$ udevadm info --query=property /dev/sdb | grep ID_SERIAL
ID_SERIAL=3
ID_SERIAL_SHORT=22dc58dc023c7008
m@m:~$ sudo apt install sg3-utils-udev/bionic-proposed
Reading package lists... Done
Building dependency tree
Reading state information... Done
Selected version '1.42-2ubuntu1.18.04.2' (Ubuntu:18.04/bionic-proposed [all]) for 'sg3-utils-udev'
The following packages will be upgraded:
  sg3-utils-udev
1 upgraded, 0 newly installed, 0 to remove and 65 not upgraded.
Need to get 5,112 B of archives.
After this operation, 0 B of additional disk space will be used.
Get:1 http://nz.archive.ubuntu.com/ubuntu bionic-proposed/main amd64 sg3-utils-udev all 1.42-2ubuntu1.18.04.2 [5,112 B]
Fetched 5,112 B in 0s (27.8 kB/s)
(Reading database ... 67172 files and directories currently installed.)
Preparing to unpack .../sg3-utils-udev_1.42-2ubuntu1.18.04.2_all.deb ...
Unpacking sg3-utils-udev (1.42-2ubuntu1.18.04.2) over (1.42-2ubuntu1.18.04.1) ...
Setting up sg3-utils-udev (1.42-2ubuntu1.18.04.2) ...
update-initramfs: deferring update (trigger activated)
Processing triggers for initramfs-tools (0.130ubuntu3.8) ...
update-initramfs: Generating /boot/initrd.img-4.15.0-88-generic
m@m:~$ sudo udevadm trigger /dev/sdb
m@m:~$ dpkg -l sg3-utils-udev
Desired=Unknown/Install/Remove/Purge/Hold
| Status=Not/Inst/Conf-files/Unpacked/halF-conf/Half-inst/trig-aWait/Trig-pend
|/ Err?=(none)/Reinst-required (Status,Err: uppercase=bad)
||/ Name Version Architecture Description
+++-=====================================-=======================-=======================-================================================================================
ii sg3-utils-udev 1.42-2ubuntu1.18.04.2 all utilities for devices using the SCSI command set (udev rules)
m@m:~$ udevadm info --query=property /dev/sdb | grep ID_SERIAL
ID_SERIAL=322dc58dc023c7008
ID_SERIAL_SHORT=22dc58dc023c7008

tags: added: verification-done-bionic verification-done-eoan
removed: verification-needed verification-needed-bionic verification-needed-eoan
Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package sg3-utils - 1.42-2ubuntu1.18.04.2

---------------
sg3-utils (1.42-2ubuntu1.18.04.2) bionic; urgency=medium

  * Fix a typo in a udev rule that leads to truncated ID_SERIAL values in
    udev. (LP: #1859858)

 -- Michael Hudson-Doyle <email address hidden> Tue, 10 Mar 2020 14:05:18 +1300

Changed in sg3-utils (Ubuntu Bionic):
status: Fix Committed → Fix Released
Revision history for this message
Brian Murray (brian-murray) wrote : Update Released

The verification of the Stable Release Update for sg3-utils has completed successfully and the package is now being released to -updates. Subsequently, the Ubuntu Stable Release Updates Team is being unsubscribed and will not receive messages about this bug report. In the event that you encounter a regression using the package from -updates please report a new bug using ubuntu-bug and tag the bug report regression-update so we can easily find any regressions.

Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package sg3-utils - 1.44-1ubuntu1.1

---------------
sg3-utils (1.44-1ubuntu1.1) eoan; urgency=medium

  * Fix a typo in a udev rule that leads to truncated ID_SERIAL values in
    udev. (LP: #1859858)

 -- Michael Hudson-Doyle <email address hidden> Tue, 25 Feb 2020 11:00:07 +1300

Changed in sg3-utils (Ubuntu Eoan):
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.