无法卸载docker-ce(并且无法安装任何新程序)

时间:2019-04-16 05:14:18

标签: docker ubuntu windows-subsystem-for-linux

我搞砸了在WSL Linux(Ubuntu 16.04.5 LTS)上安装的docker。我尝试卸载它,但它拒绝让步。这里是问题:

首先检查docker是否存在:

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

尝试删除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)

政变-尝试安装任何新程序:

$ 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).

并尝试按照建议使用apt-get -f install修复安装:

$ 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)

请。 halp。如果我可能那么非正式。

1 个答案:

答案 0 :(得分:0)

我通过以下命令解决了这个问题:

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

然后我可以安装新程序:

sudo apt-get install php -y