LLI Wiki — My Digital Knowledge Base

Chroot into an installed Linux system from a live USB

Mount an installed Linux system from a live USB, prepare the mounts, enter the chroot, fix the locale and reinstall GRUB.

A procedure to mount an installed Linux system from a live USB, to repair it in a chroot (GRUB, locale, broken updates).

1. Boot the live USB

Boot an Arch Linux or Manjaro live USB, then work as root.

2. Identify the disks and volumes

fdisk -l
sudo blkid
lsblk -f

3. Mount the installed system

Example with LVM:

mount /dev/arch-lvm/arch-root /mnt
mount /dev/arch-lvm/arch-home /mnt/home
mount /dev/sda2 /mnt/boot

With LUKS, the volume appears under /dev/mapper only after the encrypted container is opened (cryptsetup open <partition> <name>).

Example with Btrfs subvolumes (device names are examples):

mount -o subvol=@ /dev/mapper/cryptroot /mnt
mount -o subvol=@pkg /dev/mapper/cryptroot /mnt/var/cache/pacman/pkg
mount -o subvol=@log /dev/mapper/cryptroot /mnt/var/log
mount -o subvol=@snapshots /dev/mapper/cryptroot /mnt/.snapshots

If /boot is a separate partition, mount it on /mnt/boot. With UEFI, mount the EFI partition on /mnt/boot/efi.

4. Prepare the environment

mount -t proc proc /mnt/proc
mount -t sysfs sys /mnt/sys
mount -o bind /dev /mnt/dev
mount -o bind /run /mnt/run
mount -t devpts pts /mnt/dev/pts/
cp /etc/resolv.conf /mnt/etc/resolv.conf

Copying resolv.conf lets the repaired system resolve host names (needed for updates).

5. Enter the system

chroot /mnt /bin/bash

On Arch Linux, arch-chroot /mnt performs these mounts automatically.

6. Fix the locale

If tmux or another program shows invalid LC_ALL, LC_CTYPE or LANG:

locale -a
localedef -f UTF-8 -i en_US en_US.UTF-8

For an immediate workaround, export LC_ALL=C avoids the error for the current session.

7. Reinstall GRUB

With UEFI:

grub-install --target=x86_64-efi --efi-directory=/path/to/esp/mountpoint --removable

With BIOS, install on the whole disk (not on a partition): grub-install /dev/sdX.

Then regenerate the configuration:

grub-mkconfig -o /boot/grub/grub.cfg

8. Leave and reboot

exit
umount -R /mnt
cryptsetup close cryptroot    # only with LUKS
reboot

Remarks

Mastodon LLIMastodon SocialFosstodon