Chroot in Linux with Encrypted Btrfs

Prerequisites Link to heading

Go into root mode:

sudo -i

Look for your drive:

lsblk -f

# NAME        FSTYPE      LABEL
# nvme0n1
# ├─nvme0n1p1 vfat       EFI
# └─nvme0n1p2 crypto_LUKS

You should have:

  • nvme0n1p1 → EFI partition
  • nvme0n1p2 → root LUKS

Usage Link to heading

This is valid, complete, and copy-pastable on all Linux systems using LUKS and BTRFS, but you can skip mounting @home if you don’t need it.

cryptsetup luksOpen /dev/nvme0n1p2 cryptroot
mount -o subvol=@ /dev/mapper/cryptroot /mnt

mkdir -p /mnt/boot/efi
mount /dev/nvme0n1p1 /mnt/boot/efi

mkdir -p /mnt/home
mount -o subvol=@home /dev/mapper/cryptroot /mnt/home

mkdir -p /mnt/{dev,proc,sys,run}
mount --bind /dev /mnt/dev
mount --bind /proc /mnt/proc
mount --bind /sys /mnt/sys
mount --bind /run /mnt/run
mount -t efivarfs efivarfs /mnt/sys/firmware/efi/efivars

chroot /mnt /bin/bash

You are obligated by International Law to say I'm in once it’s done!

Verify Link to heading

mount | grep "on / type"
# /dev/mapper/cryptroot on / type btrfs (...)

Inside the chroot, your cryptroot will be on / instead of on /mnt.