Are you receiving a “404 Not Found” error when trying to download some packages using apt-get?
While trying to install Hyperion on a Raspberry Pi 2 using the Jessie Lite image I struggled quite a bit to install the required dependencies. While apt-get normally works pretty well, some packages such as git and libqtgui4 returned a “404 Not Found”. Running apt-get update worked, but didn’t seem to solve the issue.
root@raspberrypi:/home/pi# apt-get install libqtgui4
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following extra packages will be installed:
fontconfig fontconfig-config fonts-dejavu-core libaudio2 libavahi-client3 libcups2 libfontconfig1 libice6 libjbig0 libjpeg8 liblcms2-2 libmng1 libsm6
libtiff5 libxrender1 libxt6 x11-common
nas cups-common liblcms2-utils qt4-qtconfig
The following NEW packages will be installed:
fontconfig fontconfig-config fonts-dejavu-core libaudio2 libavahi-client3 libcups2 libfontconfig1 libice6 libjbig0 libjpeg8 liblcms2-2 libmng1 libqtgui4
libsm6 libtiff5 libxrender1 libxt6 x11-common
0 upgraded, 18 newly installed, 0 to remove and 0 not upgraded.
Need to get 253 kB/7,081 kB of archives.
After this operation, 18.2 MB of additional disk space will be used.
Do you want to continue? [Y/n] y
Err http://mirrordirector.raspbian.org/raspbian/ jessie/main libcups2 armhf 1.7.5-11+deb8u1
404 Not Found [IP: 220.127.116.11 80]
E: Failed to fetch http://mirrordirector.raspbian.org/raspbian/pool/main/c/cups/libcups2_1.7.5-11+deb8u1_armhf.deb 404 Not Found [IP: 18.104.22.168 80]
E: Unable to fetch some archives, maybe run apt-get update or try with --fix-missing?
Fortunately I found a fix for this thanks to the #raspbian IRC channel. First of all make sure that you have a working network connection using ping google.com. If that doesn’t help use google to search for the package you want to install and add it to /var/cache/apt/archives/ so apt-get can find it.
In my case I googled for libcups2_1.7.5-11+deb8u1_armhf.deb and found another mirror for the .deb package. Then navigate to /var/cache/apt/archives/ and use wget to download the package such as wget http://.../libcups2_1.7.5-11+deb8u1_armhf.deb. Running apt-get install libqtgui4 again should now install the package.
This is of cause not a perfect solution, but if the repository is down it’s nice to know that you can add packages to the apt-get cache manually.