4

I messed up my docker install on WSL Linux (Ubuntu 16.04.5 LTS). I have tried uninstalling it but it refuses to budge. Here are issues:

First checking if docker exists:

$ dpkg -l | grep -i docker
pFR docker-ce                            5:18.09.4~3-0~ubuntu-xenial                amd64        Docker: the open-source application container engine

Trying to remove docker-ce:

$ sudo apt-get purge -y docker-ce
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following packages will be REMOVED:
  docker-ce*
0 upgraded, 0 newly installed, 1 to remove and 146 not upgraded.
1 not fully installed or removed.
After this operation, 85.4 MB disk space will be freed.
dpkg: error processing package docker-ce (--purge):
 package is in a very bad inconsistent state; you should
 reinstall it before attempting a removal
Errors were encountered while processing:
 docker-ce
E: Sub-process /usr/bin/dpkg returned an error code (1)

And the coup de grâce - trying to install any new program:

$ sudo apt-get install sysvbanner
Reading package lists... Done
Building dependency tree
Reading state information... Done
You might want to run 'apt-get -f install' to correct these:
The following packages have unmet dependencies:
 docker-ce : Depends: docker-ce-cli but it is not going to be installed
             Depends: containerd.io (>= 1.2.2-3) but it is not going to be installed
             Recommends: aufs-tools but it is not going to be installed
             Recommends: cgroupfs-mount but it is not going to be installed or
                         cgroup-lite but it is not going to be installed
             Recommends: pigz but it is not going to be installed
E: Unmet dependencies. Try 'apt-get -f install' with no packages (or specify a solution).

And trying to fix the install with apt-get -f install as recommended:

$ sudo apt-get -f install
Reading package lists... Done
Building dependency tree
Reading state information... Done
Correcting dependencies... Done
The following additional packages will be installed:
  containerd.io docker-ce-cli
The following NEW packages will be installed:
  containerd.io docker-ce-cli
0 upgraded, 2 newly installed, 0 to remove and 146 not upgraded.
1 not fully installed or removed.
Need to get 0 B/50.3 MB of archives.
After this operation, 157 MB of additional disk space will be used.
Do you want to continue? [Y/n] y
Selecting previously unselected package docker-ce-cli.
(Reading database ... 69776 files and directories currently installed.)
Preparing to unpack .../docker-ce-cli_5%3a18.09.4~3-0~ubuntu-xenial_amd64.deb ...
Unpacking docker-ce-cli (5:18.09.4~3-0~ubuntu-xenial) ...
Selecting previously unselected package containerd.io.
Preparing to unpack .../containerd.io_1.2.5-1_amd64.deb ...
Unpacking containerd.io (1.2.5-1) ...
Processing triggers for man-db (2.7.5-1) ...
Setting up docker-ce-cli (5:18.09.4~3-0~ubuntu-xenial) ...
Setting up containerd.io (1.2.5-1) ...
dpkg: error processing package docker-ce (--configure):
 package is in a very bad inconsistent state; you should
 reinstall it before attempting configuration
Errors were encountered while processing:
 docker-ce
E: Sub-process /usr/bin/dpkg returned an error code (1)

Pls. halp. If I maybe so informal.

asuprem
  • 554
  • 1
  • 5
  • 17
  • 3
    There is good answer here that might help you: https://stackoverflow.com/questions/48431372/removing-broken-packages-in-ubuntu – Esteban Garcia Apr 16 '19 at 09:24

1 Answers1

-2

I solved the problem with following commands:

sudo apt-get install docker-ce
sudo apt-get purge docker docker.io docker-ce
sudo apt autoremove

then I can install new programs:

sudo apt-get install php -y
风声猎猎
  • 1,065
  • 1
  • 7
  • 9