1

This question already has an answer here:

I have a very nearly fresh 16.04 installation (only installed a couple of weeks ago). Today, when I try to

$ sudo apt update
$ sudo apt install openssh-server

I'm greeted with

The following NEW packages will be installed
  ncurses-term openssh-server openssh-sftp-server ssh-import-id
0 to upgrade, 4 to newly install, 0 to remove and 2 not to upgrade.
Need to get 373 kB/633 kB of archives.
After this operation, 5,136 kB of additional disk space will be used.
Do you want to continue? [Y/n] Y
Err:1 http://gb.archive.ubuntu.com/ubuntu xenial-updates/main amd64 openssh-sftp-server amd64 1:7.2p2-4ubuntu2.5
  404  Not Found [IP: 91.189.88.152 80]
Err:2 http://gb.archive.ubuntu.com/ubuntu xenial-updates/main amd64 openssh-server amd64 1:7.2p2-4ubuntu2.5
  404  Not Found [IP: 91.189.88.152 80]
E: Failed to fetch http://gb.archive.ubuntu.com/ubuntu/pool/main/o/openssh/openssh-sftp-server_7.2p2-4ubuntu2.5_amd64.deb  404  Not Found [IP: 91.189.88.152 80]

E: Failed to fetch http://gb.archive.ubuntu.com/ubuntu/pool/main/o/openssh/openssh-server_7.2p2-4ubuntu2.5_amd64.deb  404  Not Found [IP: 91.189.88.152 80]

E: Unable to fetch some archives, maybe run apt-get update or try with --fix-missing?

So obviously, I tried sudo apt update --fix-missing, which changed nothing.

Clearly, either my system is looking for a version of the package that no longer exists, or some server administrator deleted something they shouldn't have. My money's on the former.

Does anybody have any idea how I might debug or fix this problem? I'd like to tackle the root cause, rather than just have a workaround for openssh.

The one relevant difference on my system, which may affect things, is that I have an NVIDIA SDK installed which, amongst other things, adds arm64 architecture to apt so it can download some packages for cross-compilation. I'm using an amd64 (not arm64) system. This means that when I apt update, I get a bunch of errors relating to repositories that don't carry arm64 pacakges, like this:

E: Failed to fetch http://gb.archive.ubuntu.com/ubuntu/dists/xenial/main/binary-arm64/Packages  404  Not Found [IP: 91.189.88.162 80]

This isn't a problem (and I believe is a necessary evil of working with this SDK). I only mention it because it might have a bearing on my current issue.


Edit:

The root cause of the problem is related to this, but the problem itself is different.

marked as duplicate by muru, karel, Eric Carvalho, Fabby, George Udosen Nov 24 '18 at 0:38

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

  • That is the problem - apt is ignoring those sources since it's encountering errors. Remove the arm64 arch, or modify the sources to prevent Ubuntu mirrors from needing it. – muru Nov 20 '18 at 11:09
  • @muru I can't remove the arm64 arch, because it's "in use", which I assume means I have packages installed from it. I'd like to keep those packages and continue to receive updates on them. I'm also not sure why this would stop me from installing standard amd64 or i386 packages. – JMAA Nov 20 '18 at 11:23
  • Then use the other method. As I said, the source is ignored because it's giving an error, so you can't install anything from it. – muru Nov 20 '18 at 11:26
  • @muru Thanks for your help. I've written up an answer. If you want to, feel free to write your own and I'll accept it. – JMAA Nov 20 '18 at 11:49
2

Credit to @muru from the comments and this answer.

The root problem:

apt will ignore any source if it gets an error updating its sources list, even if that error comes from a different (and foreign) architecture. Therefore, adding a foreign architecture without then restricting the architectures for all of your existing apt repository sources will stop them from updating.

For future reference the solution, for this case at least:

  • Run sudo apt update and take note of which sources fail. You're looking for lines like

    Err:19 http://security.ubuntu.com/ubuntu xenial-security/main arm64 Packages                   
      404  Not Found [IP: 91.189.88.161 80]
    
  • Open /etc/apt/sources.list for editing in your favourite text editor, e.g. sudo nano /etc/apt/sources.list.

  • For every line that 1) isn't commented (doesn't start with #) and 2) matches one of the error lines you noted earlier, add [arch=amd64,i386] between the deb and the URL. So, for the previous example,

    deb [arch=amd64,i386] http://security.ubuntu.com/ubuntu xenial-security main restricted
    

Repeat these steps until sudo apt update runs without complaining about missing arm64 repositories.

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