---
title: 'Chroot linux (with or without btrfs subvolumes)'
url: 'https://discocat.me/blog/chroot-archlinux-with-or-without-btrfs-subvolumes'
markdown: 'https://discocat.me/blog/chroot-archlinux-with-or-without-btrfs-subvolumes.md'
date: '2025-07-31'
description: "On arch and other distributions, for many reasons, you might need to repair stuff that went wrong after an update, if you rebooted before fixing the stuff that broke. Repairing the bootloader, reinstalling a mandatory part of the system, it's all doable without reinstalling. First, boot a live USB …"
---

On arch and other distributions, for many reasons, you might need to repair stuff that went wrong after an update, if you rebooted before fixing the stuff that broke.

Repairing the bootloader, reinstalling a mandatory part of the system, it's all doable without reinstalling.

## First, boot a live USB of any linux distribution

You kept the usb key you used for the install, great ! Otherwise, there are many guides online to prepare a USB key as a live USB.

## Boot on it, prepare the folders, mount the partitions

We'll prepare everything in a folder name "system" inside of /mnt

```
sudo mkdir /mnt/system
sudo mkdir /mnt/system/boot
```

Then you use `blkid` to spot partitions.

### No subvolumes (no btrfs/lvm)

Then, we'll mount our boot and root partitions :

```
sudo mount /dev/<the partition you spotted for root> /mnt/system
sudo mount /dev/<the boot partition> /mnt/system/boot
```

### Btrfs subvolumes

This is a bit more complex. For me, the root subvolume is called @.

`sudo mount /dev/<the partition where your btrfs subvolumes are> /mnt/system -o subvol=@`

If you want to mount various other subvolumes, the command is similar, for example if your home subvolume is named @home :

`sudo mount /dev/<the partition where your btrfs subvolumes are> /mnt/system/home -o subvol=@home`

Or, on arch, you have a @pkg subvolume for the pacman package cache :

`sudo mount /dev/<the partition where your btrfs subvolumes are> /mnt/system/var/cache/pacman/pkg -o subvol=@pkg`

Finally, mount the boot partition :

`sudo mount /dev/<the boot partition> /mnt/system/boot`

### LVM

I don't personally have much experience with lvm, but if the live USB session has the lvm tools, it should be easy :

`lvm vgscan -v`

That command will detect the lvm volume groups. Then you activate the right one :

`vgchange -a y "<volume group name>"`

Once activated you list the volumes inside that volume group :

`lvm lvs --all`

You can now do this :

`mount /dev/<Volume group name>/<root volume name> /mnt/system/`

Like with btrfs, if you have various volumes to mount from that lvm group, do so.

Finally, mount the boot partition :

`sudo mount /dev/<the boot partition> /mnt/system/boot`

# Finally, you chroot

`sudo chroot /mnt/system`

And voilà, you're in your system.

You can now reinstall missing packages or broken dependencies, repair your bootloader, get your data back, ...

---

## Navigation

- Parent: [Blog](https://discocat.me/blog.md)
- Previous: [Unlocking gnome keyring for sure with Noctalia-greeter](https://discocat.me/blog/unlocking-gnome-keyring-for-sure-with-noctalia-greeter.md)
- Next: [Screen sharing with sway](https://discocat.me/blog/screen-sharing-with-sway.md)
