Manjaro Difference between revisions of "Pacman-mirrors"

Difference between revisions of "Pacman-mirrors"

From Manjaro
imported>Fhdk
imported>Fhdk
Line 77: Line 77:
<div class="mw-collapsible-content">
<div class="mw-collapsible-content">
<pre>
<pre>
 
~ >>> pacman-mirrors 
optional arguments:
Version 4.4.0
  -h, --help            show this help message and exit
USAGE:
pacman-mirrors [-h] [-f NUMBER] [-i [-d]] [-m METHOD]
[-c COUNTRY [COUNTRY...]] [--geoip] [-l]
[-b BRANCH | -G | -S/-B BRANCH] [-a] [-p PREFIX]
[-P PROTO [PROTO...]] [-R] [-U URL]
[-q] [-t SECONDS] [-v] [-n]


METHODS:
METHODS:
  -g, --generate        Generate mirrorlist with defaults
   -f, --fasttrack NUMBER
   -f, --fasttrack NUMBER
                         Generate mirrorlist with a number of up-to-date
                         Generate mirrorlist with a number of up-to-date
                         mirrors. Ignores: --country --interactive --method
                         mirrors. Ignores:
                        --geoip
   -i, --interactive    Generate custom mirrorlist
   -i, --interactive    Generate custom mirrorlist
   -d, --default        Interactive: Load default mirror file
   -d, --default        Interactive: Load default mirror file
Line 104: Line 107:
                         Branch name
                         Branch name
   -G, --get-branch      API: Return branch from configuration
   -G, --get-branch      API: Return branch from configuration
   -S, --set-branch {stable,testing,unstable}
   -S, -B, --set-branch {stable,testing,unstable}
                         API: Replace branch in configuration
                         API: Replace branch in configuration


API:
API:
   -a, --api            [-p PREFIX][-R][-S|-G BRANCH][-P PROTO [PROTO ...]]
   -a, --api            [-p PREFIX][-R][-S|-G BRANCH][-P PROTO [PROTO ...]]
   -p, --prefix PREFIX  API: Set prefix to: $mnt | /mnt/install
   -p, --prefix PREFIX  API: Set prefix to : $mnt | /mnt/install
   -P, --proto, --protocols {all,http,https,ftp,ftps} [{all,http,https,ftp,ftps} ...]
   -P, --proto, --protocols {all,http,https,ftp,ftps} [{all,http,https,ftp,ftps} ...]
                         API: Replace protocols in configuration
                         API: Replace protocols in configuration
Line 116: Line 119:


MISC:
MISC:
  -h, --help
   -q, --quiet          Quiet mode - less verbose output
   -q, --quiet          Quiet mode - less verbose output
   -t, --timeout SECONDS
   -t, --timeout SECONDS
Line 121: Line 125:
   -v, --version        Print the pacman-mirrors version
   -v, --version        Print the pacman-mirrors version
   -n, --no-mirrorlist  Use to skip generation of mirrorlist
   -n, --no-mirrorlist  Use to skip generation of mirrorlist
  -y, --sync            Syncronize pacman databases
Deprecated arguments:
-y, --sync
Please use 'sudo pacman -Syy'


-g, --generate
!! Deprecated argument: '-g/--generate'!
Please use 'sudo pacman-mirrors -f <number>' use 0 for all mirrors
  Please use '-f/--fasttrack NUMBER', Use 0 for all mirrors
!! Deprecated argument: '-y/--sync'!
  Please use 'pacman -Syy'


</pre>
</pre>

Revision as of 09:29, 8 November 2017

Pacman-Mirrors

Pacman-mirrors is a Manjaro specific utility for generating and maintaining the system mirrorlist. This article covers current version 4.3. Pacman-mirrors uses the information available on the Mirrorservice

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 and preferably also up-to-date.

Use

For most functions, a working internet connection is required. From v4, Pacman-Mirrors will 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

It cannot be stressed enough, that every run of pacman-mirrors requires you to syncronize your database

$ sudo pacman -Syy

If you fail to do so, the issue/s which had you make change might not be solved. Furthermore you might run into partial-updated scenario which can cause havoc in your system.

TL:DR

Commands

All commands uses the available mirror pool. The mirror pool can be the default full mirror pool or a customized mirror pool. Commands for info do not require superuser - modifications do.

INFO: List available countries

pacman-mirrors -l

INFO: What branch am I on=

pacman-mirrors -aG

MOD: Customizing mirror pool

You can customized the mirror pool to your preference. Don't limit yourself too much as pacman-mirrors only writes up-to-date mirrors to your mirrorlist.

MOD: Customize for your country only

sudo pacman-mirrors --geoip && sudo pacman -Syy

MOD: Customize mirror pool by countries

sudo pacman-mirrors -cGermany,France,Austria && sudo pacman -Syy

MOD: Customizing the mirror pool by interactive selection

sudo pacman-mirrors -id && sudo pacman -Syy

MOD: create a mirrorlist

sudo pacman-mirrors -f0 && sudo pacman -Syy

The number can be changed to limit the number of mirrors in the mirrorlist

MOD: Limit to 5 mirrors=

sudo pacman-mirrors -f5 && sudo pacman -Syy

MOD: Temporarily switch to unstable branch

sudo pacman-mirrors -b unstable && sudo pacman -Syy

MOD: Switch back to stable branch

sudo pacman-mirrors -b stable && sudo pacman -Syy

MOD: Permanently switch branch

sudo pacman-mirrors -aB unstable && sudo pacman -Syy

MOD: Use specific protocols (prioritized)

sudo pacman-mirrors -aPhttps,http && sudo pacman -Syy

MOD: Use all protocols

sudo pacman-mirrors -aPall && sudo pacman -Syy

Overview

Available arguments

All available arguments can be viewed by unfolding this block

~ >>> pacman-mirrors  
Version 4.4.0
USAGE:
 pacman-mirrors [-h] [-f NUMBER] [-i [-d]] [-m METHOD]
		[-c COUNTRY [COUNTRY...]] [--geoip] [-l]
		[-b BRANCH | -G | -S/-B BRANCH] [-a] [-p PREFIX]
		[-P PROTO [PROTO...]] [-R] [-U URL]
		[-q] [-t SECONDS] [-v] [-n]

METHODS:
  -f, --fasttrack NUMBER
                        Generate mirrorlist with a number of up-to-date
                        mirrors. Ignores:
  -i, --interactive     Generate custom mirrorlist
  -d, --default         Interactive: Load default mirror file
  -m, --method {rank,random}
                        Generation method

COUNTRY:
  -c, --country COUNTRY [COUNTRY ...]
                        Comma separated list of countries, from which mirrors
                        will be used
  --geoip               Get current country using geolocation
  -l, --country-list, --list
                        List all available countries

BRANCH:
  -b, --branch {stable,testing,unstable}
                        Branch name
  -G, --get-branch      API: Return branch from configuration
  -S, -B, --set-branch {stable,testing,unstable}
                        API: Replace branch in configuration

API:
  -a, --api             [-p PREFIX][-R][-S|-G BRANCH][-P PROTO [PROTO ...]]
  -p, --prefix PREFIX   API: Set prefix to : $mnt | /mnt/install
  -P, --proto, --protocols {all,http,https,ftp,ftps} [{all,http,https,ftp,ftps} ...]
                        API: Replace protocols in configuration
  -R, --re-branch       API: Replace branch in mirrorlist
  -U, --url URL         API: Replace mirror url in mirrorlist

MISC:
  -h, --help
  -q, --quiet           Quiet mode - less verbose output
  -t, --timeout SECONDS
                        Maximum waiting time for server response
  -v, --version         Print the pacman-mirrors version
  -n, --no-mirrorlist   Use to skip generation of mirrorlist

!! Deprecated argument: '-g/--generate'!
   Please use '-f/--fasttrack NUMBER', Use 0 for all mirrors
!! Deprecated argument: '-y/--sync'!
   Please use 'pacman -Syy'

Defaults

PacmanMirrors has some reasonable defaults

- Ranking mirrors with the fastest mirrors on top
- Using stable branch
- Using all mirrors

The -f 0 or --fasttrack 0 argument uses mirrors which are up-to-date for your branch. To limit the number of mirrors you can change the number to eg. 10

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 && sudo pacman -Syy

If a supplied country does not offer a mirrorserver the app quits with an error explaining why.

$ sudo pacman-mirrors --country Antarctica && sudo pacman -Syy
.: Info Downloading mirrors from repo.manjaro.org
.: Warning Option '-c/--country' : unknown country: 'Antarctica'
.: Info Available countries are:
Australia, Austria, Belarus, Belgium, Brasil, Bulgaria, Canada, Chile, China, Colombia,
Costa_Rica, Czech, Denmark, Ecuador, France, Germany, Greece, Hungary, Indonesia,
Ireland, Italy, Japan, Netherlands, Philippines, Poland, Portugal, Romania, Russia,
Singapore, South_Africa, Sweden, Spain, Taiwan, Turkey, United_Kingdom, United_States,
Vietnam


Another option for the mirrors closest to your location is --geoip

$ sudo pacman-mirrors --geoip --quiet && sudo pacman -Syy
:: 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 && sudo pacman -Syy

Syncronize your pacman database with the new mirror/branch combination and install whatever software needed from that branch.

$ sudo pacman -S some-software-package-you-need

After installation switch back

$ sudo pacman-mirrors --branch stable && sudo pacman -Syy

Syncronize

$ sudo pacman -Syy

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

Custom 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.

A more in-depth article is Create your own Custom Mirrorlist

$ sudo pacman-mirrors --interactive && sudo pacman -Syy

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.

When you want to reset the list to default run

$ sudo pacman-mirrors --country all && sudo pacman -Syy

Another way of resetting the custom mirror file is to use --default with --interactive

$ sudo pacman-mirrors --interactive --default && sudo pacman -Syy

You will be presented with a list with all and every mirror and you can pick your selection.

FAQ

fasttrack

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.

pacman-mirrors.conf

If pacman-mirrors is updated and has a new pacman-mirrors.conf, it will inform you.

You must manually merge changes/additions into your pacman-mirrors.conf.

Forum posts

Cookies help us deliver our services. By using our services, you agree to our use of cookies.