DEV Community

Ryder Damen
Ryder Damen

Posted on

Fixing Broken Mirrors - Raspberry Pi

While installing some packages on my Raspberry Pi, I encountered an outage with one of the package mirrors in Canada.

It's a problem I haven't faced before, so I figured I'd share how to get around it.

The Problem

When running the following command:

sudo apt-get update && sudo apt-get install -y git
Enter fullscreen mode Exit fullscreen mode

I got the following error:

Err:1 http://mirrors.switch.ca/raspbian/raspbian buster/main armhf liberror-perl
  404  Not Found [IP: 209.115.181.106 80]
E: Failed to fetch http://mirrors.switch.ca/raspbian/raspbian/pool/main/libe/liberror-perl/liberror-perl_0.17027-2_all.deb  404  Not Found [IP: 209.115.181.106 80]
E: Unable to fetch some archives, maybe run apt-get update or try with --fix-missing?
Enter fullscreen mode Exit fullscreen mode

After some poking around on the server, it turns out that none of the files in the liberror-perl directory existed. I sent the team that manages the mirror an email and noticed that they had just completed a server migration.

In the meantime, I'm going to point myself to a different mirror so I can get things installed and working.

How To Fix It

First, head to the RaspbianMirrors Website, which lists all mirrors by geographic location.

Pick something close to you that's not the one that's inoperable. I chose the Free Mirror project since it's also in Canada.

(http|https)://raspbian.freemirror.org/raspbian/
Enter fullscreen mode Exit fullscreen mode

Grab the URL, and head over to your /etc/apt/sources.list on your Raspberry Pi.

sudo nano /etc/apt/sources.list
Enter fullscreen mode Exit fullscreen mode

Place the following line at the top of the file, making sure to adjust the URL to the one you grabbed from the Mirrors website.

deb https://raspbian.freemirror.org/raspbian/ buster main contrib non-free rpi
Enter fullscreen mode Exit fullscreen mode

Save the file, and run your update and install commands again.

sudo apt-get update
sudo apt-get install git
Enter fullscreen mode Exit fullscreen mode

Success! The Pi will now install things from the new mirror while the old one gets sorted out. Happy hacking!

Latest comments (1)

Collapse
 
mcmejean profile image
mcmejean

Awesome! Thanks for your guidance. It helps