Linux – Encrypted filesystems with swap partitions

linuxluksswap

A common error that happens with Ubuntu, though not Ubuntu in particular is the options of being able to encrypt the file system at installation time which creates an encrypted swap partition with crypto_LUKS and can create the said error at boot time with the message in the upper left corner of the screen;

Continue to wait, or Press S to skip mounting or M for manual recovery

to my understanding this is because the swap partition is not mounted as ready at this time in the boot process. So what if it could be placed before the initial boot process of the splash screen so it shows up early and ready without having to wait for it to be mounted? I would like to know if it be possible to have the encrypted swap partitions mount when the computer first turns on and goes to post-boot.

just for example of what I'm talking about here;

/dev/mapper/ubuntu--vg-swap_1 none swap sw 0 0
/dev/mapper/cryptswap1 none swap sw 0 0

to make those show up early in the boot process so it gives it time to decrypt it with the key file and mount them properly. Would that even be possible? Sorry if my question isn't too clear on what I mean.

Best Answer

So what if it could be placed before the initial boot process of the splash screen so it shows up early and ready without having to wait for it to be mounted?

It's probably already part of the early initramfs, since that's where you have to decide whether to boot normally or resume from disk suspend. If it is asking you to wait there, you are suffering from a configuration error of some kind.

Usually you have either somevg-swap OR cryptswapX, not both.

somevg-swap is for full disk encryption where swap simply is part of the completely encrypted LVM. This also works for suspend-to-disk scenarios.

cryptswapX is a passwordless solution for systems without LVM. On each boot a encrypted swap is created anew using a random one-time key. Suspend-to-disk is probably not possible with this method.

Related Question