arch-chroot - Man Page
enhanced chroot command
Examples (TL;DR)
- Start an interactive shell (Bash, by default) in a new root directory:
arch-chroot path/to/new/root
- Specify the user (other than the current user) to run the shell as:
arch-chroot -u user path/to/new/root
- Run a custom command (instead of the default Bash) in the new root directory:
arch-chroot path/to/new/root command command_arguments
- Specify the shell, other than the default Bash (in this case, the
zsh
package should have been installed in the target system):arch-chroot path/to/new/root zsh
Synopsis
arch-chroot [options] chroot-dir [command] [arguments...]
Description
arch-chroot wraps the chroot(1) command while ensuring that important functionality is available, e.g. mounting /dev/, /proc and other API filesystems, or exposing resolv.conf(5) to the chroot.
If command is unspecified, arch-chroot will launch /bin/bash.
Note
The target chroot-dir should be a mountpoint. This ensures that tools such as pacman(8) or findmnt(8) have an accurate hierarchy of the mounted filesystems within the chroot. If your chroot target is not a mountpoint, you can bind mount the directory on itself to make it a mountpoint, i.e.:
mount --bind /your/chroot /your/chroot
Options
- -N
Run in unshare mode. This will use unshare(1) to create a new mount and user namespace, allowing regular users to create new system installations.
- -u <user>[:group]
Specify non-root user and optional group to use.
- -r
Do not change the resolv.conf within the chroot. This means that the resolver might not work in the chroot, which could be the required state.
- -h
Output syntax and command line options.