Arch Linux: update mirrorlist

It’s a good idea to update the Arch Linux mirrorlist file (/etc/pacman.d/mirrorlist) from time to time. Mirrors change over time, and an outdated list can negatively impact the speed with which pacman can update the system.

There’s a nice tool that helps to do this job: reflector. Reflector is available in the Arch repos. It can sort mirrors by their speed as measured on the client, and can remove mirrors that are outdated. What you still need to do manually is to review the generated mirrorlist and remove any mirrors that you don’t trust.

In a nutshell:

  1. Install reflector:
    sudo pacman -Syu reflector
  2. Backup the old mirrorlist:
    sudo cp /etc/pacman.d/mirrorlist /etc/pacman.d/mirrorlist.old
  3. Generate a new mirrorlist file based on your preferences. For examples see the reflector example section. One concrete example: select all mirrors that support https and synced in the last 12 hours, sort them by their speed as measured on the client, and write them to the mirrorlist file:
    sudo reflector --age 12 --protocol https --sort rate --save /etc/pacman.d/mirrorlist

Leave a comment