Skip to the content
pacman-master.com

The pacman mirrorlist

The mirrorlist at /etc/pacman.d/mirrorlist is the plain text file that tells pacman which servers to download packages and databases from, and the order of the lines is the order it tries them in.

/etc/pacman.d/mirrorlist

What it does. One Server line per mirror; pacman tries them from the top of the file downwards.

Watch out. After editing it, refresh with sudo pacman -Syyu so the databases are fetched again rather than assumed current.

How a line is read

An active line has this shape, and the placeholders in it are filled in by pacman rather than by you:

Server = <scheme>://<mirror>/$repo/os/$arch

A line of the mirrorlist file, not a command. $repo becomes the repository being fetched, such as core or extra, and $arch becomes the machine architecture.

  • Order is priority: the first working mirror in the file is the one used.
  • A line beginning with # is a comment, which is how mirrors are switched off without deleting them.
  • The scheme is whatever the mirror offers, and the file that ships with the system already contains real mirror lines — usually all commented out, so uncommenting one is the whole edit.

mirrorlist and pacman.conf are different files

FileDecidesContains
/etc/pacman.confWhich repositories exist and are enabledA [section] per repository, plus the general options
/etc/pacman.d/mirrorlistWhich servers those repositories are fetched fromOne Server line per mirror

A repository is enabled in pacman.conf; the mirrorlist only says where to get it. Which is why pacman -Sl <repository> lists a repository's packages regardless of which mirror served them.

After you change it, force a refresh

pacman decides whether to download a database again by comparing it with what the mirror advertises. Switch mirrors and the new one can hold a database that is older than the copy already on disk, which a plain -Sy will leave alone.

routinesudo pacman -Syyu

The doubled y downloads the databases again whether or not they look current, then upgrades.

Skipping that step is the usual cause of signature or file not found errors right after a mirror change: the database on disk describes package files that the new mirror does not have in that version.

Generating the file

Editing by hand is fine. There are also programs that rewrite the file for you — reflector is the one packaged for Arch — by filtering and sorting the published mirror list. It is a separate program, so its own help is the authority on what its options do:

not pacmanreflector --help

Not part of pacman; a separate package.

Anything that rewrites mirrorlist replaces the whole file. Keep a copy first if the current one is working, because a bad regenerated list makes later pacman commands fail at the download step.

Common questions

Where is the pacman mirrorlist?

At /etc/pacman.d/mirrorlist. It is a plain text file with one Server line per mirror, and the order of the lines is the order pacman tries them in.

Where can I find a list of pacman repositories?

In /etc/pacman.conf: each repository is a section in that file. To see what a repository contains, pacman -Sl <repository> lists its packages.

Why do I get errors after changing mirrors?

Because the databases on disk may still be the ones from the old mirror. Run sudo pacman -Syyu: the doubled y downloads the databases again instead of assuming the copies on disk are current.

How to check this page

Two commands on your own machine: pacman -<operation> --help lists the modifiers that operation accepts, and man pacman opens the pacman(8) manual page these descriptions are written from. Where the descriptions come from, and what this site is not, is set out on the about page.

This page was last edited on .