2

I have a Ubuntu 18.04.6 LTS machine that cannot be updated due to a dependency error, which I don't know how to solve.

It started after I did do-release-upgrade from 16.04.7.

  1. apt update works fine, then apt upgrade gives this error:
You might want to run 'apt --fix-broken install' to correct these.
The following packages have unmet dependencies:
    containerd : Breaks: docker.io (< 19.03.13-0ubuntu4) but 18.09.7-0ubuntu16.04.7 is installed
E: Unmet dependencies. Try 'apt --fix-broken install' with no packages (or specify a solution).
  1. I try apt --fix-broken install, as suggested, but it gives yet another error, and this time, a very unespecific one:
dpkg: error processing archive /var/cache/apt/archives/docker.io_20.10.12-0ubuntu2~18.04.1_amd64.deb (--unpack):
Error were encountered while processing:
    /var/cache/apt/archives/docker.io_20.10.12-0ubuntu2~18.04.1_amd64.deb
E: Sub-process /usr/bin/dpkg/ returned an error code (1)
  1. As it suggest me to run apt autoremove, I try that command instead, which leads me to the first error again:
You might want to run 'apt --fix-broken install' to correct these.
The following packages have unmet dependencies:
    containerd : Breaks: docker.io (< 19.03.13-0ubuntu4) but 18.09.7-0ubuntu16.04.7 is installed
E: Unmet dependencies. Try 'apt --fix-broken install' with no packages (or specify a solution).
  • How to stop this circular error throwing and update the machine?

Please add apt-cache policy containerd docker.io to your question.

Here it is:

:~# apt-cache policy containerd docker.io
containerd:
    Installed:  1.5.9-0ubuntu1~18.04.2
    Candidate:  1.5.9-0ubuntu1~18.04.2
    Version table:
    *** 1.5.9-0ubuntu1~18.04.2 500
            500 http://br.archive.ubuntu.com/ubuntu bionic-updates/universe amd64 Packages
            500 http://security.ubuntu.com/ubuntu bionic-security/universe amd64 Packages
            100 /var/lib/dpkg/status
        0.2.5-0ubuntu2 500
            500 http://br.archive.ubuntu.com/ubuntu bionic/universe amd64 Packages
docker.io:
    Installed:  18.09.7-0ubuntu1~16.04.7
    Candidate:  20.10.12-0ubuntu1~18.04.1
    Version table:
        20.10.12-0ubuntu2~18.04.1 500
            500 http://br.archive.ubuntu.com/ubuntu bionic-updates/universe amd64 Packages
        20.10.7-0ubuntu5~18.04.3 500
            500 http://security.ubuntu.com/ubuntu bionic-security/universe amd64 Packages
    *** 18.09.7-0ubuntu1~16.04.7 100
            100 /var/lib/dpkg/status
        17.12.1-0ubuntu1 100
            500 http://br.archive.ubuntu.com/ubuntu bionic/universe amd64 Packages

Try apt install --reinstall docker.io=20.10.12-0ubuntu1~18.04.1

Error, similar, but more detailed than the one returned by apt --fix-broken install:

dpkg: error processing archive /var/cache/apt/archives/docker.io_20.10.12-0ubuntu2~18.04.1_amd64.deb (--unpack):
    new docker.io package pre-installation script subprocess returned error exit status 1
Errors were encountered while processing:
    /var/cache/apt/archives/docker.io_20.10.12-0ubuntu2~18.04.1_amd64.deb
E: Sub-process /usr/bin/dpkg/ returned an error code (1)

Try apt upgrade docker.io.

Error, the same previously returned by apt update and apt autoremove:

You might want to run 'apt --fix-broken install' to correct these.
The following packages have unmet dependencies:
    containerd: Breaks: docker.io (< 19.03.13-0ubuntu4) but 18.09.7-0ubuntu1~16.04.7 is installed
E: Unmet dependencies. Try 'apt --fix-broken install' with no packages (or specify a solution).
  • 2
    Please add `sudo apt update` to your question. And also `apt-cache policy containerd docker.io` – nobody Feb 23 '23 at 15:29
  • 1
    Well, your output shows that you are trying to run a 16.04 version of containerd on an 18.04 system, and the two are incompatible. You generally solve it by uninstalling that 16.04 version of containerd, removing whatever source is pulling in that 16.04 version, and then reinstalling a proper 18.04 version from the normal Ubuntu repositories... – user535733 Feb 23 '23 at 16:34
  • ...HOWEVER, your 18.04 system goes out of Standard Support in two months. After that, we don't answer questions about it anymore. Time to consider migrating all of your containers to a freshly-installed 22.04 system. – user535733 Feb 23 '23 at 16:35
  • @nobody My question already has `apt update` on step 1. `sudo` is not needed, as I logged in as root on the console. – BsAxUbx5KoQDEpCAqSffwGy554PSah Feb 23 '23 at 16:41
  • @user535733 I forgot to mention on the question description, that the error started after `do-release-upgrade` from 16.04.7. That's why it is trying to run the 16.04.7 version of containerd. – BsAxUbx5KoQDEpCAqSffwGy554PSah Feb 23 '23 at 16:42
  • @nobody I have added `apt-cache policy containerd docker.io` to my question description, as you asked. – BsAxUbx5KoQDEpCAqSffwGy554PSah Feb 23 '23 at 17:07
  • `sudo apt install --reinstall docker.io=20.10.12-0ubuntu1~18.04.1` If this is not working show `sudo apt upgrade docker.io` – nobody Feb 23 '23 at 17:39
  • @user535733 I already know that 18.04 is reaching end of life. I want to fix this circular error in order to be able to do another `do-release-upgrade` as soon as I can. – BsAxUbx5KoQDEpCAqSffwGy554PSah Feb 23 '23 at 18:52
  • 1
    It's not a "circular error." Everything you have shown us so far points to an ordinary self-inflicted version conflict, similar to thousands of others, and among the most common questions here. @nobody's approach is exactly right, and that person has long experience with these. Almost all version conflicts are self-inflicted: You likely apt-marked or pinned or PPAd or otherwise introduced the problem yourself, possibly many years ago while running 16.04. It's very easy to solve if you can disclose what you did. It's sometimes very hard to solve if you don't recall. – user535733 Feb 23 '23 at 19:03
  • @nobody I edited the question description to add the errors returned by the last commands that you asked me to try. – BsAxUbx5KoQDEpCAqSffwGy554PSah Feb 23 '23 at 19:11
  • @user535733 Thanks for clarifying. But be sure that I did not 'introduce the problem myself many years ago while running 16.04', as I'm not the owner of this server, which I received for fixing, not a long time ago, already totally non-operational, [stuck on emergency mode with a dead HDD](https://unix.stackexchange.com/questions/735793/ubuntu-gives-message-welcome-to-emergency-mode-fsck-just-says-clean). – BsAxUbx5KoQDEpCAqSffwGy554PSah Feb 23 '23 at 19:14
  • 1
    Apologies for erroneous assumptions. Have you tested the containers in a 20.04 testing environment? It would stink to fix the package problem and successfully release-upgrade only to learn that it broke whatever is in the containers. After a successful test, simply uninstall containerd and docker.io, then run the release-upgrade, then reinstall containerd and docker.io from the Ubuntu repositories. – user535733 Feb 23 '23 at 19:28
  • 1
    Oh that's not so good it seems you have to migrate your containers. But i can not help further. https://askubuntu.com/questions/1361206/docker-upgrade-failure-the-aufs-storage-driver-is-no-longer-supported – nobody Feb 23 '23 at 19:28
  • @user535733 No problem, I'm not offended. About the containers, I asked the human owner and he said the containers can just be deleted. It is more important for him to have the most recent OS version than to keep long-forgotten containers. So I just need to do `rm -r /var/lib/docker/aufs`, then `apt remove containerd`, and `apt remove docker.io`, right? – BsAxUbx5KoQDEpCAqSffwGy554PSah Feb 23 '23 at 19:45
  • You are on the right track! – user535733 Feb 24 '23 at 00:05
  • @nobody You really discovered which was the problem! It really was the `aufs storage-driver` support being dropped that got the updates stuck -- the error message that I completely ignored. Would you like to formally provide the answer to this question, that is, to not ignore the `aufs storage-driver` support warning to do `rm -r /var/lib/docker/aufs` plus `apt remove docker.io`? (no need for `apt remove containerd`). – BsAxUbx5KoQDEpCAqSffwGy554PSah Feb 24 '23 at 12:46
  • @user535733 Since the user "nobody" did not want to provide a formal answer, would you like to? It's like he said: the `aufs storage-driver` support was dropped and I needed to do `rm -r /var/lib/docker/aufs` plus `apt remove docker.io`. I did and then was free to use `apt upgrade` again. – BsAxUbx5KoQDEpCAqSffwGy554PSah Mar 16 '23 at 17:35
  • 1
    You are welcome to write the answer to your own question. – user535733 Mar 16 '23 at 17:52
  • +1 for formatting. – Rishon_JR Mar 17 '23 at 15:34

1 Answers1

0

Steps that I used to fix it:

  1. rm -r /var/lib/docker/aufs
  2. apt remove docker.io

Or in one command: rm -r /var/lib/docker/aufs && apt remove docker.io

Rishon_JR
  • 1,019
  • 5
  • 25