pacstrap
Install base Arch Linux packages to a directory
TLDR
Install the base package, the Linux kernel and firmware for common hardware
Install the base package, the Linux LTS kernel and base-devel build tools
Install packages and copy the host's Pacman config to the target
Install packages without copying the host's mirrorlist to the target
Use an alternate configuration file for Pacman
Install packages using the package cache on the host instead of on the target
Initialize an empty pacman keyring in the target without copying it from the host
Install packages in interactive mode (prompts for confirmation)
SYNOPSIS
pacstrap [options] <root_directory> [<packages>...]
PARAMETERS
<root_directory>
The absolute path to the target directory where the new system will be installed (e.g., /mnt). This directory must be a valid, pre-mounted filesystem.
<packages>...
An optional space-separated list of packages to install into the root_directory. Common packages include base, linux, and linux-firmware. If omitted, it typically defaults to installing the base package group.
-c, --clean
Cleans the package cache after installation, removing downloaded package files.
-d, --nodeps
Skips dependency checks, forcing installation even if dependencies are not met. Use with caution.
-G, --nogpgcheck
Skips GPG package signature checks, potentially compromising security. Not recommended for general use.
-i, --noconfirm
Does not prompt for confirmation for any operations, automatically assuming 'yes' to all questions.
-M, --noextract
Downloads packages but does not extract or install them into the target system.
-N, --noprogressbar
Disables the display of the progress bar during downloads and installations.
-P, --print
Prints a list of packages that would be installed without actually performing the installation.
-U, --upgrade
Treats the operation as an upgrade for existing packages in the target system rather than a fresh install.
-v, --verbose
Shows more detailed information and debug messages during execution.
--sysroot <path>
Specifies an alternate sysroot path for installation, overriding the default behavior of using the first argument as the root directory.
--cachedir <dir>
Sets an alternate directory for the package cache, where downloaded packages are stored.
--config <file>
Uses an alternate configuration file for underlying pacman operations.
--ignore <pkg>
Ignores a specific package from being installed or upgraded. Can be specified multiple times.
--overwrite <glob>
Specifies a glob pattern to allow overwriting conflicting files during package installation.
--needed
Does not reinstall targets that are already up-to-date in the destination.
DESCRIPTION
pacstrap is a crucial utility primarily used during the installation of Arch Linux. It enables users to install a foundational system, typically comprising the base and base-devel package groups, into a newly mounted partition. The command effectively sets up the initial environment, automatically configuring pacman to install packages relative to the specified sysroot directory. This streamlines the bootstrapping of a functional Arch Linux system onto a disk, preparing it for further configuration within a chroot environment. pacstrap handles package installation, dependency resolution, and the initial setup of the package database within the target system, simplifying what would otherwise be a complex manual process.
CAVEATS
Requires Mounted Target: The <root_directory> must be a valid, pre-mounted filesystem (e.g., a partition) before running pacstrap.
Internet Connection: An active internet connection is typically required to download packages from repositories.
Root Privileges: pacstrap must be executed with root privileges.
Arch Linux Specific: This command is integral to the Arch Linux ecosystem and is not found on other Linux distributions.
Internal Dependency: It relies heavily on pacman's underlying functionalities.
TYPICAL USAGE
A common invocation for a fresh Arch Linux installation is pacstrap /mnt base linux linux-firmware, which installs the essential components (base system, Linux kernel, and firmware) onto the /mnt mount point.
POST-INSTALLATION STEPS
After pacstrap completes, it is standard practice to use arch-chroot /mnt to enter the newly installed system. This allows for further configuration, such as generating the fstab, setting the locale, configuring the network, and installing a boot loader.
HISTORY
pacstrap was introduced as a simpler and more robust method for bootstrapping an Arch Linux installation. Before its existence, users often had to manually mount the target partition, prepare directories, and then run pacman -r /mnt -S base or similar commands, a process prone to errors. pacstrap encapsulates these complex steps, providing a dedicated tool that correctly handles the sysroot and chroot environments for pacman. This has significantly simplified the initial system setup phase, making it a cornerstone of the official Arch Linux installation guide and improving user experience.
SEE ALSO
pacman(8), arch-chroot(8), mkfs(8), mount(8)