Tag Archives: script

Arch Linux Mirrorlist

Arch linux package updates come through fairly frequently – at least once a day. Last week I noticed that my usual ‘updates available’ widget hadn’t poked me for a few days, so I was curious as to what was going on. Was the Open Source community on a holiday? Or perhaps, and more likely, something about my setup wasn’t right, and now I wasn’t getting updates.

The first thing I tried was to call /usr/bin/checkupdates. Which returned nothing. Hmmm… were there really no updates available, or were the mirrors I was using just no longer uptodate or working?

I came across the Pacman Mirrorlist Generator (https://archlinux.org/mirrorlist/). This page generates the most up-to-date mirrorlist possible for Arch Linux. The data used here comes straight from the developers’ internal mirror database used to track mirror availability and tiering. There are two main options: get a mirrorlist with every available mirror, or get a mirrorlist tailored to your geography.

Generally you want mirrors that are fast and/or close – as you’ll be pulling a decent amount of data down from them – plus no one likes a long update process.

I’m in the UK (close to France), prefer HTTPS, and my ISP uses IPv4 (https://archlinux.org/mirrorlist/?country=FR&country=GB&protocol=https&ip_version=4) – so I opted for these settings. Et voila – a new mirror list for me to use.

Before I put this into action, I wanted to make sure I had a backup first:

# cp /etc/pacman.d/mirrorlist /etc/pacman.d/mirrorlist.backup

I wanted the top 5 mirrors from the list generated, so I used rankmirrors, and the following script:

# curl -s "https://archlinux.org/mirrorlist/?country=FR&country=GB&protocol=https&ip_version=4&use_mirror_status=on" | sed -e 's/^#Server/Server/' -e '/^#/d' | rankmirrors -n 5 - > /etc/pacman.d/mirrorlist

Once I ran checkupdates again… I now had a lot of updates.

A quick:

sudo pacman -Syu --noconfirm

…and I was feeling fresh again.