Sign in
Log inSign up

Change root into a LUKS partition via a live Linux

Niklas Zantner's photo
Niklas Zantner
·Jun 22, 2019

Arch Linux is my daily driver. And still I tend to fiddle around and break stuff, not on purpose, but that sometimes just happens. So it is nice to have a backup plan for general purpose errors, which prohibit your system from booting.

Plugin a live USB (I use Antergos) and run the live system

Open a shell in the live system to check the available disks and choose the one with the encrypted partition via the following command:

fdisk -l

Next decrypt the LUKS partition (here /dev/sda2) so you can mount it in the next step:

sudo cryptsetup luksOpen /dev/sda2 luks-partition

Then create a folder to mount the luks-partition in and mount it

sudo mkdir /mnt/arch
sudo mount /dev/mapper/luks-partition /mnt/arch

Change the current directory to /mnt/arch and use arch-chroot to change the root from your live system to your encrypted system on your actual hard drive:

cd /mnt/arch
arch-chroot

Now I have a bash session in my broken system and I can revert the changes I made which broke it, e.g. reinstalled a package or change a configuration back to a working version. Then I exit the session and reboot into my system.

That’s it!