5

I have a script that has been working well until now and suddenly I get the following message:

Get:81 http://archive.ubuntu.com/ubuntu xenial-updates/universe amd64 python-software-properties all 0.96.20.7 [20.7 kB]
Get:82 http://archive.ubuntu.com/ubuntu xenial/main amd64 python3-pycurl amd64 7.43.0-1ubuntu1 [42.3 kB]
Get:83 http://archive.ubuntu.com/ubuntu xenial-updates/main amd64 python3-software-properties all 0.96.20.7 [20.3 kB]
Get:84 http://archive.ubuntu.com/ubuntu xenial-updates/main amd64 software-properties-common all 0.96.20.7 [9452 B]
Get:85 http://archive.ubuntu.com/ubuntu xenial/main amd64 xz-utils amd64 5.1.1alpha+20120614-2ubuntu2 [78.8 kB]
Err:86 http://archive.ubuntu.com/ubuntu xenial-updates/main amd64 unattended-upgrades all 0.90ubuntu0.7
  404  Not Found [IP: 91.189.88.161 80]
Fetched 23.7 MB in 1s (14.8 MB/s)
E: Failed to fetch http://archive.ubuntu.com/ubuntu/pool/main/p/python3.5/libpython3.5-minimal_3.5.2-2ubuntu0~16.04.2_amd64.deb  404  Not Found [IP: 91.189.88.161 80]

E: Failed to fetch http://archive.ubuntu.com/ubuntu/pool/main/p/python3.5/python3.5-minimal_3.5.2-2ubuntu0~16.04.2_amd64.deb  404  Not Found [IP: 91.189.88.161 80]

E: Failed to fetch http://archive.ubuntu.com/ubuntu/pool/main/p/python3.5/libpython3.5-stdlib_3.5.2-2ubuntu0~16.04.2_amd64.deb  404  Not Found [IP: 91.189.88.161 80]

E: Failed to fetch http://archive.ubuntu.com/ubuntu/pool/main/p/python3.5/python3.5_3.5.2-2ubuntu0~16.04.2_amd64.deb  404  Not Found [IP: 91.189.88.161 80]

E: Failed to fetch http://security.ubuntu.com/ubuntu/pool/main/libi/libidn/libidn11_1.32-3ubuntu1.1_amd64.deb  404  Not Found [IP: 91.189.88.161 80]

E: Failed to fetch http://archive.ubuntu.com/ubuntu/pool/main/u/unattended-upgrades/unattended-upgrades_0.90ubuntu0.7_all.deb  404  Not Found [IP: 91.189.88.161 80]

E: Unable to fetch some archives, maybe run apt-get update or try with --fix-missing?
The command '/bin/sh -c apt-get -y install software-properties-common python-software-properties' returned a non-zero code: 100

It seems that when running:

apt-get -y install software-properties-common python-software-properties

Some server is down. How can I avoid having this dependency? This is part of a continuous integration server and I would like to avoid these problems in the future.

NOTE: I ran sudo apt update before.. This is in fact, part of a Dockerfile:

FROM ubuntu:16.04
RUN apt-get update
RUN apt-get -y install software-properties-common python-software-properties
RUN apt-get -y install ca-certificates curl
RUN apt-get -y install build-essential git sudo

building the container fails in the second line.

  • Did you run sudo apt update before? – dessert Oct 4 '17 at 9:34
  • Unfortunately yes – Juan Leni Oct 4 '17 at 9:35
7

According to docker best practices, I should put the update and install in the same RUN line. This way the cache will be updated properly.

After these changes, things are working.

| improve this answer | |
  • 1
    apt-get update one one line followed by apt-get install X on the next line is completely equivalent to a single line of apt-get update && sudo apt-get install X. If the problem apparently went away after this change, the problem was actually an intermittently out-of-sync package repository. Those are bound to happen occasionally with the way package repositories are currently managed. – David Foerster Nov 4 '17 at 23:50
  • 1
    it is a tiny bit different because Docker is caching per line. So some lines might not get executed again. – Juan Leni Nov 5 '17 at 6:57
  • I believe @JuanLeni is correct. They are not equivalent, and the apt-get update might get an undesirable cache. – James Hirschorn Apr 12 '19 at 23:42
  • 1
    Thanks, after almost an hour browsing and wondering how this stopped working with no changes your solution was the only one that worked for me. – Cross Sep 27 '19 at 16:12
2

If you're running into this issue while using Docker, you may need to run the docker build command with the --no-cache option to get it to start again from the beginning.

| improve this answer | |
  • worked for me, thanks – Kim Sep 17 '19 at 19:21
  • Worked for me. Apparently once an intermediate docker image gets "stuck" on a certain bad mirror it stays there. I suspect one could also delete all the intermediate docker images before rebuilding, instead of using --no-cache. – Curt May 8 at 8:04
0

The files have been removed from the server for some reason.

Open up a new browser window and copy/paste the following in the URL address bar and hit Enter and see for yourself:

http://archive.ubuntu.com/ubuntu/pool/main/u/unattended-upgrades/unattended-upgrades_0.90ubuntu0.7_all.deb

http://security.ubuntu.com/ubuntu/pool/main/libi/libidn/libidn11_1.32-3ubuntu1.1_amd64.deb

You can also try:

wget http://archive.ubuntu.com/ubuntu/pool/main/u/unattended-upgrades/unattended-upgrades_0.90ubuntu0.7_all.deb

wget http://security.ubuntu.com/ubuntu/pool/main/libi/libidn/libidn11_1.32-3ubuntu1.1_amd64.deb

and you will get the same error.

Can you please post the contents of /etc/apt/sources.list?

cat /etc/apt/sources.list

You just need to edit the URLs in the file to redirect APT to different servers and run sudo apt update and try again.

Look what happens when I visit one of the URLs from my end:

enter image description here

This is why it fails. You need to change the server reference.

| improve this answer | |
  • Thanks. I am using the official ubuntu image for docker. Redirecting to other servers would be too error prone.. more like manual patching. I think the reason was because that line was not following docker best practices and the update line was cached. – Juan Leni Oct 4 '17 at 10:14
  • Yes, it was clear to me that the files were not there. Servers can be updated frequently and that is fine. – Juan Leni Oct 4 '17 at 10:15

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.