“pacstrap” is a script included in the Arch Linux distribution that is used to install packages to a new root directory. This script is run during the initial installation process and is used to set up the base system by installing a minimal set of packages. The “pacstrap” script can also be run later to add additional packages to the system. The script takes as its argument the path to the root directory to which packages should be installed, as well as a list of packages to install. The packages specified will be downloaded and installed, along with any dependencies they have. This makes “pacstrap” a useful tool for installing a custom Arch Linux system, for example on a disk partition or in a virtual machine.
If you encounter the below error while running the command pacstrap:
pacstrap: command not found
you may try installing the below package as per your choice of distribution:
Distribution | Command |
---|---|
Debian | apt-get install arch-install-scripts |
Ubuntu | apt-get install arch-install-scripts |
Alpine | apk add arch-install-scripts |
Arch Linux | pacman -S arch-install-scripts |
Kali Linux | apt-get install arch-install-scripts |
Fedora | dnf install arch-install-scripts |
pacstrap Command Examples
1. Install the `base` package, Linux kernel and firmware for common hardware:
# pacstrap path/to/new/root base linux linux-firmware
2. Install the `base` package, Linux LTS kernel and `base-devel` build tools:
# pacstrap path/to/new/root base base-devel linux-lts
3. Install packages without copy the host’s mirrorlist to the target:
# pacstrap -M path/to/new/root packages
4. Use an alternate configuration file for Pacman:
# pacstrap -C path/to/pacman.conf path/to/new/root packages
5. Install packages using the package cache on the host instead of on the target:
# pacstrap -c path/to/new/root packages
6. Install packages without copy the host’s pacman keyring to the target:
# pacstrap -G path/to/new/root packages
7. Install packages in interactive mode (prompts for confirmation):
# pacstrap -i path/to/new/root packages
8. Install packages using package files:
# pacstrap -U path/to/new/root path/to/package1 path/to/package2