[Pkg-cryptsetup-devel] Bug#488271: Bug#488271: Bug#488271: Bug#488271: cryptsetup: use a loop to wait for the root device

David Härdeman david at hardeman.nu
Tue Jul 1 19:02:30 UTC 2008


On Tue, Jul 01, 2008 at 08:28:52PM +0200, Reinhard Tartler wrote:
>David Härdeman <david at hardeman.nu> writes:
>
>>>> initramfs-tools already has a rootdelay parameter which is executed
>>>> before the cryptsetup initramfs script. What is the advantage of
>>>> duplicating that functionality?
>>>
>>>the rootdelay parameter makes the initramfs loop until the root device
>>>appears. It does not help the cryptsetup hook in any way.
>>
>> Well, unless my memory serves me wrong, it does....with a rootdelay=5,
>> initramfs-tools will sleep 5 secs extra before cryptsetup gets a chance
>> of executing which might be enough for the USB device to show up.
>
>Looking at the code:
...
>I fear your memory indeed does serve you wrong :(

I think you missed /usr/share/initramfs-tools/scripts/init-premount/udev

>>> Do you see a better way solving the problem? 
>>
>> Yes, teach initramfs-tools to take a path as an argument to rootdelay
>> and make it wait until that path appears.
>
>If you can make the initramfs-tools maintainer refactor the code I cited
>above as a function and usable for cryptsetup, I'd agree with you.

I don't think a rootdelay in cryptsetup is very satisfactory. There are 
already two rootdelays, one before the cryptsetup script and one after 
it. Adding a third will help in a quite limited way:

a) Assume crypto-usb-stick takes 10 seconds to show up

b) root= will be set to something which udev won't find

c) rootdelay= is set

Situation A - rootdelay < 10 secs

	udev times out, cryptsetup fails

Situation B - rootdelay > 10 secs

	udev times out, cryptsetup works

d) With an additional rootdelay in cryptsetup

Situation C - rootdelay < 5 secs

	udev + cryptsetup times out, cryptsetup fails

Situation D - rootdelay > 5 secs, rootdelay < 10 secs

	udev times out, cryptsetup waits minimum time, cryptsetup works

Situation E - rootdelay > 10 secs

	udev times out, cryptsetup works


So you see..the patch saves a few seconds max...and the user still has 
to pick an optimal rootdelay time...

-- 
David Härdeman





More information about the Pkg-cryptsetup-devel mailing list