Reflector - ArchWiki

Jump to content

# Reflector

From ArchWiki

Related articles

- Mirrors
- Pacman

Reflector is a Python script which can retrieve the latest mirror list from the Arch Linux Mirror Status page, filter the most up-to-date mirrors, sort them by speed and overwrite the file `/etc/pacman.d/mirrorlist`.

## Installation

Install the reflector package. Alternatively, the reflector-rsAUR package can be used as a drop in replacement.

## Usage

To see all of the available options, run the following command:

    $ reflector --help

Note It is typically not a good idea to filter by country; there are only a finite number of mirrors in a single country. Network throughput is only partly determined by geographical distance.

### Examples

See reflector(1) § EXAMPLES.

Note Examples overwriting `/etc/pacman.d/mirrorlist` need to be run as root. Make a backup before proceeding and verify the results afterwards.

## Automation

### systemd service

Reflector ships with `reflector.service`, which runs Reflector using the options specified in `/etc/xdg/reflector/reflector.conf`. The default options in that file provide a good starting point and example.

Enable `reflector.service` to run Reflector on boot. To run it immediately, start the service.

Note `reflector.service` depends on a network wait service to be configured via network-online.target.

### systemd timer

Reflector provides a systemd timer (`reflector.timer`) that starts the #systemd service `reflector.service` weekly. The schedule can be changed by editing `reflector.timer`.

For changing the default options that `reflector.service` gets started with, edit the configuration file as described in #systemd service. Then, start and enable `reflector.timer`.

To refresh the mirrorlist ahead of schedule, start `reflector.service`.

### pacman hook

pacman-mirrorlist is not updated regularly, invoking reflector because a mirror in some part of the globe was added or removed is not relevant; use the #systemd timer approach instead. If you do not want `mirrorlist.pacnew` to be installed at all, use NoExtract in `/etc/pacman.conf`.

## See also

- Reflector thread on the Arch Linux Forums
- Upstream project page including changelog

Category:

- Package management

Reflector
Add topic