强制删除 Ubuntu 16.04.2 LTS 上的损坏软件包

强制删除 Ubuntu 16.04.2 LTS 上的损坏软件包

$ dpkg -l | grep php7.0-cgi

ri php7.0-cgi 7.0.13-0ubuntu0.16.04.1 amd64 server-side, HTML-embedded scripting language (CGI binary)

$ apt-get purge php7.0-cgi

Reading package lists... Done Building dependency tree
Reading state information... Done The following packages were automatically installed and are no longer required: libc-dev-bin libice-dev libice6 libjbig-dev liblzma-dev libpthread-stubs0-dev libsm-dev libsm6 libtiffxx5 libvpx-dev libx11-dev libx11-doc libxau-dev libxcb1-dev libxdmcp-dev libxpm-dev libxt-dev libxt6 pkg-config x11-common x11proto-core-dev x11proto-input-dev x11proto-kb-dev xorg-sgml-doctools xtrans-dev Use 'sudo apt autoremove' to remove them. The following packages will be REMOVED: php7.0-cgi* 0 upgraded, 0 newly installed, 1 to remove and 0 not upgraded. After this operation, 8,658 kB disk space will be freed. Do you want to continue? [Y/n] y (Reading database ... 72987 files and directories currently installed.) Removing php7.0-cgi (7.0.13-0ubuntu0.16.04.1) ... ERROR: Conf php7.0-cgi does not exist! dpkg: error processing package php7.0-cgi (--purge): subprocess installed pre-removal script returned error exit status 1 Errors were encountered while processing: php7.0-cgi E: Sub-process /usr/bin/dpkg returned an error code (1)

$ apt-get 安装 php7.0-cgi

Reading package lists... Done Building dependency tree Reading state information... Done php7.0-cgi is already the newest version (7.0.13-0ubuntu0.16.04.1). The following packages were automatically installed and are no longer required: libc-dev-bin libice-dev libice6 libjbig-dev liblzma-dev libpthread-stubs0-dev libsm-dev libsm6 libtiffxx5 libvpx-dev libx11-dev libx11-doc libxau-dev libxcb1-dev libxdmcp-dev libxpm-dev libxt-dev libxt6 pkg-config x11-common x11proto-core-dev x11proto-input-dev x11proto-kb-dev xorg-sgml-doctools xtrans-dev Use 'sudo apt autoremove' to remove them. 0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.

$ dpkg --remove --force-remove-reinstreq php7.0-cgi

(Reading database ... 72987 files and directories currently installed.) Removing php7.0-cgi (7.0.13-0ubuntu0.16.04.1) ... ERROR: Conf php7.0-cgi does not exist! dpkg: error processing package php7.0-cgi (--remove): subprocess installed pre-removal script returned error exit status 1 Errors were encountered while processing: php7.0-cgi

我该如何php7.0-cgi移除它以便执行全新安装?该软件包似乎已损坏,因为它的行为不符合预期。

答案1

sudo apt-get install -f 应删除软件包并允许全新安装。也可以尝试 sudo apt autoremove。

在这里阅读更多内容:https://help.ubuntu.com/community/AptGet/Howto?action=show&redirect=AptGetHowto

相关内容