Score:2

does there exist a concise guide installing Ubuntu 21.10 desktop with LVM and LUKS 2 full disk encryption, enabling encrypted hibernation?

kr flag

I've previously only used the graphical installer for Ubuntu with the simple automated partitioning scheme with disk encryption, however I would like to be able to have encrypted hibernation -> this requires manual partitioning with the LVM to encrypt the swap partition as far as I've understood. So that at minimum I would need initially most likely a /boot partition, and a second partition which is encrypted by LUKS format. Then, I need to LUKS open that second partition, and create physical volume, VG, and LVs on top of that. I need to have LVs for linux swap and root partition at minimum.

I've only used gparted and the graphical installer for making partitions in unencrypted virtual machines thus far. This makes it a bit confusing for a relative Ubuntu beginner to transition into using the full disk encryption with LVM partitioning (logical volume management)

I would like to first test things out on a virtual machine to see if this is doable in practice before attempting it maybe on my spare laptop.

My goals are as follows

  • use LVM and LUKS must be able to hibernate encrypted so needs the encrypted swap partition
  • must be full disk encryption as much as possible
  • I'm going to use latest version of Ubuntu 21.10 Desktop 64bit
  • should use LUKS 2
  • have partitions ideally for (I guess logical volumes)
  • /
  • /boot
  • /var
  • /tmp
  • swap 64GB (twice the RAM)
  • /home
  • SSD was 500GB I think (I will reinstall to that laptop), everything to be installed on one disk

My research so far. I've only been able to find scattered blog posts after two days of googling about how to actually do the terminal commands about installing the LUKS encryption for FDE with LVM. I found this one written Ubuntu guide which seems thorough with step-by-step instructions for an older version of Ubuntu.

However I'm not sure if this guide is still up-to-date can somebody verify that is it applicable to encrypted hibernation, and LUKS 2, and Ubuntu 21.10 and will in fact work? I also got stuck on that guide where I'm unable to progress with this part of the guide.

This has to be done before the installer reaches the Install Bootloader stage at the end of the installation process.

I got completely stuck on the part. The terminal command did not execute and there was seemingly a syntax error with the "; do sleep 1;" part of the command, though I'm pretty sure I wrote it out as described. I ran out of time during the installer progress to fix the issue so I was stuck on a bad install where the graphical installer actually failed and crashed at the end because of it. I could not copy paste those commands from the guide into the virtualmachine guest Ubuntu because during live CD installation the shared clipboard cannot be even used and Virtualbox Guest additions CD cannot be mounted during live CD installation of the Ubuntu os. I'm really pulling my hair out at this point.

Enable Encrypted GRUB

As soon as you have completed those forms switch to the Terminal to configure GRUB. These commands wait until the installer has created the GRUB directories and then adds a drop-in file telling GRUB to use an encrypted file-system. The command will not return to the shell prompt until the target directory has been created by the installer. In most cases that will have been done before this command is executed so it should instantly return:

while [ ! -d /target/etc/default/grub.d ]; do sleep 1; done; echo "GRUB_ENABLE_CRYPTODISK=y" > /target/etc/default/grub.d/local.cfg

This has to be done before the installer reaches the Install Bootloader stage at the end of the installation process.

https://help.ubuntu.com/community/Full_Disk_Encryption_Howto_2019

https://www.linux.com/training-tutorials/how-full-encrypt-your-linux-system-lvm-luks/

https://youtu.be/VC2eloJCZ8s?list=PLC5eRS3MXpp-TETPMx541VsnJrNhsCiax&t=2

https://youtu.be/etDKTIGVId0?list=PLC5eRS3MXpp-TETPMx541VsnJrNhsCiax&t=7

Nmath avatar
ng flag
You don't need a swap partition. The default installation uses a swap file, with or without choosing full disk encryption. If believing you need an encrypted swap partition is the only reason you think you can't use the guided installation, then you will be happy to know you can use the guided install without having to overthink this too much.
cn flag
Ray
Just a comment but if you claim to be a "relative Ubuntu beginner", you might want to avoid all that you're doing and "start small". Even if somehow you got the above working, when something goes wrong later on, you'll have a headache fixing it. Just a suggestion...
mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.