pacstrap - ArchWiki

Jump to content

# pacstrap

From ArchWiki

Related articles

- Linux Containers
- pacman
- systemd-nspawn

From the pacstrap(8):

  pacstrap is designed to create a new system installation from scratch.

pacstrap is mainly used during the installation of the system, and comes pre-installed within the Arch installation media. It is also used to bootstrap Linux containers.

## Installation

Install the arch-install-scripts package.

## Tips and tricks

### Creating a clean chroot

This article or section is a candidate for merging with DeveloperWiki:Building in a clean chroot#Classic way.

Notes: Same scope (Discuss in Talk:Pacstrap)

Currently, devtools only supports sudo. This can not be changed as devtools require the use of the complex functionality of sudo, which opendoas does not support. You can use pacstrap to create a chroot manually.

First, create the chroot directory:

    # mkdir /var/chroot

Then, install the base system and base-devel (meta package containing tools which are used by the makepkg utility):

    # pacstrap -K /var/chroot base base-devel

Note The `-K` flag initialises a new pacman keyring, instead of using the hosts keyring, for people who are using unofficial mirrors within their chroot and want to import their keys from the host can omit this flag.

If you have not mounted a partition to `/var/chroot`, you must bind the directory on itself to make it a mountpoint, therefore ensuring compatibility with arch-chroot.

    # mount --bind /var/chroot /var/chroot

Then you can enter the chroot, using arch-chroot:

    # arch-chroot /var/chroot

You can not build arch pages as root, makepkg does not permit the use of the root, due to security concerns. Create a build user:

    # useradd -m build

Note The `-m` flag is needed to ensure that useradd creates the home directory of the build user with the correct permissions.

You can then become the build user using the following command:

    # su -l build

Note The `-l` flag is used to change into the home directory of the user you are becoming, this prevents you from accidentally trying to read/write to the root home directory.

You can now build any AUR package you wish by cloning them into the chroot, or use the chroot for testing and debugging of arch packages.

Category:

- Installation process

Hidden category:

- Pages or sections flagged with Template:Merge

pacstrap
Add topic