OPINIONATED OMARCHY
TROUBLESHOOTING CORPUS
790
RECORDS
790
AUDITED
0
UNCHECKED
2388
SOURCES
LIVE
pacman-aur medium common DISPUTE

Clear corrupted packages and .part files from the pacman cache

archomarchyendeavouroscachyosmanjarodesktoplaptop
CORRECTED An auditor found the fix wrong or incomplete and rewrote it.
AUDIT NOTE

Checked on this Omarchy 4 workstation (pacman 7.1.0, /etc/pacman.conf identical to /usr/share/omarchy/default/pacman/pacman-stable.conf, DownloadUser = alpm) and against pacman's own source (dload.c, util.c, NEWS from gitlab.archlinux.org), the Arch wiki Pacman page, basecamp/omarchy issues 6576 and 4197, and the installed /usr/share/omarchy/bin/omarchy-refresh-pacman, which is byte-identical to the quattro branch copy. What held: the wiki still gives find /var/cache/pacman/pkg/ -iname "*.part" -delete, not pacman -Scc, for this error. On pacman 7 the download runs in a download-XXXXXX/ directory pacman creates inside the cache and chowns to alpm, and finalize_download_locations moves any .part back into /var/cache/pacman/pkg/ (chowned to root) so the next run can resume, so .part files still land where the record says. /var/cache/pacman/pkg here is root:root 0755 with no .part files, and downloads work at that ownership, so the cache does not need to be alpm-owned, only traversable. Cause (2) is confirmed by issue 6576 and by the comment at lines 439 to 448 of the installed omarchy-upgrade-to-quattro, which now runs -Syy for exactly that reason. What was wrong: sudo pacman -Su, pacman -Syyu and pacman -Syu in the fix and verify are refused on Omarchy 4 by /usr/share/libalpm/hooks/00-omarchy-update-guard.hook (aborts any pacman command line with both -S and -u unless OMARCHY_UPDATE_PACMAN=1 or OMARCHY_ALLOW_DIRECT_PACMAN=1 is set), while a bare pacman -Syy passes. The record called omarchy-refresh-pacman the equivalent of the whole fix, but the installed script only copies the channel's pacman.conf and mirrorlist over /etc (backups at .bak), runs the pre-refresh-pacman hook and then pacman -Syyuu --noconfirm. It never touches the cache, --noconfirm makes a corrupted cached file abort instead of prompting, and -uu can downgrade. Issue 4197 is an Omarchy 3.3.3 (PGP signature) failure with unknown trust, a keyring problem, and supports only dhh's rm -rf /var/cache/pacman/pkg/* and omarchy-refresh-pacman advice, not the checksum loop. The cited raw URL for omarchy-refresh-pacman is on master (Omarchy 3) and differs from the installed script. Not exercised: no download was interrupted or database corrupted here, and the --noconfirm abort wording comes from issue 6576's log rather than a reproduction.

The cause above was rewritten on 2026-09-07 to match this note; the fix was corrected by the audit itself.
RISK

Emptying /var/cache/pacman/pkg removes your only offline copies of previously installed package versions, so you lose the ability to downgrade without re-downloading from the Arch Linux Archive. On Omarchy 4, omarchy-refresh-pacman overwrites /etc/pacman.conf and /etc/pacman.d/mirrorlist with Omarchy's defaults (backups at .bak) and runs pacman -Syyuu, which will also downgrade packages to whatever the Omarchy mirrors carry.

Symptom


:: File /var/cache/pacman/pkg/foo-1.2-1-x86_64.pkg.tar.zst is corrupted (invalid or corrupted package (checksum)).
Do you want to delete it? [Y/n]

Answering Y and retrying just downloads the same broken file again, in an endless loop.

On Omarchy 4 the question is usually not asked, because omarchy update and omarchy-refresh-pacman run pacman with --noconfirm. The transaction aborts instead:


:: File /var/cache/pacman/pkg/foo-1.2-1-x86_64.pkg.tar.zst is corrupted (invalid or corrupted package (checksum)).
error: failed to commit transaction (invalid or corrupted package (checksum))
Errors occurred, no packages were upgraded.

Cause

Two distinct causes. (1) Partially downloaded .part files left in the cache by an interrupted download or a custom XferCommand. On pacman 7 with DownloadUser = alpm, which Omarchy 4 ships in /etc/pacman.conf, pacman downloads into a download-XXXXXX/ directory it creates inside /var/cache/pacman/pkg/ and chowns to the alpm user, then moves any finished file or leftover .part back into /var/cache/pacman/pkg/ so the next run can resume. The cache directory itself stays root:root 0755 and must stay traversable by alpm: a cache directory tightened to 0700 fails with a permission error rather than this checksum error. (2) The local sync database holds a checksum for a package that the server has since rebuilt under the same name and version. pacman -Sy keeps a database it believes is current, so the stale checksum keeps rejecting the correct file, and deleting the cached copy changes nothing because the stale data is in the database. Omarchy hit exactly this during the Omarchy 3 to 4 upgrade: the quattro package server rebuilt some omarchy-* packages under the same name and version as the legacy repo, and omarchy-upgrade-to-quattro now runs pacman -Syy for that reason. A third variant reads (PGP signature) instead of (checksum), often with signature from ... is unknown trust above it. That is a keyring problem, not a cache problem: on Omarchy 4 omarchy update refreshes archlinux-keyring and omarchy-keyring before upgrading, and on plain Arch upgrade archlinux-keyring first (Arch wiki, Pacman/Package signing).

Fix

Delete the partial and the rejected file first, then force a genuine database re-download (two y, not one). Deleting only the cached package is not enough for cause (2), because the stale checksum is in the database:


sudo find /var/cache/pacman/pkg/ -iname '*.part' -delete
sudo rm -f /var/cache/pacman/pkg/foo-*.pkg.tar.zst*
sudo pacman -Syy

Then finish the upgrade.

**Plain Arch:**


sudo pacman -Su

**Omarchy 4:** pacman -Syy on its own is allowed, but pacman -Su and pacman -Syyu are refused by the update guard hook with Woah partner.... Use the supported path, which runs pacman -Syu with the guard's own variable set:


omarchy update

or bypass the guard for one transaction:


sudo env OMARCHY_ALLOW_DIRECT_PACMAN=1 pacman -Syyu

If it still loops, empty the cache and retry. This also removes any stale download-XXXXXX/ directory a killed pacman 7 left behind:


sudo rm -rf /var/cache/pacman/pkg/*
sudo pacman -Syy

then sudo pacman -Su on plain Arch, or omarchy update (or the bypass above) on Omarchy 4.

On **Omarchy 4**, omarchy-refresh-pacman covers the database half only. It copies Omarchy's pacman.conf and mirrorlist for the channel over /etc/pacman.conf and /etc/pacman.d/mirrorlist (backups at /etc/pacman.conf.bak and /etc/pacman.d/mirrorlist.bak), runs the pre-refresh-pacman hook, then pacman -Syyuu --noconfirm. It does not touch the cache, so delete the bad file before running it, and expect any repos or IgnorePkg lines you added to pacman.conf to be gone afterwards:


omarchy-refresh-pacman stable

To confirm nothing is pending afterwards, use checkupdates (installed on Omarchy with pacman-contrib, prints nothing when the system is current) rather than sudo pacman -Syu, which the guard refuses.

Verify

The package downloads and installs. sudo pacman -Syu reports "there is nothing to do" or completes cleanly.

Sources

corrupted-package-checksum-part-files