Pacman-mirrors
Views
Actions
Namespaces
Variants
Tools
Manjaro Pacman-Mirrors
A utility for generating and maintaining the systems mirrorlist.
Purpose
Manjaro uses pacman for system maintenance, updates and new installs.
For pacman to function, a list of servers, or more commonly known as mirrors, with Manjaro software packages is required.
As Manjaro has many mirrors all over the world it is feasible to use the mirrors closest to your location.
Use
First of all, a working internet connection is mandatory. From v4, Pacman-Mirrors will always check if network is online. It is doing so by querying https://manjaro.org.
The app is run by an ordinary user with superuser rights from the console and when no arguments are given it will display a usage description as if -h had been given.
$ sudo pacman-mirrors
Exactly how the app generates the mirrorlist is controlled by supplying arguments on the commandline.
Important After every change to your mirrorlist it is mandatory to run an update on your pacman database
$ sudo pacman -Sy
If you fail to do so, the issue/s which had you make change might not be solved.
Available arguments
-h, --help show this help message and exit
-g, --generate Generate mirrorlist
-m, --method {rank,random}
Generation method
-b, --branch {stable,testing,unstable}
Branch name
-c, --country COUNTRY
Comma separated list of countries,
from which mirrors will be used
--geoip Get current country using geolocation.
Ignored if '-c/--country' is supplied
-d, --mirror_dir PATH
Mirrors list path
-o, --output FILE Output file
-t, --timeout SECONDS
Maximum waiting time for server response
--no-update Don't generate mirrorlist if
'NoUpdate = True' in the configuration file
-i, --interactive Generate custom mirrorlist
-v, --version Print the pacman-mirrors version
-q, --quiet Quiet mode - less verbose output
-f, --fasttrack DIGIT
A quick mirrorlist. Overrides -cim --geoip
-l, --list List all available countries
--default Default mirror file is used
Defaults
PacmanMirrors has some reasonable defaults
- Ranking mirrors with the fastest mirrors on top - Using stable branch - Using all mirrors
The -g or --generate argument is only for running pacman-mirrors with all defaults. If you are using other arguments eg.-b unstable the generate argument is not needed.
Country
Instead of pacman-mirrors probing all mirrors in all countries it is possible to supply a list of countries from which to use the mirrors.
$ sudo pacman-mirrors --country Germany,France,Austria
If a supplied country does not offer a mirrorserver the app quits with an error explaining why.
$ sudo pacman-mirrors --country Antarctica usage: pacman-mirrors [-h] [-g] [-m {rank,random}] [-b {stable,testing,unstable}] [-c COUNTRY] [--geoip] [-d PATH] [-o FILE] [-t SECONDS] [--no-update] [-i] [-v] [-q] pacman-mirrors: error: Option '-c/--country' unknown country: 'Antarctica'. Available countries are: Africa, Australia, Austria, Belarus, Belgium, Brasil, Bulgaria, Canada, Chile, China, Colombia, Costa_Rica, Czech, Denmark, Ecuador, France, Germany, Greece, Indonesia, Ireland, Italy, Japan, Netherlands, Philippines, Poland, Portugal, Romania, Russia, Singapore, Sweden, Taiwan, Turkey, United_Kingdom, United_States, Vietnam
Another option for the mirrors closest to your location is --geoip
$ sudo pacman-mirrors --geoip --quiet :: Querying servers, this may take some time => Testing mirrors in France :: Writing mirror list :: Mirrorlist generated and saved to: /etc/pacman.d/mirrorlist
Branch
Situations could exist, in which you want a not yet released to stable software, which contains a desired improvement or bugfix. For such situations it is possible to make a temporary switch to testing or unstable branch
$ sudo pacman-mirrors --branch testing
Syncronize your pacman database with the new mirror/branch combination and install whatever software needed from that branch.
$ sudo pacman -Sy some-software-package-you-need
After installation switch back
$ sudo pacman-mirrors --branch stable
Syncronize
$ sudo pacman -Sy
In such a situation, where you have pulled software from another branch, you must be prepared for messages from pacman or pamac about newer packages on the system. These messages can safely be ignored and they dissappear when the installed package(s) reaches stable branch
Your personal mirrorlist
If you, for various reasons, have a preference for specific mirrors, it is possible to create a personal mirrorlist. This is done by supplying interactive argument.
$ sudo pacman-mirrors --interactive
Pacman-mirrors will process the available mirrors and present you with a list in which you will select your desired mirrors. The resulting list will be saved to the system and used each time you run pacman-mirrors.
If you want to reset the list to default run
$ sudo pacman-mirrors --country all
Fasttrack
If network is not available you will be so informed and you can rerun with -m random.
Questions
So, pacman-mirrors -f 2 takes the same time to create /etc/pacman.d/mirrorlist as pacman-mirrors -f 20?
No. pacman-mirrors -f 2 will approx. be 10x faster than pacman-mirrors -f 20 since only 2 mirrors are probed versus 20 mirrors.
So, pacman-mirrors -f [n] always ranks ALL mirrors by response time (the same as -g does) and additionally takes up-to-date mirrors and writes only n mirrors to the mirrorlist?
No. pacman-mirrors -f [n] ranks on a sorted list with known up-to-date mirrors. Thus it is only the first n mirrors from this list which are actually probed. If you have a list of 30 mirrors which are up-to-date and use -f 5 only the top 5 mirrors are probed and then sorted after response time.
To be aware of
The following arguments -c -i -m --geoip will not work in conjunction with -f.
The smaller number of mirrors you choose for your mirrorlist, the possibility of getting a not so responsive mirror increases, since only the first n in the list are tested, not all of them. A reasonable number would be between 5 and 10.
The force of this approach is, because of the status.json file on repo.manjaro.org, we know forehand if the mirror is up-to-date and thus only have to rank the top n mirrors from the list. The switch does not guarantee you get the n fastest mirrors only that they are responsive and up-to-date. Mirrors which have network errors or times out are not considered at all.
@excalibur1234: in this case, the name "fasttrack" actually makes sense, because the tracking process really is faster.
TL:DR
Default mirrorlist
sudo pacman-mirrors -g
List available countries
sudo pacman-mirrors -l
Mirrors for your country
sudo pacman-mirrors --geoip
Mirrors for preferred countries
sudo pacman-mirrors -c Germany,France,Austria
5 Mirrors up-to-date on all branches
sudo pacman-mirrors -f 5
Temporarily switch branch
sudo pacman-mirrors -b unstable sudo pacman -Syy