I am trying to boot an encrypted Ubuntu system without needing to have a custom initramfs for each disk I boot. I currently use Funtoo/Gentoo and have a generic initramfs in which I specify the UUID at boot time which lets me have the same image across all devices with only a modified kernel cmdline.

I believe I must edit /etc/crypttab and then rebuild the initramfs; however, if I do that, then I have a USB stick that only works with the system it was generated.

Are there some other hidden options that I'm not seeing?

I also tried this on the kernel cmdline: cryptopts=source=/dev/disk/by-uuid/ root=/dev//

However, that doesn't help.

1 Answer 1


If all the information that goes into /etc/crypttab that can vary between your target disks is supplied in the kernel command line, how about writing a script that reads the kernel command line from /proc/cmdline and edits /etc/crypttab for you?

Then you could place the script into initramfs - or rather, into /etc/initramfs-tools/scripts/<appropriate directory> so it gets picked up by update-initramfs whenever a new initramfs is created.

This way, you could have a custom generic initramfs that can accept any encrypted system disk.

  • I think that is the likely solution, I was hoping with Ubuntu, that would already be standard so I wouldn't need a custom solution - I'll give that a try, but am hoping that I'm missing some option that would simplify this solution.
    – Walter
    Nov 5, 2019 at 11:15

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .