Fixing Broken Mirrors - Raspberry Pi
Ryder Damen
Posted on October 6, 2021
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
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?
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/
Grab the URL, and head over to your /etc/apt/sources.list on your Raspberry Pi.
sudo nano /etc/apt/sources.list
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
Save the file, and run your update and install commands again.
sudo apt-get update
sudo apt-get install git
Success! The Pi will now install things from the new mirror while the old one gets sorted out. Happy hacking!
Posted on October 6, 2021
Join Our Newsletter. No Spam, Only the good stuff.
Sign up to receive the latest update from our blog.