crumbly::liquid

Installing Arch Linux on Btrfs with FDE

2026-01-26

So my SSD kicked the can. What a bummer! And now that I bought a new SSD I have to install Linux all over again but since I didn't write down what I did for my previous install I have to do this entire thing all over again >:( But now I'm going to write everything (well most of it) down for my future self!

I want:

Bonuses:

Distro choice

I've used a couple distros in the past from Manjaro through Fedora to Arch and NixOS. In fact I'm writing this on NixOS right now and you can see my (terrible) NixOS config in my dotfiles repository!

The problem with NixOS (for me) is that some things don't work or aren't packaged and I don't have the knowledge to fix stuff quickly enough that it doesn't get in the way of school. I'll probably try to summarise my thoughts in another post somewhere down the line.

And since I've spent most of my time before NixOS on Arch based distros, and I feel confident that I can make most things work pretty easily on it so Arch Linux it is!

Other pieces

For booting I'm going to use systemd-boot which will let me select from installed UKIs (Unified Kernel Images). All of this will be signed for verification under Secure Boot.

Since I want full disk encryption I'm going to use LUKS2 as it's the thing that the Arch Linux Wiki recommends and I figure it's going to be the easiest. I'm also going to try and attach the LUKS encryption to TPM along with a PIN to prevent any Evil Maid attacks.

I know that this is very much overkill and way out of scope for my threat model but I just want to try this out for once and it doesn't hurt to be more secure.

Furthermore I want to try using Btrfs with subvolumes which gives me effectively separate partitions for root and home, built in compression, copy on write and easy partition resizing if needed but also lets me (hopefully) easily create snapshots for backup and easy rollback!

Let's start!

In reality most of these steps are following the Arch Linux Installation guide and the instructions for LUKS on partition with TPM2 and Secure Boot. For now this is a very crude set of instructions but I might try to expand on certain decisions in the future.

Pre-installation

This part very much follows the standard guide from Arch Wiki.

Partitioning the disks

I'm going to create a GUID Partition Table with two partitions:

  1. Boot partition
    • Mounted under /boot
    • Won't be encrypted but the integrity will be checked by Secure Boot so it's not a problem
  2. Main partition
    • Encrypted with LUKS2 and decrypted by our UKIs
    • Contains a Btrfs filesystem with subvolumes for root, home, swap, etc.

Let's create them then!

Formatting partitions

LUKS partition

Btrfs subvolume creation

To be honest I'm not sure this is the best layout and with some research and thinking I could probably come up with something better.

The idea behind this is that @ (the root subvolume) and @home are on separate subvolumes and are thus able to be snapshotted separately from each other. This allows me to roll back some changes to root while keeping everything in home which is usually what I would want.

Then there are volumes for logs, caches and swap as logs is something I would want to retain across rollbacks if possible and caches are something that would just take up space in caches. I'll probably try to do something simmiliar for the caches inside home such as ~/.cache.

Mounting Btrfs subvolumes

We mount all of the necessary partitions to where we want them inside /mnt. This will then allow us to run genfstab and easily obtain the correct /etc/fstab entries without having to create them manually.

Boot partition

Next time I could try to structure the boot partition such that configuration is inside root and only UKIs and the bootloader are outside in the boot partition.

If this setup is used with Secure Boot it's perhaps not so much of a problem.

Installation

Configure the system

Configure mkinitcpio

Follow this and then this.

I'm not sure if mkinitcpio is the easiest and perhaps using dracut would be better but this is what the Arch Wiki recommends so I'm going to try it first.

At the time of writing I did:

Setting the kernel commandline arguments is critical and we can't use the default options as LUKS + BTRFS subvolumes are a bit non standard.

rd.luks.name tells the kernel that we're using a LUKS encrypted partition. The kernel decrypts it and mounts it to /dev/mapper/cryptroot. We then tell the kernel where to find the root and with what flags to mount it (this is only temporary so we probably don't need to use all the flags that are specified inside /etc/fstab)

I recommend not setting the quiet parameter at least for the first couple of boots for debugging purposes.

Configure the boot loader

Using a bootloader will allow us to choose from multiple UKIs in case one fails for some reason.

I should probably create a better fallback UKI configuration than the one here but... that's a problem for future me!

To be continued...

Aaaand it doesn't boot with TPM2 enabled with an error that I traced to this issue. I don't want to deal with this right now so all I have is FDE without Secure Boot or TPM at the moment but it's something I will revesit later and update this article when I do so!

Setting up Secure Boot

Setting up the user environment

I pretty much just installed my dotfiles which needed only minor tweaks to get working!

Future work

I definitely want to get Secure Boot and TPM working and I also want to create better fallback and some automated backup system.

In the far future I want to create a configuration language that would basically be a better home-manager and then I would probably try to revisit this project with a blank sheet and try my hand at automating most of this.

Anyways if anyone is reading this I hope it helped at least a little bit. If you find any issues feel free to send me an email or some other type of message!

And... I use Arch btw. :)