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?