How to sort mirrors by speed

pacman
mirror

(totte) #1

When downloading packages pacman uses the mirrors in the order they are in /etc/pacman.d/mirrorlist. To set a priority to mirrors, the mirrorlist file has to be sorted manually, or using a script. The core/pacman package provides a Bash script, /usr/bin/rankmirrors, which can be used to rank the mirrors according to their connection and opening speeds to take advantage of using the fastest local mirror.

First create a backup copy of the existing /etc/pacman.d/mirrorlist:

# cp /etc/pacman.d/mirrorlist /etc/pacman.d/mirrorlist.backup

Then rank the mirrors and overwrite the original file with the result:

# rankmirrors -n 4 /etc/pacman.d/mirrorlist.backup > /etc/pacman.d/mirrorlist

The operand -n 4 means that only the four (4) fastest mirrors are included in the output. Run rankmirrors -h for a list of all the available options. Also see the mirror status web page to get the status of all known, public, and active Chakra mirrors.


Here’s to our work done in 2018, and a great 2019!
Frameworks 5.54.0, Plasma 5.14.5, and Applications 18.12.1 by KDE are now available
KDE Frameworks 5.54.0,Plasma 5.14.5 和 Applications 18.12.1 现已可用
How to netinstall Chakra with arch-install-scripts
KDE Frameworks 5.53.0,Plasma 5.14.4 和 Applications 18.12.0;Qt 5.12.0,Linux 4.19.12(带有 CK 补丁集)和 systemd 239.303 现已可用
Frameworks 5.53.0, Plasma 5.14.4, and Applications 18.12.0 by KDE, and Qt 5.12.0, Linux 4.19.12 with the ck patchset, and systemd 239.303 are now available
我們的2018總結與2019展望
KDE Framework 5.55.0, Plasma 5.15.0 et Applications 18.12.2 sont maintenant disponibles
U.S. mirrors out of sync
Can't update packages to their latest versions, the mirror I use hasn't synchronized with the origin server
Can't update packages to their latest versions (the mirror I use hasn't synchronized with the origin server)
Can't update packages to their latest versions, the mirror I use hasn't synchronized with the origin server
7th gen Intel NUC wireless card (Intel® Wireless-AC 9462) is only supported on Linux 4.14+, when will a 4.14-based kernel be available?
Can't update firefox, and default cursor theme on it
2018,我们有所作为;2019,我们翘首以待。
KDE Frameworks 5.55.0、Plasma 5.15.0、Applications 18.12.2 现已可用
Frameworks 5.55.0, Plasma 5.15.0, and Applications 18.12.2 by KDE are now available
(tom) #2

this step isn’t necessary because our mirrors are not commented like in arch linux


(totte) #3

Duly noted, it was changed back in October 2015. I should probably look at the sources rather than my installation.


(Void) #4

There’s a catch. I was given a French mirror as the top one. Probably it has the lowest ping time, but the transfer there is capped at 100KB/s. Therefore the first update after installation has taken me many hours.
I’ve removed that one manually, and the rest of them work like a charm.


(Johann Schmiedehausen) #5

Two thinks I want to mention/ask:

first: is it right, the command @totte use, uses the given mirrors in the old list (now mirrorlist.backup) to rank them? Doesn’t the mirrorlist.pacnew provide the latest list of active servers, so it would be better to use this list?

And second I think it is needed to review the auto-generated list manually.
I stay in the far south of Germany, closely to both, the borders of France and Swiss. At top of the list I got a Italian mirror, than from Brazil, third one was France and last one was from Taiwan. I presume the Brasil as Taiwan mirrors are not the fastest ones…


(totte) #6

If you have any .pacnew file for any configuration, it is your responsiblity to review it and amend the actual configuration file as necessary.

The file /etc/pacman.d/mirrorlist will exist by default on any given Chakra installation.

The file /etc/pacman.d/mirrorlist.pacnew will only exist on a Chakra installation when pacman upgrades a package which includes a new configuration file created by the maintainer, differing from the currently installed file. pacman then saves a .pacnew file with the new configuration in it, and this is reflected in the output of pacman during an upgrade.

Any given mirror can fail for a wide variety of reasons - such as network outages, increased load, etc. - at any given moment. This is but a simple way of providing some metrics.