-
-
Notifications
You must be signed in to change notification settings - Fork 1
Linux chroot Guide
Mattscreative edited this page Dec 5, 2025
·
2 revisions
Complete beginner-friendly guide to chroot on Linux, covering Arch Linux, CachyOS, and other distributions including changing root directory, system recovery, and isolated environments.
chroot changes root directory.
Uses:
- System recovery: Repair broken systems
- Isolation: Create isolated environments
- Testing: Test in different environments
- Security: Isolate processes
Warning: Requires root access and proper setup.
Basic usage:
# Change root directory
sudo chroot /path/to/newroot /bin/bash
# Changes root to new directory
# Runs /bin/bash in new rootBefore chroot:
# Mount required filesystems
sudo mount --bind /dev /path/to/newroot/dev
sudo mount --bind /proc /path/to/newroot/proc
sudo mount --bind /sys /path/to/newroot/sys
# Then chroot
sudo chroot /path/to/newrootRepair system:
# Boot from live USB
# Mount root partition
sudo mount /dev/sda1 /mnt
# Mount required filesystems
sudo mount --bind /dev /mnt/dev
sudo mount --bind /proc /mnt/proc
sudo mount --bind /sys /mnt/sys
# chroot into system
sudo chroot /mntIsolated root:
# Create chroot environment
sudo mkdir -p /chroot/ubuntu
# Copy system files
# Then chroot
sudo chroot /chroot/ubuntu /bin/bashCheck installation:
# chroot is part of coreutils
# Usually pre-installed
# Check chroot
which chrootThis guide covered chroot usage, system recovery, and isolated environments for Arch Linux, CachyOS, and other distributions.
- System Recovery - Recovery guide
- mount Guide - Mounting filesystems
- Virtualization - Virtual environments
-
chroot Documentation:
man chroot
This guide covers Arch Linux, CachyOS, and other Linux distributions. For distribution-specific details, refer to your distribution's documentation.