Fix Go AUR rebuilds failing on 'rm: cannot remove ... Permission denied'
Issue #13334 (open) has the exact output, the GOMODCACHE cause and the chmod plus rm workaround. Manjaro pamac issue 1114 shows the same read-only Go cache failure with go-yq. The fix is correct. The Omarchy claim is version-dependent and wrong for the current stable release. The reporter ran edge (4.0.0.r2304), and the quattro branch's omarchy-update-aur-pkgs ends the yay call with || exit 1. The installed 4.0.4-1 script on this machine (upstream latest is v4.0.4) has no || exit 1 and no set -e, and its last command is echo. On stable 4.0.4 a yay failure is therefore printed and the update carries on to its later steps without the 'Something went wrong' message. Symptom and cause are corrected to say which channel ends the update. Not reproduced. Second audit confirmed the corrected text: Second pass on the record as corrected on 2026-10-04, whose channel distinction still holds. Issue #13334 (open) has the exact output, the GOMODCACHE=${srcdir}/go-mod cause, the -modcacherw remedy and the chmod plus rm workaround, on edge 4.0.0.r2304. Confirmed locally: the 4.0.4-1 omarchy-update-aur-pkgs has no || exit 1 and ends with echo, and omarchy-update runs under set -e with an ERR trap that prints 'Something went wrong during the update!', so on stable a yay failure does not trip it. The quattro copy fetched today ends the yay call with || exit 1, so on edge it does. Manjaro pamac issue 1114 shows the same read-only Go module cache failure with go-yq. yay's build directory ~/.cache/yay/<pkg> holding makepkg's src/ matches the reporter's path. The rm -rf is scoped to a user cache directory. Not reproduced.
Symptom
Updating a Go program from the AUR fails before it even compiles, with thousands of lines like:
==> Removing existing $srcdir/ directory...
rm: cannot remove '/home/user/.cache/yay/hyprmoncfg/src/go-mod/github.com/!make!now!just/heredoc@v1.0.0/LICENSE': Permission denied
==> ERROR: An unknown error has occurred. Exiting...
-> error making: hyprmoncfg-signal: user defined signal 1
-> Failed to install the following packages. Manual intervention is required:
On Omarchy's edge channel, whose AUR step exits non-zero when yay fails, omarchy update then ends with Something went wrong during the update! even though the system packages and migrations already finished. On stable 4.0.4 the same yay error is printed in the middle of the run and the update carries on to its remaining steps.
Cause
Go makes every directory and file in its module cache read-only on purpose. A PKGBUILD that points the cache inside the build tree (for example GOMODCACHE="${srcdir}/go-mod") without passing -modcacherw to go build leaves a read-only tree behind in the AUR helper's build directory. The first build works. The next build fails because makepkg starts by deleting the old $srcdir, and rm running as the user cannot delete the contents of read-only directories. yay --cleanafter, which Omarchy's AUR update step passes, does not remove it either. How the failure surfaces in omarchy update depends on the version. On the quattro branch (the edge channel) omarchy-update-aur-pkgs runs yay ... || exit 1, so one broken AUR package marks the whole update as failed. The stable 4.0.4 script has no || exit 1 and ends on an echo, so the step returns success and the update continues.
Fix
Make the old tree writable and delete it, then rerun the update. Replace hyprmoncfg with the failing package's directory:
chmod -R u+w ~/.cache/yay/hyprmoncfg/src
rm -rf ~/.cache/yay/hyprmoncfg/src
paru keeps its build trees in ~/.cache/paru/clone/<package>/ instead. A build run by hand with makepkg keeps it in the PKGBUILD's own src/.
**Omarchy 4:** omarchy update. **Elsewhere:** yay -Sua.
The real fix belongs in the PKGBUILD: build with go build -modcacherw ... or set export GOFLAGS="-modcacherw" in build(). Leave a comment on the package's AUR page so the maintainer adds it. It recurs on every update until then.
Verify
ls ~/.cache/yay/<package>/src no longer exists before the build, and the AUR update completes with the package at its new version in pacman -Q <package>.