For older releases such as bionic we have one event:

UDEV  [1304.304437] change   /devices/virtual/block/bcache0 (block)
.ID_FS_TYPE_NEW=
ACTION=change
CACHED_LABEL=
CACHED_UUID=0192e0a7-9d8e-4771-9bb1-d730a2f66a9d
DEVLINKS=/dev/bcache/by-uuid/0192e0a7-9d8e-4771-9bb1-d730a2f66a9d
DEVNAME=/dev/bcache0
DEVPATH=/devices/virtual/block/bcache0
DEVTYPE=disk
DRIVER=bcache
ID_FS_TYPE=
MAJOR=251
MINOR=0
SEQNUM=4384
SUBSYSTEM=block
TAGS=:systemd:
USEC_INITIALIZED=1304237024

that creates the expected symlink.

---------

For focal, instead we get two events:

UDEV  [2763.370729] change   /devices/virtual/block/bcache0 (block)
ACTION=change
DEVPATH=/devices/virtual/block/bcache0
SUBSYSTEM=block
DRIVER=bcache
CACHED_UUID=1522715e-a390-40db-8d47-06fb728014e5
CACHED_LABEL=
DEVNAME=/dev/bcache0
DEVTYPE=disk
SEQNUM=5523
USEC_INITIALIZED=2763323504
.ID_FS_TYPE_NEW=
ID_FS_TYPE=
MAJOR=251
MINOR=0
DEVLINKS=/dev/bcache/by-uuid/1522715e-a390-40db-8d47-06fb728014e5
TAGS=:systemd:

KERNEL[2784.362374] change   /devices/virtual/block/bcache0 (block)
ACTION=change
DEVPATH=/devices/virtual/block/bcache0
SUBSYSTEM=block
SYNTH_UUID=0
DEVNAME=/dev/bcache0
DEVTYPE=disk
SEQNUM=5524
MAJOR=251
MINOR=0

UDEV  [2784.433618] change   /devices/virtual/block/bcache0 (block)
ACTION=change
DEVPATH=/devices/virtual/block/bcache0
SUBSYSTEM=block
SYNTH_UUID=0
DEVNAME=/dev/bcache0
DEVTYPE=disk
SEQNUM=5524
USEC_INITIALIZED=2763323504
ID_FS_UUID=30b28bee-6a1e-423d-9d53-32c78ba5454a
ID_FS_UUID_ENC=30b28bee-6a1e-423d-9d53-32c78ba5454a
ID_FS_VERSION=1.0
ID_FS_TYPE=ext4
ID_FS_USAGE=filesystem
.ID_FS_TYPE_NEW=ext4
MAJOR=251
MINOR=0
DEVLINKS=/dev/disk/by-uuid/30b28bee-6a1e-423d-9d53-32c78ba5454a
TAGS=:systemd:

This performs:

pr 21 14:15:22 ubuntu-focal systemd-udevd[1870]: bcache0: Processing device 
(SEQNUM=5523, ACTION=change)
Apr 21 14:15:22 ubuntu-focal systemd-udevd[1870]: bcache0: Removing watch
Apr 21 14:15:22 ubuntu-focal systemd-udevd[1870]: value '[dmi/id]sys_vendor' is 
'QEMU'
Apr 21 14:15:22 ubuntu-focal systemd-udevd[1870]: value '[dmi/id]sys_vendor' is 
'QEMU'
Apr 21 14:15:22 ubuntu-focal systemd-udevd[1870]: bcache0: 
/usr/lib/udev/rules.d/60-persistent-storage.rules:109 Importing properties from 
results of builtin command 'blkid'
Apr 21 14:15:22 ubuntu-focal systemd-udevd[1870]: bcache0: Probe /dev/bcache0 
with raid and offset=0
Apr 21 14:15:22 ubuntu-focal systemd-udevd[1870]: bcache0: 
/usr/lib/udev/rules.d/69-bcache.rules:16 Importing properties from results of 
'probe-bcache -o udev /dev/bcache0'
Apr 21 14:15:22 ubuntu-focal systemd-udevd[1870]: bcache0: Starting 
'probe-bcache -o udev /dev/bcache0'
Apr 21 14:15:22 ubuntu-focal systemd-udevd[1870]: Successfully forked off 
'(spawn)' as PID 1912.
Apr 21 14:15:22 ubuntu-focal systemd-udevd[1870]: bcache0: Process 
'probe-bcache -o udev /dev/bcache0' succeeded.
Apr 21 14:15:22 ubuntu-focal systemd-udevd[1870]: bcache0: 
/usr/lib/udev/rules.d/69-bcache.rules:27 LINK 
'bcache/by-uuid/1522715e-a390-40db-8d47-06fb728014e5'
Apr 21 14:15:22 ubuntu-focal systemd-udevd[1870]: bcache0: Handling device node 
'/dev/bcache0', devnum=b251:0
Apr 21 14:15:22 ubuntu-focal systemd-udevd[1870]: bcache0: Preserve already 
existing symlink '/dev/block/251:0' to '../bcache0'
Apr 21 14:15:22 ubuntu-focal systemd-udevd[1870]: bcache0: Creating symlink 
'/dev/bcache/by-uuid/1522715e-a390-40db-8d47-06fb728014e5' to '../../bcache0'
Apr 21 14:15:22 ubuntu-focal systemd-udevd[1870]: bcache0: sd-device: Created 
db file '/run/udev/data/b251:0' for '/devices/virtual/block/bcache0'
Apr 21 14:15:22 ubuntu-focal systemd-udevd[1870]: bcache0: Adding watch on 
'/dev/bcache0'
Apr 21 14:15:22 ubuntu-focal systemd-udevd[1870]: bcache0: sd-device: Created 
db file '/run/udev/data/b251:0' for '/devices/virtual/block/bcache0'
Apr 21 14:15:22 ubuntu-focal systemd-udevd[1870]: bcache0: Device (SEQNUM=5523, 
ACTION=change) processed
Apr 21 14:15:22 ubuntu-focal systemd-udevd[1870]: bcache0: sd-device-monitor: 
Passed 388 byte to netlink monitor

followed by the extra action:

Apr 21 14:15:43 ubuntu-focal systemd-udevd[1916]: bcache0: Processing device 
(SEQNUM=5524, ACTION=change)
Apr 21 14:15:43 ubuntu-focal systemd-udevd[1916]: bcache0: Removing watch
Apr 21 14:15:43 ubuntu-focal systemd-udevd[1916]: value '[dmi/id]sys_vendor' is 
'QEMU'
Apr 21 14:15:43 ubuntu-focal systemd-udevd[1916]: value '[dmi/id]sys_vendor' is 
'QEMU'
Apr 21 14:15:43 ubuntu-focal systemd-udevd[1916]: bcache0: 
/usr/lib/udev/rules.d/60-persistent-storage.rules:109 Importing properties from 
results of builtin command 'blkid'
Apr 21 14:15:43 ubuntu-focal systemd-udevd[1916]: bcache0: Probe /dev/bcache0 
with raid and offset=0
Apr 21 14:15:43 ubuntu-focal systemd-udevd[1916]: bcache0: 
/usr/lib/udev/rules.d/60-persistent-storage.rules:112 LINK 
'disk/by-uuid/30b28bee-6a1e-423d-9d53-32c78ba5454a'
Apr 21 14:15:43 ubuntu-focal systemd-udevd[1916]: bcache0: Updating old name, 
'/dev/bcache/by-uuid/1522715e-a390-40db-8d47-06fb728014e5' no longer belonging 
to '/devices/virtual/block/bcache0'
Apr 21 14:15:43 ubuntu-focal systemd-udevd[1916]: bcache0: No reference left, 
removing '/dev/bcache/by-uuid/1522715e-a390-40db-8d47-06fb728014e5'
Apr 21 14:15:43 ubuntu-focal systemd-udevd[1916]: bcache0: Handling device node 
'/dev/bcache0', devnum=b251:0
Apr 21 14:15:43 ubuntu-focal systemd-udevd[1916]: bcache0: Preserve already 
existing symlink '/dev/block/251:0' to '../bcache0'
Apr 21 14:15:43 ubuntu-focal systemd-udevd[1916]: bcache0: Creating symlink 
'/dev/disk/by-uuid/30b28bee-6a1e-423d-9d53-32c78ba5454a' to '../../bcache0'
Apr 21 14:15:43 ubuntu-focal systemd-udevd[1916]: bcache0: sd-device: Created 
db file '/run/udev/data/b251:0' for '/devices/virtual/block/bcache0'
Apr 21 14:15:43 ubuntu-focal systemd-udevd[1916]: bcache0: Adding watch on 
'/dev/bcache0'
Apr 21 14:15:43 ubuntu-focal systemd-udevd[1916]: bcache0: sd-device: Created 
db file '/run/udev/data/b251:0' for '/devices/virtual/block/bcache0'
Apr 21 14:15:43 ubuntu-focal systemd-udevd[1916]: bcache0: Device (SEQNUM=5524, 
ACTION=change) processed
Apr 21 14:15:43 ubuntu-focal systemd-udevd[1916]: bcache0: sd-device-monitor: 
Passed 471 byte to netlink monitor

So it appears the symlink is being added to /dev/bcache/by-
uuid/1522715e-a390-40db-8d47-06fb728014e5 and then the next udev action
removes this symlink and adds dev/disk/by-uuid/30b28bee-6a1e-423d-
9d53-32c78ba5454a instead.

-- 
You received this bug notification because you are a member of Kernel
Packages, which is subscribed to linux in Ubuntu.
https://bugs.launchpad.net/bugs/1729145

Title:
  /dev/bcache/by-uuid links not created after reboot

Status in linux package in Ubuntu:
  Fix Released
Status in linux source package in Xenial:
  Fix Released
Status in linux source package in Zesty:
  Won't Fix
Status in linux source package in Artful:
  Fix Released
Status in linux source package in Bionic:
  Fix Released

Bug description:
  1. $ lsb_release -rd
  Description:  Ubuntu 17.10
  Release:      17.10

  2. $ apt-cache policy linux-image-`uname -r`
  linux-image-4.13.0-16-generic:
    Installed: 4.13.0-16.19
    Candidate: 4.13.0-16.19
    Version table:
   *** 4.13.0-16.19 500
          500 http://nova.clouds.archive.ubuntu.com/ubuntu artful/main amd64 
Packages
          100 /var/lib/dpkg/status

  3. After creating some bcache devices and rebooting 
/dev/bcache/by-uuid/<UUID> -> ../../bcacheN
  symlinks point to the current bcache device which is caching the dev.uuid 
found after creating a backing device.

  4. /dev/bcache/by-uuid does not exist and there are not symlinks
  underneath

  It appears that since the initramfs loads the bcache module which
  probes and finds all of the cache devices and backing devices then
  once the rootfs is mounted and udev gets to run, the bcache kernel
  module does not emit the CACHED_UUID value into the environment if the
  underlying devices are already registered.

  In dmesg, one can see that prior to mounting the rootfs, we see bcache
  register events:

  [    5.333973] bcache: register_bdev() registered backing device vdb2
  [    5.354138] bcache: register_bdev() registered backing device vdb4
  [    5.365665] bcache: register_bdev() registered backing device vdb3
  [    5.397720] bcache: bch_journal_replay() journal replay done, 0 keys in 1 
entries, seq 1
  [    5.428683] bcache: register_cache() registered cache device vdb1

  then rootfs ismounted and systemd starts systemd-udev

  [    9.350889] systemd[1]: Listening on udev Kernel Socket.

  And then the coldplug replay of kernel events triggers 
/lib/udev/rules.d/69-bcache.rules
  which invokes /lib/udev/bcache-register which writes the device name 
(/dev/vdb1 or /dev/bcache0) into /sys/fs/bcache/register and results is the 
bcache kernel driver attempting to register the block device.  However, there 
is already a bcache device associated already and registration fails

  [   11.173141] bcache: register_bcache() error opening /dev/vdb2: device 
already registered
  [   11.184617] bcache: register_bcache() error opening /dev/vdb3: device 
already registered
  [   11.199130] bcache: register_bcache() error opening /dev/vdb1: device 
already registered
  [   11.271694] bcache: register_bcache() error opening /dev/vdb4: device 
already registered

  The problem then is that only a kernel call to bch_cached_dev_run()
  which happens like this:

  bcache_register()
    register_bdev()
      bch_cached_dev_run()
        kobject_uevent_env(&disk_to_dev(d->disk)->kobj, KOBJ_CHANGE, env);

  where env includes:
      "DRIVER=bcache",
          kasprintf(GFP_KERNEL, "CACHED_UUID=%pU", dc->sb.uuid),
          NULL,
          NULL,
      };

  Since that event is not emitted for any previously registered device,
  then the symlink will not be created.

  ProblemType: Bug
  DistroRelease: Ubuntu 17.10
  Package: linux-image-4.13.0-16-generic 4.13.0-16.19
  ProcVersionSignature: User Name 4.13.0-16.19-generic 4.13.4
  Uname: Linux 4.13.0-16-generic x86_64
  AlsaDevices:
   total 0
   crw-rw---- 1 root audio 116,  1 Oct 31 22:09 seq
   crw-rw---- 1 root audio 116, 33 Oct 31 22:09 timer
  AplayDevices: Error: [Errno 2] No such file or directory: 'aplay': 'aplay'
  ApportVersion: 2.20.7-0ubuntu3.1
  Architecture: amd64
  ArecordDevices: Error: [Errno 2] No such file or directory: 'arecord': 
'arecord'
  AudioDevicesInUse: Error: command ['fuser', '-v', '/dev/snd/seq', 
'/dev/snd/timer'] failed with exit code 1:
  CRDA: N/A
  Date: Wed Nov  1 01:39:01 2017
  Ec2AMI: ami-0000030b
  Ec2AMIManifest: FIXME
  Ec2AvailabilityZone: nova
  Ec2InstanceType: m1.small
  Ec2Kernel: unavailable
  Ec2Ramdisk: unavailable
  IwConfig: Error: [Errno 2] No such file or directory: 'iwconfig': 'iwconfig'
  Lsusb:
   Bus 001 Device 002: ID 0627:0001 Adomax Technology Co., Ltd
   Bus 001 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
  MachineType: OpenStack Foundation OpenStack Nova
  PciMultimedia:

  ProcEnviron:
   TERM=xterm
   PATH=(custom, no user)
   XDG_RUNTIME_DIR=<set>
   LANG=C.UTF-8
   SHELL=/bin/bash
  ProcFB:

  ProcKernelCmdLine: BOOT_IMAGE=/boot/vmlinuz-4.13.0-16-generic 
root=LABEL=cloudimg-rootfs ro console=tty1 console=ttyS0
  RelatedPackageVersions:
   linux-restricted-modules-4.13.0-16-generic N/A
   linux-backports-modules-4.13.0-16-generic  N/A
   linux-firmware                             N/A
  RfKill: Error: [Errno 2] No such file or directory: 'rfkill': 'rfkill'
  SourcePackage: linux
  UpgradeStatus: No upgrade log present (probably fresh install)
  dmi.bios.date: 04/01/2014
  dmi.bios.vendor: SeaBIOS
  dmi.bios.version: 1.10.1-1ubuntu1~cloud0
  dmi.chassis.type: 1
  dmi.chassis.vendor: QEMU
  dmi.chassis.version: pc-i440fx-zesty
  dmi.modalias: 
dmi:bvnSeaBIOS:bvr1.10.1-1ubuntu1~cloud0:bd04/01/2014:svnOpenStackFoundation:pnOpenStackNova:pvr15.0.7:cvnQEMU:ct1:cvrpc-i440fx-zesty:
  dmi.product.family: Virtual Machine
  dmi.product.name: OpenStack Nova
  dmi.product.version: 15.0.7
  dmi.sys.vendor: OpenStack Foundation

  Related bugs:
   * bug 1728742: [userspace] curtin dname for bcache uses unstable devname 
instead of UUID Edit

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/linux/+bug/1729145/+subscriptions

-- 
Mailing list: https://launchpad.net/~kernel-packages
Post to     : kernel-packages@lists.launchpad.net
Unsubscribe : https://launchpad.net/~kernel-packages
More help   : https://help.launchpad.net/ListHelp

Reply via email to