makepkg: Usage, Options & Common CI Errors
makepkg builds an Arch Linux .pkg.tar.zst package from a PKGBUILD recipe.
makepkg is Arch’s package builder. The infamous CI snag is that it refuses to run as root - which is exactly what most container images give you - so the standard fix is a dedicated build user.
What it does
makepkg reads a PKGBUILD, downloads and verifies sources, runs the build() and package() functions in a fakeroot environment, and produces a compressed .pkg.tar.zst package installable with pacman.
Common usage
makepkg -s # build, install missing deps
makepkg -si # build then install
makepkg -f --noconfirm # force rebuild, no prompts
useradd -m build && sudo -u build makepkg -s # not as root
makepkg --printsrcinfo > .SRCINFOOptions
| Flag | What it does |
|---|---|
| -s / --syncdeps | Install missing dependencies via pacman |
| -i / --install | Install the built package |
| -f / --force | Overwrite an existing built package |
| --noconfirm | Skip interactive prompts (for CI) |
| --skippgpcheck | Skip source PGP signature verification |
Common errors in CI
"ERROR: Running makepkg as root is not allowed as it can cause permanent, catastrophic damage to your system." - create an unprivileged user and run via sudo -u build makepkg (root containers hit this immediately). "==> ERROR: ‘pacman’ failed to install missing dependencies" - run pacman -Sy first or pass -s with a synced db. Always add --noconfirm in CI or makepkg hangs on a prompt. "One or more PGP signatures could not be verified" - import the key or, only if trusted, --skippgpcheck.