[Bug 1713086] [NEW] systemd fails to generate .device units inside LXD containers

A.J. Ruckman ajthemacboy at gmail.com
Fri Aug 25 15:03:40 UTC 2017


Public bug reported:

See LXD issue here for more context:
https://github.com/lxc/lxd/issues/3638

After attaching a block device (in my case /dev/sdc3) to a LXD
container, the dev-sdc3.device unit is not generated. However, the dev-
sdc3.mount unit is generated correctly.

Steps to reproduce (from GitHub issue):

stgraber at castiana:~$ truncate -s 10G test.img
stgraber at castiana:~$ sudo losetup -f test.img
stgraber at castiana:~$ sudo losetup -a
/dev/loop1: [0022]:169383 (/var/lib/snapd/snaps/core_2381.snap)
/dev/loop2: [0022]:770242 (/var/lib/snapd/snaps/core_2312.snap)
/dev/loop0: [0022]:1170310 (/var/lib/snapd/snaps/core_2462.snap)
/dev/loop3: [0045]:309158 (/home/stgraber/test.img)
stgraber at castiana:~$ lxc launch ubuntu:16.04 issue3638
Creating issue3638
Starting issue3638
stgraber at castiana:~$ lxc config device add issue3638 sda unix-block source=/dev/loop3 path=/dev/sda
Device sda added to issue3638
stgraber at castiana:~$ lxc exec issue3638 -- mkfs.ext4 /dev/sda
mke2fs 1.42.13 (17-May-2015)
Discarding device blocks: done
Creating filesystem with 2621440 4k blocks and 655360 inodes
Filesystem UUID: 77832ca2-b16d-4b94-8f7d-9ea08c5e6913
Superblock backups stored on blocks:
 32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632

Allocating group tables: done
Writing inode tables: done
Creating journal (32768 blocks): done
Writing superblocks and filesystem accounting information: done

stgraber at castiana:~$ echo Y | sudo tee /sys/module/ext4/parameters/userns_mounts
Y
stgraber at castiana:~$ lxc exec issue3638 -- mount /dev/sda /mnt
stgraber at castiana:~$ lxc exec issue3638 bash
root at issue3638:~# echo "/dev/sda /mnt ext4 defaults 0 0" >> /etc/fstab
root at issue3638:~# cat /etc/fstab
LABEL=cloudimg-rootfs	/	 ext4	defaults	0 0
/dev/sda /mnt ext4 defaults 0 0
root at issue3638:~# exit
stgraber at castiana:~$ lxc exec issue3638 -- umount /mnt
stgraber at castiana:~$ lxc exec issue3638 -- mount /mnt
stgraber at castiana:~$ lxc stop issue3638
stgraber at castiana:~$ lxc start issue3638
stgraber at castiana:~$ lxc exec issue3638 -- mount | grep mnt
stgraber at castiana:~$ lxc exec issue3638 -- systemctl -a | grep mnt
  mnt.mount                                  loaded    inactive dead      start /mnt
stgraber at castiana:~$ lxc exec issue3638 -- systemctl -a | grep sda
  dev-sda.device                             loaded    inactive dead      start dev-sda.device
  dev-sda.mount                              loaded    active   mounted         /dev/sda
stgraber at castiana:~$ lxc exec issue3638 -- ps aux | grep udev
root        54  0.0  0.0  41720  1864 ?        Ss   16:55   0:00 /lib/systemd/systemd-udevd
stgraber at castiana:~$

** Affects: systemd (Ubuntu)
     Importance: Undecided
         Status: New

** Description changed:

  See LXD issue here for more context:
  https://github.com/lxc/lxd/issues/3638
  
- After attaching a block device (in this case /dev/sdc3) to a LXD
+ After attaching a block device (in my case /dev/sdc3) to a LXD
  container, the dev-sdc3.device unit is not generated. However, the dev-
  sdc3.mount unit is generated correctly.
  
  Steps to reproduce (from GitHub issue):
- 
  
  stgraber at castiana:~$ truncate -s 10G test.img
  stgraber at castiana:~$ sudo losetup -f test.img
  stgraber at castiana:~$ sudo losetup -a
  /dev/loop1: [0022]:169383 (/var/lib/snapd/snaps/core_2381.snap)
  /dev/loop2: [0022]:770242 (/var/lib/snapd/snaps/core_2312.snap)
  /dev/loop0: [0022]:1170310 (/var/lib/snapd/snaps/core_2462.snap)
  /dev/loop3: [0045]:309158 (/home/stgraber/test.img)
  stgraber at castiana:~$ lxc launch ubuntu:16.04 issue3638
  Creating issue3638
  Starting issue3638
  stgraber at castiana:~$ lxc config device add issue3638 sda unix-block source=/dev/loop3 path=/dev/sda
  Device sda added to issue3638
  stgraber at castiana:~$ lxc exec issue3638 -- mkfs.ext4 /dev/sda
  mke2fs 1.42.13 (17-May-2015)
- Discarding device blocks: done                            
+ Discarding device blocks: done
  Creating filesystem with 2621440 4k blocks and 655360 inodes
  Filesystem UUID: 77832ca2-b16d-4b94-8f7d-9ea08c5e6913
- Superblock backups stored on blocks: 
- 	32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632
+ Superblock backups stored on blocks:
+  32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632
  
- Allocating group tables: done                            
- Writing inode tables: done                            
+ Allocating group tables: done
+ Writing inode tables: done
  Creating journal (32768 blocks): done
- Writing superblocks and filesystem accounting information: done 
+ Writing superblocks and filesystem accounting information: done
  
  stgraber at castiana:~$ echo Y | sudo tee /sys/module/ext4/parameters/userns_mounts
  Y
  stgraber at castiana:~$ lxc exec issue3638 -- mount /dev/sda /mnt
  stgraber at castiana:~$ lxc exec issue3638 bash
  root at issue3638:~# echo "/dev/sda /mnt ext4 defaults 0 0" >> /etc/fstab
- root at issue3638:~# cat /etc/fstab 
+ root at issue3638:~# cat /etc/fstab
  LABEL=cloudimg-rootfs	/	 ext4	defaults	0 0
  /dev/sda /mnt ext4 defaults 0 0
  root at issue3638:~# exit
  stgraber at castiana:~$ lxc exec issue3638 -- umount /mnt
  stgraber at castiana:~$ lxc exec issue3638 -- mount /mnt
  stgraber at castiana:~$ lxc stop issue3638
  stgraber at castiana:~$ lxc start issue3638
  stgraber at castiana:~$ lxc exec issue3638 -- mount | grep mnt
  stgraber at castiana:~$ lxc exec issue3638 -- systemctl -a | grep mnt
-   mnt.mount                                  loaded    inactive dead      start /mnt
+   mnt.mount                                  loaded    inactive dead      start /mnt
  stgraber at castiana:~$ lxc exec issue3638 -- systemctl -a | grep sda
-   dev-sda.device                             loaded    inactive dead      start dev-sda.device
-   dev-sda.mount                              loaded    active   mounted         /dev/sda
+   dev-sda.device                             loaded    inactive dead      start dev-sda.device
+   dev-sda.mount                              loaded    active   mounted         /dev/sda
  stgraber at castiana:~$ lxc exec issue3638 -- ps aux | grep udev
  root        54  0.0  0.0  41720  1864 ?        Ss   16:55   0:00 /lib/systemd/systemd-udevd
  stgraber at castiana:~$

-- 
You received this bug notification because you are a member of Ubuntu
Foundations Bugs, which is subscribed to systemd in Ubuntu.
https://bugs.launchpad.net/bugs/1713086

Title:
  systemd fails to generate .device units inside LXD containers

Status in systemd package in Ubuntu:
  New

Bug description:
  See LXD issue here for more context:
  https://github.com/lxc/lxd/issues/3638

  After attaching a block device (in my case /dev/sdc3) to a LXD
  container, the dev-sdc3.device unit is not generated. However, the
  dev-sdc3.mount unit is generated correctly.

  Steps to reproduce (from GitHub issue):

  stgraber at castiana:~$ truncate -s 10G test.img
  stgraber at castiana:~$ sudo losetup -f test.img
  stgraber at castiana:~$ sudo losetup -a
  /dev/loop1: [0022]:169383 (/var/lib/snapd/snaps/core_2381.snap)
  /dev/loop2: [0022]:770242 (/var/lib/snapd/snaps/core_2312.snap)
  /dev/loop0: [0022]:1170310 (/var/lib/snapd/snaps/core_2462.snap)
  /dev/loop3: [0045]:309158 (/home/stgraber/test.img)
  stgraber at castiana:~$ lxc launch ubuntu:16.04 issue3638
  Creating issue3638
  Starting issue3638
  stgraber at castiana:~$ lxc config device add issue3638 sda unix-block source=/dev/loop3 path=/dev/sda
  Device sda added to issue3638
  stgraber at castiana:~$ lxc exec issue3638 -- mkfs.ext4 /dev/sda
  mke2fs 1.42.13 (17-May-2015)
  Discarding device blocks: done
  Creating filesystem with 2621440 4k blocks and 655360 inodes
  Filesystem UUID: 77832ca2-b16d-4b94-8f7d-9ea08c5e6913
  Superblock backups stored on blocks:
   32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632

  Allocating group tables: done
  Writing inode tables: done
  Creating journal (32768 blocks): done
  Writing superblocks and filesystem accounting information: done

  stgraber at castiana:~$ echo Y | sudo tee /sys/module/ext4/parameters/userns_mounts
  Y
  stgraber at castiana:~$ lxc exec issue3638 -- mount /dev/sda /mnt
  stgraber at castiana:~$ lxc exec issue3638 bash
  root at issue3638:~# echo "/dev/sda /mnt ext4 defaults 0 0" >> /etc/fstab
  root at issue3638:~# cat /etc/fstab
  LABEL=cloudimg-rootfs	/	 ext4	defaults	0 0
  /dev/sda /mnt ext4 defaults 0 0
  root at issue3638:~# exit
  stgraber at castiana:~$ lxc exec issue3638 -- umount /mnt
  stgraber at castiana:~$ lxc exec issue3638 -- mount /mnt
  stgraber at castiana:~$ lxc stop issue3638
  stgraber at castiana:~$ lxc start issue3638
  stgraber at castiana:~$ lxc exec issue3638 -- mount | grep mnt
  stgraber at castiana:~$ lxc exec issue3638 -- systemctl -a | grep mnt
    mnt.mount                                  loaded    inactive dead      start /mnt
  stgraber at castiana:~$ lxc exec issue3638 -- systemctl -a | grep sda
    dev-sda.device                             loaded    inactive dead      start dev-sda.device
    dev-sda.mount                              loaded    active   mounted         /dev/sda
  stgraber at castiana:~$ lxc exec issue3638 -- ps aux | grep udev
  root        54  0.0  0.0  41720  1864 ?        Ss   16:55   0:00 /lib/systemd/systemd-udevd
  stgraber at castiana:~$

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



More information about the foundations-bugs mailing list