LMSouq
server-admin Open

In Docker, apt-get install fails with "Failed to fetch http://archive.ubuntu.com/ ... 404 Not Found" errors. Why? How can we get past it?

AL
AlexChaffee
1 month ago
3 views
Problem Description
My team uses Docker (with `ubuntu:14.04` base image) for local development and we often have to rebuild some or all of our images. But we often get failures downloading packages with `apt-get install`, even immediately after running `apt-get -y update`. For instance, today I see Err http://archive.ubuntu.com/ubuntu/ trusty-security/main libxml2 amd64 2.9.1+dfsg1-3ubuntu4.7 404 Not Found [IP: 91.189.88.161 80] Err http://archive.ubuntu.com/ubuntu/ trusty-security/main libxml2-dev amd64 2.9.1+dfsg1-3ubuntu4.7 404 Not Found [IP: 91.189.88.161 80] Fetched 84.7 MB in 1min 6s (1281 kB/s) Unable to correct missing packages. E: Failed to fetch http://archive.ubuntu.com/ubuntu/pool/main/libx/libxml2/libxml2_2.9.1+dfsg1-3ubuntu4.7_amd64.deb 404 Not Found [IP: 91.189.88.161 80] E: Failed to fetch http://archive.ubuntu.com/ubuntu/pool/main/libx/libxml2/libxml2-dev_2.9.1+dfsg1-3ubuntu4.7_amd64.deb 404 Not Found [IP: 91.189.88.161 80] E: Aborting install. Apparently the specific version of a particular package has been deleted from the archive and replaced with a slightly differently named patch version. For instance, the above error is looking for `libxml2_2.9.1+dfsg1-3ubuntu4.7_amd64.deb` but the version on the server is `libxml2_2.9.1+dfsg1-3ubuntu4.8_amd64.deb`. Often this is solvable by removing the base image (`docker rmi ubuntu:14.04`) and rebuilding; the newly downloaded ubuntu image has the correct patch number and finds the right archive file. But even this doesn't always work -- probably due to a delay between a new minor upgrade to Ubuntu's dependency db and the deployment of that new `ubuntu:14.04` image onto Docker Hub. We've tried using `apt-get` flags `--fix-missing` and `--fix-broken` and those don't consistently work either. Any other ideas? https://stackoverflow.com/questions/34778262/apt-get-install-fails-with-not-found-error-because-package-removed-from-reposito is a similar problem but the accepted answer is unacceptable because it's not possible to be automated. Our daily development process, including automatic build and deploy, is all scripted and using Docker and it's not practical to hack around inside a Dockerfile every time a particular archive goes missing (then remove the hack after a few hours or days). --- In response to @prateek05, here's the `/etc/apt/sources.list` from the official `ubuntu:14.04` docker image: root@72daa1942714:/# cat /etc/apt/sources.list # See http://help.ubuntu.com/community/UpgradeNotes for how to upgrade to # newer versions of the distribution. deb http://archive.ubuntu.com/ubuntu/ trusty main restricted deb-src http://archive.ubuntu.com/ubuntu/ trusty main restricted ## Major bug fix updates produced after the final release of the ## distribution. deb http://archive.ubuntu.com/ubuntu/ trusty-updates main restricted deb-src htt...

AI-Generated Solution

Powered by LMSouq AI · GPT-4.1-mini

✓ Solution Ready
Analyzing problem and generating solution…
Was this solution helpful?
Back to Knowledge Base