Skip to content
Latchkey

pacman -S --noconfirm: Packages on Arch Linux

pacman -S --noconfirm installs packages on Arch Linux without asking for confirmation.

Arch CI images use pacman. Because Arch is rolling-release, you usually sync the database first, and --noconfirm keeps the install unattended.

What it does

pacman -S synchronizes and installs the named packages from the repositories. --noconfirm answers all prompts with the default, and --needed skips reinstalling packages already at the target version. -y refreshes the package database.

Common usage

Terminal
pacman -Sy --noconfirm archlinux-keyring   # refresh keyring first
pacman -S --noconfirm --needed git curl ca-certificates
# clean the package cache to shrink images
pacman -Scc --noconfirm

Options

FlagWhat it does
-S <pkg>Sync and install a package
--noconfirmDo not prompt for confirmation
--neededSkip packages already up to date
-yRefresh the package database
-yyForce a full database refresh
-SccRemove all cached packages and databases

In CI

On Arch containers the signing keyring can be stale; run pacman -Sy --noconfirm archlinux-keyring before installing to avoid signature errors. Do not run a bare pacman -Sy without following it with an install, since a partial upgrade can break the system.

Common errors in CI

"error: target not found: <pkg>" means the name is wrong or the database is stale; refresh with -Sy. "error: <pkg>: signature from ... is unknown trust" or "invalid or corrupted package (PGP signature)" means the keyring is outdated; update archlinux-keyring. "failed to synchronize all databases ... unable to lock database" means /var/lib/pacman/db.lck exists from a prior run; remove it.

Related guides

Run this faster and cheaper on Latchkey managed runners. Start free →