LinuxCommandLibrary
GitHubF-DroidGoogle Play Store

makechrootpkg

builds Arch Linux packages in a clean chroot environment

TLDR

Build the PKGBUILD in the current directory using a clean chroot
$ makechrootpkg -c -r [/var/lib/archbuild/extra-x86_64]
copy
Build without cleaning the chroot first
$ makechrootpkg -r [/var/lib/archbuild/extra-x86_64]
copy
Update the chroot before building
$ makechrootpkg -u -r [/var/lib/archbuild/extra-x86_64]
copy
Install a local package into the chroot before building
$ makechrootpkg -r [chroot] -I [package.pkg.tar.zst]
copy
Run namcap and checkpkg on the built package
$ makechrootpkg -c -n -C -r [chroot]
copy
Bind-mount a directory read-write into the chroot
$ makechrootpkg -d [/host/path] -r [chroot]
copy
Pass extra arguments to makepkg
$ makechrootpkg -c -r [chroot] -- --skippgpcheck
copy

SYNOPSIS

makechrootpkg [options] -r chroot [--] [makepkg-args]

DESCRIPTION

makechrootpkg builds a PKGBUILD inside a clean, isolated chroot environment. This ensures reproducible builds by insulating the build from the host system's installed packages and configuration, making it the standard method for building official Arch Linux packages.The chroot is managed as a root template plus per-user working copies that are cloned from it. Options such as -c and -u refresh the working copy, while -I and -d let you customize the build environment.

PARAMETERS

-r dir

Chroot directory to build in (required).
-c
Clean the chroot copy before building.
-u
Update the working copy (chroot) before building.
-I pkg
Install the given package file into the working copy before building.
-d dir[:dest]
Bind-mount a host directory into the chroot as read-write.
-D dir[:dest]
Bind-mount a host directory into the chroot as read-only.
-t dir[:opts]
Mount a tmpfs at the specified directory inside the chroot.
-l name
Name of the working copy directory (defaults to `$USER`).
-n
Run namcap quality checks on the built package.
-C
Run checkpkg validation against the previous package version.
-T
Build inside a temporary copy (discarded after the build).
-U user
Run makepkg as the specified user.
-x when
Launch an interactive shell inside the chroot: `never`, `always`, or `failure`.
-h
Display usage information.

SETUP

$ # Create the chroot template (once)
mkarchroot /var/lib/archbuild/extra-x86_64/root base-devel

# Build the package in the current directory
cd package-dir
makechrootpkg -c -r /var/lib/archbuild/extra-x86_64
copy

CAVEATS

Requires the devtools package. The chroot must be initialized with mkarchroot before first use. Root privileges are needed; slower than running makepkg directly but produces cleaner, more reproducible builds. Anything after -- is forwarded to makepkg.

HISTORY

makechrootpkg is part of Arch Linux devtools, maintained by Arch Linux developers and Trusted Users for building official packages in reproducible chroot environments.

SEE ALSO

Braincup
Open source brain training for math, memory and focus
Braincup mini-games
41 mini-games · Apache-2.0
No ads · No tracking
Play in browser
Download Braincup on the App StoreGet Braincup on Google PlayGet Braincup on F-Droid
276 stars
From the maker of Linux Command Library
Copied to clipboard
Braincup
Open source brain training for math, memory and focus. 41 mini-games, from mental arithmetic to Sudoku, N-Back and Solo Chess.
Apache-2.0 licensed · No ads · No tracking · No account
From the maker of Linux Command Library
Download Braincup on the App StoreGet Braincup on Google PlayGet Braincup on F-Droid