Fixing Slow Armbian Updates by Manually Selecting a Local Mirror

Armbian logo

I use a small number of arm64 SBCs running Armbian as bastion hosts on several networks I manage. In particular, I have a preference for the Le Potato from Libre Computer, for reasons I notably covered in a previous blog post.

To keep these systems secure, it’s essential to religiously keep them up-to-date. On the Le Potato, Armbian is my distribution of choice. However, lately, one of the mirrors polled by apt when running the update command consistently timed out, becoming an annoyance. To resolve this issue, I decided to investigate further.

How Armbian does updates

There’s no official documentation on the Armbian mirror mechanics that I could find, but here’s what I discovered:

  • Armbian’s package management is slightly different from classic Debian and derivatives regarding mirrors.
  • The /etc/apt/sources.list file points to upstream Debian, as expected: http://deb.debian.org/debian
  • However, the /etc/apt/sources.list.d/armbian.list file is more interesting:
$ cat /etc/apt/sources.list.d/armbian.list

deb [signed-by=/usr/share/keyrings/armbian.gpg] http://apt.armbian.com bookworm main bookworm-utils bookworm-desktop

This folder points to packages specific to Armbian. The mirror causing the timeout issue is not listed here, and this source file points directly to armbian.com.

Under the hood, the http://apt.armbian.com address implements load balancing from the upstream server to secondary mirrors. Requests made to this address are randomly redirected to one of the official mirrors whitelisted by the project, with no apparent concerns for your location.

In my case, I was consistently redirected to Chinese mirrors πŸ‡¨πŸ‡³ , which was suboptimal for a few reasons:

  • Most of my servers had mirrors in the same country, which would be a much better fit.
  • Downloading packages from China rarely leads to good results unless you are actually in China, as routing traffic to and from China is a complex issue that requires specific peering agreements - something CDNs and content providers put in place, but that home and even business ISPs usually don’t prioritize.

The Fix

To remediate this issue, the only solution was to manually choose a mirror from the official list and edit our Armbian source file accordingly.

I chose the Singapore mirror. πŸ‡ΈπŸ‡¬

deb [signed-by=/usr/share/keyrings/armbian.gpg] http://sg.sbcmirror.org/armbian/apt/ bookworm main bookworm-utils bookworm-desktop

After updating the armbian.list file with the new mirror URL, the apt update command ran smoothly, resolving the timeout issues.

Cheers!