888888b. d8b 8888888b. 888 d8b 888 888 888 888 "88b Y8P 888 Y88b 888 Y8P 888 888 888 888 .88P 888 888 888 888 888 888 8888888K. 888 888 d88P 8888b. 88888b. 888 888888 888888 .d88b. 88888b. 888 "Y88b 888 8888888P" "88b 888 "88b 888 888 888 d88""88b 888 "88b 888 888 888 888 T88b .d888888 888 888 888 888 888 888 888 888 888 888 d88P 888 888 T88b 888 888 888 d88P 888 Y88b. Y88b. Y88..88P 888 888 8888888P" 888 888 T88b "Y888888 88888P" 888 "Y888 "Y888 "Y88P" 888 888
Nah, I'm not talking about bluetooth mirrors.
Mirrors are what powers all distros: they're a (de)centralized solution for downloading pre-compiled binaries and scripts for your operating system.
I like always having the most current version of packages, so I usually update my system several times a day. When, after a day, I tried updating and pacman reported my system being up to date, I was pretty weirded out.
Another day passed, and the system was still up to date. It was not a connection problem, I was connecting to my mirrors and they were reporting absolutely zero updates for my system.
At the third day of stagnation, I was sure something was up. I looked up the Mirror Status page on ArchLinux's website and saw that loads of mirrors were out of sync.
I had never touched my mirrorlist before, it was just generated by the archinstall script a few months ago; a lot of Arch-based distros by default ship tools to update your mirrorlist, but I honestly thought I'd never need that.
Pacman's mirrorlist is located in `/etc/pacman.d/mirrorlist`. You can filter out uncommented lines with this command:
grep -v "^#" /etc/pacman.d/mirrorlist
And check the actual status of your mirror(s) on the Mirror Status page.
This will overwrite your mirrorlist, so you're advised to make a backup before proceeding:
sudo cp /etc/pacman.d/mirrorlist /etc/pacman.d/mirrorlist.bak
I decided to use reflector to fix this problem.
I didn't want to have to deal with this again, so I enabled the provided systemd timer.
First, install it.
sudo pacman -S reflector
Then, edit `/etc/xdg/reflector/reflector.conf`. I only needed to edit the `--country` parameter and select countries next to the one where I reside; you can list available countries by running `reflector --list-countries`.
--save /etc/pacman.d/mirrorlist --protocol https --country Italy,Switzerland,France,Germany,Austria --latest 5 --sort age
Finally, start the service and check if it worked.
sudo systemctl start reflector.service cat /etc/pacman.d/mirrorlist
If everything went smoothly, enable reflector's timer so it runs weekly.
sudo systemctl enable reflector.timer
Now, by default pacman _does_ update its mirrorlist. It creates a file called `mirrorlist.pacnew` and it expects you to pick your favorite mirrors each time its generated. You can disable this (now unneeded) behavior by uncommenting and setting `NoExtract` in `/etc/pacman.conf`:
... NoExtract = /etc/pacman.d/mirrorlist # Misc options Color ILoveCandy ParallelDownloads = 3 ...
📰 Read something else?