distr1 / distri

a Linux distribution to research fast package management
https://distr1.org
Other
536 stars 26 forks source link

/dev/mapper/cryptroot is missing #16

Closed stapelberg closed 5 years ago

stapelberg commented 5 years ago

This prevents us from finishing the kernel hook in issue #12.

In journalctl -b, I can see:

Jun 26 09:14:33 localhost systemd-udevd[2895]: conflicting device node '/dev/mapper/cryptroot' found, link to '/dev/dm-0' will not be created

Creating the symlink manually seems to work.

stapelberg commented 5 years ago

Tried creating a /etc/crypttab, but that doesn’t help—I do get additional messages during boot, but no symlink:

Jun 26 09:29:03 xps systemd[1]: Starting Cryptography Setup for cryptroot...
Jun 26 09:29:03 xps systemd-cryptsetup[3988]: Volume cryptroot already active.
Jun 26 09:29:03 xps systemd[1]: Started Cryptography Setup for cryptroot.
stapelberg commented 5 years ago

Looks like the dracut-generated initramfs generates its own device node instead of a symlink:

:/# ls -l /dev/mapper/cryptroot 
brw------- 1 root root 252, 0 Jun 26 07:48 /dev/mapper/cryptroot
:/# ls -l /dev/dm*
brw-rw---- 1 root disk 252, 0 Jun 26 07:48 /dev/dm-0

Possibly related: https://bugzilla.redhat.com/show_bug.cgi?id=759402

stapelberg commented 5 years ago

Pretty certain at this point that we need to build lvm2 with --enable-udev_rules, but doing so results in a hanging boot. Still debugging this.

stapelberg commented 5 years ago

As a note for myself: useful debugging pointers for initramfs/dracut debugging:

  1. --debug flag in dracut
  2. http://man7.org/linux/man-pages/man7/dracut.bootup.7.html
  3. Kernel boot options rd.break=pre-trigger rd.shell systemd.log_level=debug systemd.log_target=console
  4. Manually attach the device in a dracut emergency shell: /ro/systemd-amd64-239-8/out/lib/systemd/systemd-cryptsetup attach cryptroot /dev/sda4
stapelberg commented 5 years ago

The hanging boot was fixed by setting the udev directory to the overlay /ro/lib/udev (previously /ro/systemd-amd64-239-7/out/lib/udev), which results in the lvm2 device mapper udev rules files being included in the dracut-generated initrd.