How to setup reflector-auto?

I’ve read through the wiki on reflector-auto (https://endeavouros.com/docs/pacman/rank-mirrorlist/) but I’m having difficulty understanding how it works.

I’ve created this file: /etc/reflector-auto.conf

I’m in the U.S. but I don’t understand what to put in this file to make it work properly?

Once I create the file and enter the proper information for the US and enable it through systemd, does it just run automatically or is there anything else I need to do?

And if I’m using the reflector-simple GUI do I even need reflector-auto? It’s all very confusing.

3 Likes

File /etc/reflector-auto.conf can have options of the reflector command. For details, see

  reflector --help

Typical options in your case could be:

  --save /etc/pacman.d/mirrorlist
  -p https
  -a 2
  -f 10
  -c US
  --sort rate   # or 'age' if you want the latest immediately

And as reflector-auto is meant to be used via a service, the following command enables the service:

  sudo systemctl enable reflector-auto.timer

Then you should reboot.

Here are some documents about reflector-auto and related stuff:

Edit: maybe someone from the US might comment on the options.

6 Likes

For the question about reflector-simple: that may be an adequate solution.

In countries where mirrors tend to have issues every now and then, reflector-auto could be a useful solution.

In your case I assume mirrors are relatively stable (I may be wrong…) so setting mirrors with reflector-simple (maybe once or twice a year to check too?) should be OK.

All in all:

  • reflector-simple sets mirrors once when you run it
  • reflector-auto can periodically and automatically set mirrors
4 Likes

Hello @Luna and welcome!

@manuel beat me to this but let me see if I can assist them. This post you may find helpful:

Also here:

Let us work backward for a second in respect to your post.

This is up to you. You can use one, both, or none.

Think of reflector-simple as one shop stopping. You set it up once and forget it. This means you will have a static mirror list that never changes ranked according to the options you selected via the button in the welcome app. This is made easier by having the check boxes for number of mirrors, rate (speed), and how long the mirrors refreshed last. This will not change unless you repeat the process manually.

Think of reflector-auto as a way to automatically repeat this process on a timer as a service running in the background. This is slightly more complicated because here we don’t have the handy check boxes and have to add the options manually to a file that the reflector-auto.timer service will execute automatically based on the options you have added into the file /etc/reflector-auto.conf file. So you set the options in the file by manually adding them (type them in) and the service runs the file on a timer.

Once you set the .conf and enable the timer it should just run.

Here is an example file:

## Configuration for 'reflector-auto'.
-c US
-c CA
-p https
-a 4
-f 10
--sort rate

-c sets the country. So the first two look for mirrors in the US and Canada.
-p sets the protocol (there is also a checkbox for this in reflector-simple) I only use https
-a sets how many hours since the mirror last refreshed. The example uses 4 I use 2.
-f how many mirrors you would like to pull in to use.
–sort rate (speed).

@manuel if I have said anything wrong here please correct.

7 Likes

Welcome @Luna!
Enjor your journey onboard Endeavour!

moon-and-endeavour

2 Likes

@Elloquin what is the difference between reflector and reflector-auto? As far as I understand there is also a service and a timer at reflector.

Thanks in advance,

Christoph

1 Like

Reflector is the arch package. Reflector auto is the package that was made from it by @manuel for EndeavourOS.
https://www.archlinux.org/packages/community/any/reflector/
https://wiki.archlinux.org/index.php/Mirrors
https://www.archlinux.org/mirrorlist/

2 Likes

Seems that reflector devs have added the service feature directly to the reflector package less than a week ago. Thanks for informing, didn’t know they did that.

I’ll take a look at the new feature, and see if that would cause changes to reflector-auto.

7 Likes

Reflector devs have added a similar systemd integration to reflector what EndeavourOS has in reflector-auto.
Because of that, there’s no reason to develop reflector-auto further (unless someone has a really great new idea for it :wink: ).

So I’ll keep reflector-auto available for a while (i.e. until the end of year 2020 at least), but eventually it is bound to be replaced with the similar feature of reflector.
I’ll update the EndeavourOS wiki too about this new turn of events.

14 Likes

You, who are better at this than me… if I understand the wiki correct the default update for reflector.timer is weekly, right?

Hmm, perhaps the reflector devs took a note from you.

7 Likes

Seems that way, yes.

I wouldn’t know sir… :slight_smile:
But that means a bit less work for us, and also other Archers get to enjoy it.

5 Likes

I am mostly asking because quite frankly I have never used the systemctl edit function before and I am in no way knowing the syntax for changing the timer. But weekly is what I had planned for it so…

2 Likes

It is a simple text file at /usr/lib/systemd/system/reflector.timer.
So basically you can edit it with a normal text editor and then restart the timer using proper systemctl command.

2 Likes

Also, let’s say you want to edit fstrim.timer

sudo systemctl edit fstrim.timer

This will open the editor in the terminal. When you are done editing and save your changes, this will create an override file as follows:

/etc/systemd/system/fstrim.timer.d/override.conf

This will keep the original timer intact.

2 Likes

Huh.
Not that it’s a big problem but curious:
It is set to be within 1 second BUT have a random +12 hours. Seems overkill to have a 1 second accuracy if you have that random margin…
(Reading the systemd wiki it’s said a setting like this is to avoid workload spikes for scheduled tasks, but that seems to be a server issue, mostly.)

So, changed that random delay to 1 hour. No need of having it randomly switch day of the week within the first well… week.

1 Like

@manuel So it seems like reflector-simple would be the easiest thing for me to use right now? It’s more confusing now that reflector-auto will be gone soon.

@Elloquin thank you for this tremendously detailed instruction set. I think I’ll just use reflector-simple for now since reflector-auto appears to be going away soon.

2 Likes

The reflector-simple tool is very useful and simple to use.
I’d say it is OK to use only reflector-simple and occasionally use it again if some mirrors start failing.

You can use reflector too, no problem. They both create the mirrorlist file at /etc/pacman.d/mirrorlist. Reflector-simple is simply a GUI for reflector.

5 Likes

To answer your first question:

To activate the built in service:

sudo systemctl enable reflector.timer
sudo systemctl start reflector.timer

Then go to /etc/xdg/reflector/ and edit reflector.conf

The only thing you NEED to change is the country(ies).

4 Likes