Reclaim a disk filled by the pacman package cache
Generic Arch content checked against the raw Arch wiki Pacman page (Cleaning the package cache) and man 8 paccache from pacman-contrib 1.13.1 on this machine: the default keep of 3, -rk1, -ruk0, the weekly paccache.timer and PACCACHE_ARGS in /etc/conf.d/pacman-contrib all hold, and the timer is present and disabled here. The two error strings were confirmed in pacman's lib/libalpm/diskspace.c and error.c. yay 13.0.1 on this machine reports buildDir: /home/techluddite/.cache/yay via yay -Pg and its man page says -Sc cleans the AUR cache and untracked files, so the yay advice holds. Wrong for Omarchy 4: the cause says nothing prunes the cache automatically, but /usr/share/omarchy/bin/omarchy-update-pkg-prune runs sudo paccache -rk2 at the start of every omarchy update (commit fd23ca02, 2026-08-12, PR #6734, shipped in 4.0.2 here), pacman-contrib is a hard dependency of the omarchy package so pacman -S --needed pacman-contrib is a no-op, and omarchy-update-aur-pkgs runs yay with --cleanafter. Also missed: /usr/share/omarchy/bin/omarchy-update-requires-free-space refuses to run the update with under 10 GiB free on / and prints You need at least 10 GiB free to safely update Omarchy., and that check runs before the prune, so a full disk blocks the update that would have pruned it. The verify step's sudo pacman -Syu is aborted by the ALPM update guard on Omarchy 4. Plain Arch defect: pacman -Qii pacman-contrib shows Backup Files: None and the PKGBUILD has no backup array, so /etc/conf.d/pacman-contrib is replaced on the next pacman-contrib upgrade and a -k2 written there is lost. On this machine and in the stock install layout /var/cache/pacman/pkg is its own btrfs subvolume (@pkg, confirmed with findmnt and this repo's tools/make-test-vm.sh), so snapper snapshots of / do not pin deleted cache files and paccache frees space immediately. Not exercised: I ran no paccache, did not run the timer, and did not retrieve the ISO configurator to confirm @pkg from upstream.
pacman -Scc empties the cache completely, including the currently installed versions. After that you cannot downgrade or reinstall anything offline, every recovery needs a working network and mirror. Prefer paccache -r. On Omarchy 4 the cache is the only offline downgrade path after a snapper rollback, and omarchy update already keeps 2 versions, so paccache -rk1 leaves you with only what is installed. OMARCHY_UPDATE_FORCE=1 skips the 10 GiB check but does not make the update fit, and a pacman transaction that dies mid-way for lack of space can leave the system half upgraded.
Symptom
df -h shows / nearly full and sudo du -sh /var/cache/pacman/pkg reports tens of gigabytes. On Omarchy 4 the first sign is usually omarchy update stopping at once with:
You need at least 10 GiB free to safely update Omarchy.
On plain Arch, or when bypassing that check, pacman itself refuses:
error: Partition /var too full: 1234567 blocks needed, 1000 blocks free
error: failed to commit transaction (not enough free disk space)
Cause
pacman keeps every package it downloads in /var/cache/pacman/pkg/ and never prunes it on its own. On a rolling release with frequent kernel, browser and Electron updates that grows without bound. AUR helper build directories (~/.cache/yay for yay 13, ~/.cache/paru) add to it. Omarchy 4 is different: omarchy update runs paccache -rk2 before every update (omarchy-update-pkg-prune) and cleans yay's untracked build files with --cleanafter, so the cache only runs away on a machine that has not updated for a long time, or when the disk fills for another reason. It then bites twice, because omarchy update refuses to start with less than 10 GiB free on / and that check runs before the prune step. On a stock Omarchy 4 install /var/cache/pacman/pkg is its own btrfs subvolume (@pkg), so snapper snapshots of / do not hold on to deleted cache files.
Fix
paccache comes from pacman-contrib. Omarchy 4 depends on it, on plain Arch install it (-S without -u is not blocked by the Omarchy update guard):
sudo pacman -S --needed pacman-contrib
Keep the last 3 versions of each package (default, still allows downgrading):
sudo paccache -r
More aggressive: keep 1 version, and drop every cached version of packages no longer installed:
sudo paccache -rk1
sudo paccache -ruk0
Omarchy 4: once enough is free, run the update, which prunes to 2 versions itself each time:
omarchy update
Automate it weekly (plain Arch, or an Omarchy machine that is rarely updated):
sudo systemctl enable --now paccache.timer
To change the retention the timer uses, do not edit /etc/conf.d/pacman-contrib: it is not a pacman backup file, so the next pacman-contrib upgrade overwrites it. Override the unit instead:
sudo systemctl edit paccache.service
[Service]
ExecStart=
ExecStart=/usr/bin/paccache -rk2
Clear AUR helper build caches too (yay 13 builds in ~/.cache/yay):
yay -Sc # plain Arch with paru: paru -Sc
rm -rf ~/.cache/yay/*
Check the result (sudo, because pacman 7 leaves alpm-owned download directories du cannot read as your user):
sudo du -sh /var/cache/pacman/pkg
du -sh ~/.cache/yay
df -h /
Verify
du -sh /var/cache/pacman/pkg drops substantially and df -h / shows free space. sudo pacman -Syu no longer reports insufficient disk space.
Sources
- https://wiki.archlinux.org/title/Pacman
- https://wiki.archlinux.org/title/System_maintenance
- https://man.archlinux.org/man/pacman.8
- https://gitlab.archlinux.org/pacman/pacman/-/raw/master/lib/libalpm/diskspace.c
- https://gitlab.archlinux.org/pacman/pacman/-/raw/master/lib/libalpm/error.c
- https://gitlab.archlinux.org/archlinux/packaging/packages/pacman-contrib/-/raw/main/PKGBUILD
- https://archlinux.org/packages/extra/x86_64/pacman-contrib/
- https://github.com/basecamp/omarchy/blob/quattro/bin/omarchy-update-pkg-prune
- https://github.com/basecamp/omarchy/blob/quattro/bin/omarchy-update
- https://github.com/basecamp/omarchy/blob/quattro/test/shell.d/update-pkg-prune-test.sh