FS#11571 - [cryptsetup] encrypt hook must wait for root usb device to settle
Attached to Project:
Arch Linux
Opened by Jose Manuel Cejudo Gausi (jmcejudo) - Tuesday, 23 September 2008, 21:36 GMT
Last edited by Thomas Bächler (brain0) - Sunday, 07 June 2009, 13:25 GMT
Opened by Jose Manuel Cejudo Gausi (jmcejudo) - Tuesday, 23 September 2008, 21:36 GMT
Last edited by Thomas Bächler (brain0) - Sunday, 07 June 2009, 13:25 GMT
|
Details
Description:
When booting into a root and encrypted (luks) usb device the encrypt hook doesn't wait for the usb device to settle, so cryptsetup doesn't recognizes the device. I can solve the issue adding the following line to the beginning of run_hook() in the encrypt hook file: /bin/sleep "${rootdelay}" Additional info: mkinitcpio.conf: MODULES="" BINARIES="" FILES="" HOOKS="base udev usb encrypt filesystems" Steps to reproduce: Setup a "live usb" system with the boot partition encrypted. sorry for my english :) |
This task depends upon
Closed by Thomas Bächler (brain0)
Sunday, 07 June 2009, 13:25 GMT
Reason for closing: Fixed
Additional comments about closing: In the next cryptsetup version (1.0.6-3), this will respect the rootdelay parameter and use the poll_device method. Your problem should be gone then.
Sunday, 07 June 2009, 13:25 GMT
Reason for closing: Fixed
Additional comments about closing: In the next cryptsetup version (1.0.6-3), this will respect the rootdelay parameter and use the poll_device method. Your problem should be gone then.
put a new hard drive into my laptop and moved my arch-installed drive to a usb enclosure.
booted a live disk to create a /boot partition on the new hdd
copied over the contents of arch's /boot
edited menu.lst appropriately (grub on /dev/sda1, root on /dev/sdb1)
booted to the same error condition
my fix is documented at: http://bbs.archlinux.org/viewtopic.php?id=59084
i'd suggest the test go in .../hooks/usb. i'm guessing the placment of the $rootdelay check lines in .../hooks/filesystems predates the encrypt and lvm hooks, since both can depend on settled usb devices but come before filesystems and kinit.
if the usb hook uses udevadm to achieve rootdelay's purpose, is rootdelay needed at all?
(a) looks in sysfs for all usb block devices
(b) waits until their nodes exist in /dev
or is that what udevadm settle should do?
The USB-based block devices appear later. However, once udev sees them, the device nodes are there immediately, udevadm cannot help us here.
i've tried building an initcpio with udevd --daemon --debug, and i tried adding udevadm monitor (both to the [udev] hook). the former produced *way* too much output, and then latter didn't seem to produce any.
can you explain/advise?
thanks!
My solution to add something like this to the usb hook:
until [ -e /dev/sdb ];
do
sleep 1;
done
Related forum thread here: http://bbs.archlinux.org/viewtopic.php?id=65407
My hooks array in /etc/mkinitcpio.conf looks like this:
HOOKS="base udev usb encrypt autodetect ide pata scsi sata filesystems"
Nothe that I was only able to boot from encrypted usb when usb and encrypt opions was before autodetect, etc... and filesystems at the last position.
I added too this line to the end, after the last curly brace, on the usb hook
sleep 15
but I think that the hooks order did the trick