1

For my Ubuntu 14.04 setup, I have 4 LUKS partitions that work as backing block devices form my BTRFS root partition. Using the default settings I could not get the 4 encrypted partitions unlocked at boot time, so I wrote a script that would do that for me.

The script sort of works, sometimes when I boot I have no issues, other times, it boots into the initramfs prompt. I think there are timing issues between unencrypting the LUKS partitions, then assembling the BTRFS partition and then mounting the root subvol, but I have no idea how to debug/test/fix this. Any ideas of what could I do to figure out what is the problem?

1

Use the "debug" kernel parameter, you will see more debug output at boot time, and initramfs will write a boot log to /run/initramfs/initramfs.debug.

Debugging the actual boot scripts is usually slow work. You need to take the initramfs, unpack it (gzip -d init*.gz then cpio -vid < init*), modify it (begin at /init), repack it, then boot with it. Add print statements where you want to check what is happening at a certain point. The problem with race conditions is that adding debug prints can change the timing, resulting in different behaviour. There is no easy solution to that, other than reading the code and understanding what it is doing. Having said that, the scripts are short and should be pretty easy to follow (/init is only around 300 lines of code).

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.