升级到Ubuntu 17.04后,软件包系统损坏


11

在此处输入图片说明

将我的Ubuntu升级到17.04之后,软件包系统损坏了。当我执行以下任何命令时,出现一些错误。

sudo apt-get --fix-打破安装

$ 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全面升级

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

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

有谁知道如何解决它而无需重新安装Ubuntu?


1
我也有同样的问题。我尝试了此处此处提出的修复程序,但是没有任何效果。
guillaume8375

Answers:


8

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

首先,我去了/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

有效并更新了我的软件包。所有的软件包问题似乎都消失了。


1
命令apt purge返回E: Sub-process /usr/bin/dpkg returned an error code (1)
卡斯珀

@Casper对于每个包装?
guillaume8375

是。好像是
卡斯珀

我还不得不使用aptitude清除依赖项,apt / apt-get命令无法做到这一点askubuntu.com/questions/1085665/…–
baptx

7

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

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

不知道为什么(也许pip的点击版本不同于Ubuntu所依赖的版本?),但这解决了这个问题。


pip3 uninstall click删除了click通过Pip for Python 3安装的模块,这很可能会解决OP提出的软件包安装过程中的问题,因为它是Apt以外的Ubuntu上最常用的Python模块安装方法。另一个选择是,他们使用easyinstall或类似的东西make install
David Foerster

5

首先删除蟒蛇“ 点击 ”使用软件包pip

pip uninstall click

如果您使用python3pip3 uninstall click

然后通过apt修复软件包:

sudo apt clean
sudo apt install -f 

1

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

我做了一个,sudo apt autoremove并指出了未满足依赖关系的软件包:

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

执行没有错误

高温超导


autoremove找不到命令。但是现在我不能apt-get用来安装它。
卡斯珀

0
  • 选项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
      

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

By using our site, you acknowledge that you have read and understand our Cookie Policy and Privacy Policy.
Licensed under cc by-sa 3.0 with attribution required.