The package cache that made pacman give up
Every Arch machine in the house downloads its packages through a caching proxy on the NAS (nginx), so each package comes down from the internet once and every other machine gets it locally. It mostly works without anyone thinking about it, which is the point. Most of the problems so far were configuration details, and one of them was a bit more interesting.
That one came on a large update. My desktop downloaded a 1.8 GB upgrade through the cache, which saturated the internet connection. Pacman gives up on a mirror after 10 seconds without receiving any bytes, and then retries. Each retry asked the cache for a file that the first request was still fetching, and nginx’s proxy_cache_lock made each retry wait, without sending anything, for up to 15 minutes for that first fetch to finish. So pacman kept timing out, and eventually gave up on the cache altogether and moved on to the next mirror on its list. The cache itself was fine the whole time. Setting proxy_cache_lock_timeout to five seconds means a waiting request goes upstream on its own instead of sitting silent.
The configuration details, briefly. nginx only verifies one level of an upstream certificate chain by default (proxy_ssl_verify_depth 1), which fails a perfectly normal certificate with “unable to get local issuer certificate”. Setting it to 3 fixes it. The upstream is a variable with a resolver, so the CDN’s name is looked up again over time, not once at startup. And 404 errors for old package versions turned out to mean the client’s package database was out of date; installing anything on a host with a stale database is a partial upgrade, which Arch doesn’t support anyway, so the answer is a full upgrade first.
A last one from the same box, about process. The script that refreshes the netboot files failed with a 404 from GitHub. It was asking for a repository under a slightly wrong name. That typo had come in with an improvement made directly on the NAS, and the improvement had never been copied back to the project’s version of the script. The fix was correcting both copies and syncing them, and the rule since then is to edit the project’s copy and install it, never edit only on the host.
The clock on the NAS also turned out to be about three minutes slow, with NTP switched off. That one only showed up because backup timestamps from different machines didn’t agree.