升级到Ubuntu 17.04后,程序包系统已损坏

在此处输入图像描述

将我的Ubuntu升级到17.04后,包系统崩溃了。 当我执行以下任何命令时,我遇到了一些错误。

sudo apt-get –fix-broken install

$ sudo apt-get --fix-broken install ... ... ubuntuone-credentials-common unity-plugin-scopes unity-scope- mediascanner2 unity-webapps-qml url-dispatcher usermetricsservice vbetool vlc-nox Use 'sudo apt autoremove' to remove them. The following additional packages will be installed: click-apparmor The following packages will be upgraded: click-apparmor 1 upgraded, 0 newly installed, 0 to remove and 3 not upgraded. Need to get 0 B/10.7 kB of archives. After this operation, 0 B of additional disk space will be used. Do you want to continue? [Y/n] y (Reading database ... 625249 files and directories currently installed.) Preparing to unpack .../click-apparmor_0.3.18_amd64.deb ... Cannot start click due to a conflict with a different locally-installed Python 'click' package. Remove it using Python packaging tools and try again. dpkg: warning: subprocess old pre-removal script returned error exit status 1 dpkg: trying script from the new package instead ... Cannot start click due to a conflict with a different locally-installed Python 'click' package. Remove it using Python packaging tools and try again. dpkg: error processing archive /var/cache/apt/archives/click-apparmor_0.3.18_amd64.deb (--unpack): subprocess new pre-removal script returned error exit status 1 Errors were encountered while processing: /var/cache/apt/archives/click-apparmor_0.3.18_amd64.deb E: Sub-process /usr/bin/dpkg returned an error code (1) 

sudo apt-get全面升级

 $ sudo apt-get full-upgrade Reading package lists... Done Building dependency tree Reading state information... Done You might want to run 'apt --fix-broken install' to correct these. The following packages have unmet dependencies: click-apparmor : Depends: python3-apparmor-click (= 0.3.17) but 0.3.18 is installed E: Unmet dependencies. Try 'apt --fix-broken install' with no packages (or specify a solution). 

我也尝试了以下解决方案,但它们没有用。

  • E:子流程/ usr / bin / dpkg返回错误代码(1)[与谷歌浏览器相关]

任何人都知道如何修复它而无需重新安装Ubuntu?

我想我找到了一个解决方案,但是一个很大的警告:它有效,但我无法解释原因。

首先,我去了/var/lib/dpkg/info/

 cd /var/lib/dpkg/info/ 

然后,我删除了与导致问题的包有关的行。 就我而言,我必须这样做:

 sudo rm -r python3-apparmor-click.* sudo rm -r click-apparmor.* sudo rm -r click.* sudo rm -r ubuntu-app-launch.* sudo rm -r url-dispatcher-tools.* sudo rm -r url-dispatcher:amd64.* sudo rm -r libunity-scopes1.0:amd64 

之后,我打字:

 sudo apt purge python3-apparmor-click sudo apt purge click-apparmor sudo apt purge click sudo apt purge ubuntu-app-launch sudo apt purge url-dispatcher-tools sudo apt purge url-dispatcher:amd64 sudo apt purge libunity-scopes1.0 

之后,

 sudo apt update 

最后,

 sudo apt dist-upgrade 

这工作和更新我的包。 所有包裹问题似乎都消失了。

升级到Ubuntu 17.04后我遇到了同样的问题,这对我有用:

 sudo -H pip3 uninstall click sudo apt install python3-click-package sudo apt upgrade sudo apt autoremove 

不确定为什么(或许pip的点击版本与Ubuntu所依赖的版本不同?)但这解决了这个问题。

首先使用pip删除python’Click’包:

pip uninstall click

如果你使用python3pip3 uninstall click

然后通过apt修复包:

 sudo apt clean sudo apt install -f 

这似乎解决了我的问题(至少我不再收到错误消息):

我做了一个sudo apt autoremove并注意到包含unmet依赖项的包:

 Reading package lists... Done Building dependency tree Reading state information... Done You might want to run 'apt --fix-broken install' to correct these. The following packages have unmet dependencies: bind9-host : Depends: libdns162 (= 1:9.10.3.dfsg.P4-10.1ubuntu4) but 1:9.10.3.dfsg.P4-10.1ubuntu1.4 is installed dnsutils : Depends: libdns162 (= 1:9.10.3.dfsg.P4-10.1ubuntu4) but 1:9.10.3.dfsg.P4-10.1ubuntu1.4 is installed gnome-software : Depends: gnome-software-common (= 3.22.7-0ubuntu3) but 3.20.1+git20170208.0.a34b091-0ubuntu1 is installed gvfs : Depends: gvfs-daemons (>= 1.30.4-0ubuntu1) gvfs-backends : Depends: gvfs-daemons (= 1.30.4-0ubuntu1) gvfs-daemons : Depends: gvfs-libs (= 1.28.2-1ubuntu2) but 1.30.4-0ubuntu1 is installed Depends: gvfs-common (= 1.28.2-1ubuntu2) but 1.30.4-0ubuntu1 is installed E: Unmet dependencies. Try 'apt --fix-broken install' with no packages (or specify a solution). 

然后我去了http://packages.ubuntu.com/并在’搜索’栏中输入了“取决于:”之后的名字并选择了“兴致勃勃”。 然后我下载了我硬件的.deb文件。

接下来,我将所有.deb文件移动到/ var / cache / apt / archives:

 sudo mv *.deb /var/cache/apt/archives 

最后我做了:

 sudo apt --fix-broken install 

执行没有错误

HTH

  • 选项1:查找此外部点击包:

     sudo updatedb locate -ir python.*click 

    然后手动删除它,如果您有疑问,请将输出添加到问题中。

  • 选项2:如果您仍处于问题中提到的那个状态:

     Preparing to unpack .../click-apparmor_0.3.18_amd64.deb ... Cannot start click due to a conflict with a different locally-installed Python 'click' package. Remove it using Python packaging tools and try again. dpkg: warning: subprocess old pre-removal script returned error exit status 1 
    1. 删除已安装的软件包

       cd /var/lib/dpkg/info/ sudo mv click-apparmor:amd64.prerm click-apparmor:amd64.prerm.backup sudo dpkg --force-depends -r click-apparmor 
    2. 尝试使用以下命令安装新包:

       sudo apt -f install 

      如果有问题,请添加新错误。