Mind Dump, Tech And Life Blog
written by Ivan Alenko
published under license Attribution-ShareAlike 4.0 International (CC BY-SA 4.0)copy! share!
posted in category Systems Software / GNU Linux
posted at 14. Aug '21

Howto chroot to another Linux installation

Chroot (change root) allows to switch to another Linux installation and use commands from the second system.

This way you can install Grub to correct disk, repair Grub, repair or update system, …

The only contraint is to have the same architecture for both systems (e.g. amd64).

To be able to use partitions on disks or hardware you need to properly mount proc, sysfs and dev for chrooted system.

mount /dev/sdax /mnt/arch # mount the second system
cd /mnt/arch # or where you are preparing the chroot dir
mount /dev/sday boot/efi
mount --bind /dev dev
# not always necessary
mount --bind /dev/pts dev/pts
mount --bind /proc proc
mount --bind /sys sys
cp /etc/resolv.conf etc/
chroot .

or

mount -t proc proc proc/
mount -t sysfs sys sys/
mount -o bind /dev dev/

Add Comment