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).
19
  • 2
    Please add sudo apt update to your question. And also apt-cache policy containerd docker.io
    – nobody
    Feb 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 at 16:34
  • 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 at 19:03
  • 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 at 19:28
  • 1
    Oh that's not so good it seems you have to migrate your containers. But i can not help further. askubuntu.com/questions/1361206/…
    – nobody
    Feb 23 at 19:28

1 Answer 1

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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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