Very low pacman speeds; not sure if mirrors update properly

Hi guys. First of all, happy new year. Hope everyone had good holidays.

So I have the issue that pacman sync/downloads speeds are like 25-40 Kb/s. I have tried to search the forums and even the arch wiki as well as Reddit for solutions; have tried updating the mirrors using command and reflector-simple. They used to work fine so I don’t know what’s going on. Starting reflector-simple, gives a pop up of no country code. I press “quit”, the mirror selection window appears. I’ve tried countries near me (Brazil, Chile, Paraguay, Ecuador, Colombia) and Worldwide. For the most part it fails to rate a lot of them. I also have tried higher timeouts, up to 120 seconds. It doesn’t fix it.
I assume “after install” and “assistant” reflector is the same. For some reason, only once opened from assistant and it gave an error getting info from archlinux.org. Reflector-simple is using reflector-simple.conf file. After the rates, I can save the config to the file, but the downloads are still the same. (I do sort by rate).
I’ve tried searching before to avoid posting yet another thread about mirrros, but some of the solutions didn’t work for me and I don’t know much (yet!) to make up a variant myself. All the rest works fine. Videos and streaming, downloads, Steam, MEGA sync, qbit - Is just pacman.
Side question: Does updating the mirrors for pacman work for yay/AUR as well, or are those different?
I appreciate any help. I’ll post some screenshots to give some info ahead, maybe it helps.

d

d-2

d-3

Possibly related?

Some ideas:

  • You could try countries like United States and Germany as they have many good mirrors working worldwide.
  • To have more control over reflector options, you can use reflector directly instead of reflector-simple.
  • Then there is command rate-mirrors which in some cases provides better results than reflector.

See the reflector man page and reflector help:
% man reflector
% reflector -help

for you, you probably want --sort rate among any other possible parameters.

Once you get reflector parameters set that find the fastest mirrors, try fixing this for good.

check out /usr/lib/systemd/system/relefector.service

The reflector probably takes in /etc/xdg/reflector/reflector.conf. Ensure your changes/optimizations are in that file.

Review /usr/lib/systemd/system/reflector.timer. You can review systemd docs and adjust the Calendar (days) and times that this may run.

From memory, to get this automated once your config is in place,

systemctl enable reflector
systemctl start reflector

Then I think you should be set. Someone can correct me if I’m wrong (it’s very late for me at this moment).

Reflector is one of the first things I setup on a fresh install.

I would not recommend automatic mirror refreshing, that was one of the things that bothered me about Manjaro. You could (though unlikely) cause a partial update if the local package database is not properly refreshed. That is why every time you change your mirror list, you should run pacman -Syyu with two ys.

rate-mirrors is an excellent alternative to reflector, written in Rust (btw). I find it to be faster and simpler to use than reflector. Every time you notice download speeds get a bit slow (or if you haven’t updated in over a month, so the download is going to be pretty large; or if you get mirrorlist errors), run:

rate-mirrors arch | sudo tee /etc/pacman.d/mirrorlist

If you want only https mirrors, modify the above command to this:

rate-mirrors --protocol=https arch | sudo tee /etc/pacman.d/mirrorlist

Limiting your mirrorlist to only https mirrors will make it so that all traffic between you and mirrors is encrypted so that no third party can know what packages you’re updating (though, they could probably guess by the package size, if they are really interested). The speeds will be significantly slower, though.

Again, after changing your mirrorlist, always run:

sudo pacman -Syyu

with two ys, to force the local package database refresh.

I find this to be the easiest method to get the fastest download speeds with pacman.

4 Likes

Interesting, and had not considered such of a situation, as I based my work on this several months ago on the reflector Arch wiki page - which doesn’t mention this risk at all.

Maybe then as a way to ensure a fresh mirror, use an -age parameter with a low value of 2 or 4 ( -n 2 or -n 4).

I might have a such -age setting in my setup.

Another potential collision might be a situation where dozens of python or haskell packages are getting updated, and your pacman or helper comes in right in the middle, such that some of your packages are current and the rest aren’t. This might be abated with a second -Syu right after just to see if anything changed while you were updating.

Yet good, timely mirrors probably minimize this risk to nil. I’ve got my reflector to update just a few hours before I usually do my -Syu action.

Perhaps there are ways to mitigate the risk (which is quite low as is), but I see no need for it to be automated.

I typically update my mirrorlist two or three times a year, and with rate-mirrors it takes maybe 20 seconds to do it. Its author recommends making a pacman hook and updating the mirrorlist on every update (which is feasible, since rate-mirrors is so fast), but I find that to be a major overkill. There is just no practical need to do so (especially since I sometimes update my main desktop several times a day), and doing it every couple of months is quite sufficient (when you notice download speeds getting slow or when you get errors).

On my laptop, which I don’t use regularly (I sometimes go up to 6 months without booting it, which on Arch is pushing it a bit), I always update my mirrorlist before a huge update, otherwise downloading those 5 or so gigabytes of updates can be rather tedious.

I just prefer to keep these things simple.

Maybe he is on Manjaro, updating once a month?

If you like simplicity - perhaps you should look into employing eos-shifttime for the multi-month updates too. That way you can specify smaller time periods for the updates, and step-by-step up to the present (a month at a time?). I use it for anything badly outdated (a build I haven’t visited for a while, or an unused laptop) as well as my mirror server, which I keep a week behind current to avoid any issues with updates… that’s usually enough time to have resolved anything that came up!

1 Like

Meh, I just yolo-update that old piece of crap. :rofl:

There are almost never any problems.

I always do pacman -Syyu just in case. Out of the few things I’ve learnt so far, that is one of those.
rate-mirrors did the trick! Now I download at full speed, and stable. Amazing workaround, thank you!

1 Like

I had seen these answers, but thought that not being in these countries (US, Canada, NZ, Germany, etc.) that were on the list could be a potential problem.

rate-mirrors worked perfectly as suggested by Kasimir, but the downgrade solution could be step #2 for other people (or try that one first instead).

You don’t need to do that (and shouldn’t, as it just unnecessarily increases traffic for the mirrors). Typically, you only need to use -Syyu after you change your mirrorlist. For normal updates, just use

sudo pacman -Syu

or even shorter:

yay
4 Likes

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.