whatis chroot
chroot
Also known as: change root, chroot jail
A command that runs a process with a different directory treated as /, used for system rescue and as an early form of isolation.
What Is chroot in Linux?
chroot /mnt bash starts a shell that sees /mnt as the root of the filesystem. The classic use is repairing an unbootable system from a live USB: mount the broken install, bind-mount /dev, /proc, and /sys, chroot in, and reinstall the bootloader or fix packages.
chroot only changes the filesystem view. It is not a security boundary on its own; namespaces and containers provide real isolation.
Example
sudo mount /dev/sda2 /mnt
sudo arch-chroot /mnt Learn more about chroot
- Rescuing an Unbootable Linux System with chroot When Linux will not boot, a live USB plus chroot lets you enter the broken installation as if it were running: fix the bootloader, roll back a bad kernel, reset a password, and reinstall packages from inside.
- systemd-nspawn: Containers Without a Container Runtime How systemd-nspawn runs a full OS in a namespace with no daemon and no image registry, and where it fits between chroot and Docker.