← 返回命令列表

Linux command

arch-chroot 命令

文本

复制后可按需替换文件名、目录或参数。

常用示例

Example

arch-chroot [path/to/new_root]

Example

arch-chroot -u [user] [path/to/new_root]

Example

arch-chroot [path/to/new_root] [command] [arguments]

Example

arch-chroot [path/to/new_root] zsh

说明

arch-chroot is an enhanced chroot wrapper designed to simplify the Arch Linux installation and recovery process. Unlike plain chroot, it automatically mounts essential API filesystems (/proc, /sys, /dev, /dev/pts, and /run) before entering the chroot environment, and cleanly unmounts them upon exit. This makes it significantly easier to perform system administration tasks on a mounted root filesystem, such as installing packages, configuring bootloaders, or repairing a broken system from a live environment. It can also run a single command and exit, or start an interactive shell as a specified user.

参数

new_root
Path to the directory to use as the new root filesystem
-u, --userspec user
Specify the user to run the shell or command as
command
Optional command to run instead of the default shell (Bash)

FAQ

What is the arch-chroot command used for?

arch-chroot is an enhanced chroot wrapper designed to simplify the Arch Linux installation and recovery process. Unlike plain chroot, it automatically mounts essential API filesystems (/proc, /sys, /dev, /dev/pts, and /run) before entering the chroot environment, and cleanly unmounts them upon exit. This makes it significantly easier to perform system administration tasks on a mounted root filesystem, such as installing packages, configuring bootloaders, or repairing a broken system from a live environment. It can also run a single command and exit, or start an interactive shell as a specified user.

How do I run a basic arch-chroot example?

Run `arch-chroot [path/to/new_root]` in a terminal, then adjust file names, paths, flags, or remote targets for your system.

What does new_root do in arch-chroot?

Path to the directory to use as the new root filesystem