![升级到 Ubuntu 17.04 后软件包系统崩溃](https://linux22.com/image/1147111/%E5%8D%87%E7%BA%A7%E5%88%B0%20Ubuntu%2017.04%20%E5%90%8E%E8%BD%AF%E4%BB%B6%E5%8C%85%E7%B3%BB%E7%BB%9F%E5%B4%A9%E6%BA%83.png)
升级 Ubuntu 17.04 后,软件包系统崩溃了。当我执行以下任何命令时,都会出现一些错误。
sudo apt-get --fix-broken 安装
$ 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).
我也尝试过以下解决方案,但是没有效果。
有人知道如何在不重新安装 Ubuntu 的情况下修复它吗?
答案1
我认为我找到了一个解决方案,但也有一个很大的警告:它有效,但我无法解释原因。
首先,我去了/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
它运行正常,并更新了我的软件包。所有软件包问题似乎都消失了。
答案2
升级到 Ubuntu 17.04 后我遇到了同样的问题,这对我有用:
sudo -H pip3 uninstall click
sudo apt install python3-click-package
sudo apt upgrade
sudo apt autoremove
不确定为什么(也许 pip 的点击版本与 Ubuntu 所依赖的版本不同?)但这解决了这个问题。
答案3
首先删除 python'点击' 包使用pip
:
pip uninstall click
如果你使用python3: pip3 uninstall click
然后通过以下方式修复软件包易于:
sudo apt clean
sudo apt install -f
答案4
选项 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
删除已安装的包
cd /var/lib/dpkg/info/ sudo mv click-apparmor:amd64.prerm click-apparmor:amd64.prerm.backup sudo dpkg --force-depends -r click-apparmor
尝试使用以下方法安装新包:
sudo apt -f install
如果有新的错误,请将其添加到问题中。