从 18.04 升级到 20.04 后,许多“apt”命令失败:
apt-get update
,apt-get remove pritunl-client-gtk
(同样如此purge
)apt-get --fix-broken install
,,apt-get autoremove
。
它们全都失败了:installed pritunl-client-gtk package pre-removal script subprocess was killed by signal (Terminated)
。
以下是一些输出(用 [...] 缩写):
:~$ sudo apt-get update
Hit:1 http://ubuntu.ethz.ch/ubuntu focal InRelease
Ign:2 http://dl.google.com/linux/chrome-remote-desktop/deb stable InRelease
[...]
Get:26 http://ubuntu.ethz.ch/ubuntu focal-security/universe amd64 DEP-11 Metadata [55.7 kB]
Fetched 3,242 kB in 2s (1,802 kB/s)
appstreamcli: symbol lookup error: appstreamcli: undefined symbol: AS_APPSTREAM_METADATA_PATHS
Reading package lists... Done
N: Skipping acquire of configured file 'stable/binary-i386/Packages' as repository 'https://download.docker.com/linux/ubuntu focal InRelease' doesn't support architecture 'i386'
N: Skipping acquire of configured file 'main/binary-i386/Packages' as repository 'https://download.mono-project.com/repo/ubuntu stable-focal InRelease' doesn't support architecture 'i386'
E: Problem executing scripts APT::Update::Post-Invoke-Success 'if /usr/bin/test -w /var/cache/app-info -a -e /usr/bin/appstreamcli; then appstreamcli refresh-cache > /dev/null; fi'
E: Sub-process returned an error code
:~$ sudo apt-get remove pritunl-client-gtk
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following packages were automatically installed and are no longer required:
[...]
Use 'sudo apt autoremove' to remove them.
The following packages will be REMOVED
pritunl-client-gtk
0 to upgrade, 0 to newly install, 1 to remove and 974 not to upgrade.
After this operation, 1,397 kB disk space will be freed.
Do you want to continue? [Y/n]
(Reading database ... 335530 files and directories currently installed.)
Removing pritunl-client-gtk (1.0.1865.25-0ubuntu1~xenial) ...
dpkg: error processing package pritunl-client-gtk (--remove):
installed pritunl-client-gtk package pre-removal script subprocess was killed by signal (Terminated)
dpkg: too many errors, stopping
Errors were encountered while processing:
pritunl-client-gtk
Processing was halted because there were too many errors.
E: Sub-process /usr/bin/dpkg returned an error code (1)
:~$ sudo apt --fix-broken install
Reading package lists... Done
Building dependency tree
Reading state information... Done
Correcting dependencies... Done
The following packages were automatically installed and are no longer required:
[...]
Use 'sudo apt autoremove' to remove them.
The following packages will be REMOVED
pritunl-client-gtk
0 to upgrade, 0 to newly install, 1 to remove and 974 not to upgrade.
After this operation, 1,397 kB disk space will be freed.
Do you want to continue? [Y/n]
(Reading database ... 335530 files and directories currently installed.)
Removing pritunl-client-gtk (1.0.1865.25-0ubuntu1~xenial) ...
dpkg: error processing package pritunl-client-gtk (--remove):
installed pritunl-client-gtk package pre-removal script subprocess was killed by signal (Terminated)
dpkg: too many errors, stopping
Errors were encountered while processing:
pritunl-client-gtk
Processing was halted because there were too many errors.
E: Sub-process /usr/bin/dpkg returned an error code (1)
正如其他问题所建议的,我尝试修复libappstream
:
:~$ dpkg -l '*libappstream*'
Desired=Unknown/Install/Remove/Purge/Hold
| Status=Not/Inst/Conf-files/Unpacked/halF-conf/Half-inst/trig-aWait/Trig-pend
|/ Err?=(none)/Reinst-required (Status,Err: uppercase=bad)
||/ Name Version Architecture Description
+++-========================-============-============-==========================================
ii libappstream-glib8:amd64 0.7.7-2 amd64 GNOME library to access AppStream services
ii libappstream4:amd64 0.12.10-2 amd64 Library to access AppStream services
:~$ sudo apt install --reinstall libappstream4
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.
pritunl-client-gtk : Depends: python-appindicator but it is not installable
E: Unmet dependencies. Try 'apt --fix-broken install' with no packages (or specify a solution).
我已经尝试过--fix-broken install
(见上文),所以我尝试:
~$ sudo apt-get install python-appindicator
Reading package lists... Done
Building dependency tree
Reading state information... Done
Package python-appindicator is not available, but is referred to by another package.
This may mean that the package is missing, has been obsoleted, or
is only available from another source
E: Package 'python-appindicator' has no installation candidate
因此肯定是缺少 python-appindicator 的问题(也建议这里)。我无法判断这是否与终止--remove有关。
问题(回答其中一个可能就足够了):
- 我如何才能找出预移除失败的原因?我可以跳过预移除吗?
- 我如何强制删除一个包(pritunnel-clinet-gtk)?
- 在哪里可以找到
python-appindicator
Ubuntu 20.04?
我发现了几个类似的问题,但它们都没有在预删除过程中失败,因此它们的解决方案似乎不适用,例如这里,这里或者这里。
编辑
根据评论中的要求,这是我的 repo 清单:
:~$ grep -r deb /etc/apt/sources.list /etc/apt/sources.list.d
/etc/apt/sources.list:# deb cdrom:[Ubuntu 18.04.1 LTS _Bionic Beaver_ - Release amd64 (20180725)]/ bionic main restricted
/etc/apt/sources.list:deb http://ubuntu.ethz.ch/ubuntu/ focal main restricted
/etc/apt/sources.list:# deb-src http://gb.archive.ubuntu.com/ubuntu/ bionic main restricted
/etc/apt/sources.list:deb http://ubuntu.ethz.ch/ubuntu/ focal-updates main restricted
/etc/apt/sources.list:# deb-src http://gb.archive.ubuntu.com/ubuntu/ bionic-updates main restricted
/etc/apt/sources.list:deb http://ubuntu.ethz.ch/ubuntu/ focal universe
/etc/apt/sources.list:# deb-src http://gb.archive.ubuntu.com/ubuntu/ bionic universe
/etc/apt/sources.list:deb http://ubuntu.ethz.ch/ubuntu/ focal-updates universe
/etc/apt/sources.list:# deb-src http://gb.archive.ubuntu.com/ubuntu/ bionic-updates universe
/etc/apt/sources.list:deb http://ubuntu.ethz.ch/ubuntu/ focal multiverse
/etc/apt/sources.list:# deb-src http://gb.archive.ubuntu.com/ubuntu/ bionic multiverse
/etc/apt/sources.list:deb http://ubuntu.ethz.ch/ubuntu/ focal-updates multiverse
/etc/apt/sources.list:# deb-src http://gb.archive.ubuntu.com/ubuntu/ bionic-updates multiverse
/etc/apt/sources.list:deb http://ubuntu.ethz.ch/ubuntu/ focal-backports main restricted universe multiverse
/etc/apt/sources.list:# deb-src http://gb.archive.ubuntu.com/ubuntu/ bionic-backports main restricted universe multiverse
/etc/apt/sources.list:# deb http://archive.canonical.com/ubuntu bionic partner
/etc/apt/sources.list:# deb-src http://archive.canonical.com/ubuntu bionic partner
/etc/apt/sources.list:deb http://ubuntu.ethz.ch/ubuntu/ focal-security main restricted
/etc/apt/sources.list:# deb-src http://security.ubuntu.com/ubuntu bionic-security main restricted
/etc/apt/sources.list:deb http://ubuntu.ethz.ch/ubuntu/ focal-security universe
/etc/apt/sources.list:# deb-src http://security.ubuntu.com/ubuntu bionic-security universe
/etc/apt/sources.list:deb http://ubuntu.ethz.ch/ubuntu/ focal-security multiverse
/etc/apt/sources.list:# deb-src http://security.ubuntu.com/ubuntu bionic-security multiverse
/etc/apt/sources.list:# deb http://apt.llvm.org/bionic/ llvm-toolchain-bionic-9 main # disabled on upgrade to focal
/etc/apt/sources.list:# deb-src http://apt.llvm.org/bionic/ llvm-toolchain-bionic-9 main
/etc/apt/sources.list.d/puppet5.list.save:# deb http://apt.puppetlabs.com focal puppet5 # disabled on upgrade to focal
/etc/apt/sources.list.d/puppet5.list.save:# deb-src http://apt.puppetlabs.com bionic puppet5
/etc/apt/sources.list.d/pc_repo.list:# deb https://apt.puppet.com focal puppet5 # disabled on upgrade to focal
/etc/apt/sources.list.d/mono-xamarin.list.distUpgrade:deb https://download.mono-project.com/repo/ubuntu stable-bionic main
/etc/apt/sources.list.d/google-chrome.list.distUpgrade:deb [arch=amd64] http://dl.google.com/linux/chrome/deb/ stable main
/etc/apt/sources.list.d/hnakamur-ubuntu-libarchive-bionic.list.save:# deb http://ppa.launchpad.net/hnakamur/libarchive/ubuntu focal main # disabled on upgrade to focal
/etc/apt/sources.list.d/hnakamur-ubuntu-libarchive-bionic.list.save:# deb-src http://ppa.launchpad.net/hnakamur/libarchive/ubuntu bionic main
/etc/apt/sources.list.d/buildkite-agent.list:# deb https://apt.buildkite.com/buildkite-agent stable main # disabled on upgrade to focal
/etc/apt/sources.list.d/iovisor.list.distUpgrade:deb https://repo.iovisor.org/apt/bionic bionic main
/etc/apt/sources.list.d/vscode.list.save:# deb [arch=amd64] https://packages.microsoft.com/repos/vscode stable main # disabled on upgrade to focal
/etc/apt/sources.list.d/pc_repo.list.save:# deb https://apt.puppet.com focal puppet5 # disabled on upgrade to focal
/etc/apt/sources.list.d/bazel.list.save:deb [arch=amd64] http://storage.googleapis.com/bazel-apt stable jdk1.8
/etc/apt/sources.list.d/docker-ce.list.distUpgrade:deb https://download.docker.com/linux/ubuntu bionic stable
/etc/apt/sources.list.d/google-chrome.list.save:deb [arch=amd64] http://dl.google.com/linux/chrome/deb/ stable main
/etc/apt/sources.list.d/hnakamur-ubuntu-cmake-bionic.list.distUpgrade:deb http://ppa.launchpad.net/hnakamur/cmake/ubuntu bionic main
/etc/apt/sources.list.d/hnakamur-ubuntu-cmake-bionic.list.distUpgrade:# deb-src http://ppa.launchpad.net/hnakamur/cmake/ubuntu bionic main
/etc/apt/sources.list.d/iovisor.list.save:# deb https://repo.iovisor.org/apt/bionic focal main # disabled on upgrade to focal
/etc/apt/sources.list.d/google-cloud-sdk.list:deb http://packages.cloud.google.com/apt cloud-sdk main
/etc/apt/sources.list.d/bluetooth-ubuntu-bluez-bionic.list.save:# deb http://ppa.launchpad.net/bluetooth/bluez/ubuntu focal main # disabled on upgrade to focal
/etc/apt/sources.list.d/bluetooth-ubuntu-bluez-bionic.list.save:# deb-src http://ppa.launchpad.net/bluetooth/bluez/ubuntu bionic main
/etc/apt/sources.list.d/mono-xamarin.list.save:deb https://download.mono-project.com/repo/ubuntu stable-focal main
/etc/apt/sources.list.d/puppet5.list.distUpgrade:deb http://apt.puppetlabs.com bionic puppet5
/etc/apt/sources.list.d/puppet5.list.distUpgrade:# deb-src http://apt.puppetlabs.com bionic puppet5
/etc/apt/sources.list.d/libreoffice-ubuntu-ppa-bionic.list.distUpgrade:deb http://ppa.launchpad.net/libreoffice/ppa/ubuntu bionic main
/etc/apt/sources.list.d/libreoffice-ubuntu-ppa-bionic.list.distUpgrade:# deb-src http://ppa.launchpad.net/libreoffice/ppa/ubuntu bionic main
/etc/apt/sources.list.d/osquery_repo.list.save:# deb [arch=amd64] https://pkg.osquery.io/deb deb main # disabled on upgrade to focal
/etc/apt/sources.list.d/buildkite-agent.list.save:# deb https://apt.buildkite.com/buildkite-agent stable main # disabled on upgrade to focal
/etc/apt/sources.list.d/hnakamur-ubuntu-libzstd-bionic.list.save:# deb http://ppa.launchpad.net/hnakamur/libzstd/ubuntu focal main # disabled on upgrade to focal
/etc/apt/sources.list.d/hnakamur-ubuntu-libzstd-bionic.list.save:# deb-src http://ppa.launchpad.net/hnakamur/libzstd/ubuntu bionic main
/etc/apt/sources.list.d/pc_repo.list.distUpgrade:deb https://apt.puppet.com bionic puppet5
/etc/apt/sources.list.d/chrome-remote-desktop.list.save:deb [arch=amd64] http://dl.google.com/linux/chrome-remote-desktop/deb/ stable main
/etc/apt/sources.list.d/pritunl.list:deb http://repo.pritunl.com/stable/apt xenial main # disabled on upgrade to focal
/etc/apt/sources.list.d/hnakamur-ubuntu-libzstd-bionic.list.distUpgrade:deb http://ppa.launchpad.net/hnakamur/libzstd/ubuntu bionic main
/etc/apt/sources.list.d/hnakamur-ubuntu-libzstd-bionic.list.distUpgrade:# deb-src http://ppa.launchpad.net/hnakamur/libzstd/ubuntu bionic main
/etc/apt/sources.list.d/bazel.list:deb [arch=amd64] http://storage.googleapis.com/bazel-apt stable jdk1.8
/etc/apt/sources.list.d/sbt.list:# deb http://dl.bintray.com/sbt/debian / # disabled on upgrade to focal
/etc/apt/sources.list.d/google-cloud-sdk.list.save:deb http://packages.cloud.google.com/apt cloud-sdk main
/etc/apt/sources.list.d/buildkite-agent.list.distUpgrade:deb https://apt.buildkite.com/buildkite-agent stable main
/etc/apt/sources.list.d/hnakamur-ubuntu-libarchive-bionic.list.distUpgrade:deb http://ppa.launchpad.net/hnakamur/libarchive/ubuntu bionic main
/etc/apt/sources.list.d/hnakamur-ubuntu-libarchive-bionic.list.distUpgrade:# deb-src http://ppa.launchpad.net/hnakamur/libarchive/ubuntu bionic main
/etc/apt/sources.list.d/libreoffice-ubuntu-ppa-bionic.list:# deb http://ppa.launchpad.net/libreoffice/ppa/ubuntu focal main # disabled on upgrade to focal
/etc/apt/sources.list.d/libreoffice-ubuntu-ppa-bionic.list:# deb-src http://ppa.launchpad.net/libreoffice/ppa/ubuntu bionic main
/etc/apt/sources.list.d/mono-xamarin.list:deb https://download.mono-project.com/repo/ubuntu stable-focal main
/etc/apt/sources.list.d/google-cloud-sdk.list.distUpgrade:deb http://packages.cloud.google.com/apt cloud-sdk main
/etc/apt/sources.list.d/osquery_repo.list.distUpgrade:deb [arch=amd64] https://pkg.osquery.io/deb deb main
/etc/apt/sources.list.d/bluetooth-ubuntu-bluez-bionic.list.distUpgrade:deb http://ppa.launchpad.net/bluetooth/bluez/ubuntu bionic main
/etc/apt/sources.list.d/bluetooth-ubuntu-bluez-bionic.list.distUpgrade:# deb-src http://ppa.launchpad.net/bluetooth/bluez/ubuntu bionic main
/etc/apt/sources.list.d/chrome-remote-desktop.list.distUpgrade:deb [arch=amd64] http://dl.google.com/linux/chrome-remote-desktop/deb/ stable main
/etc/apt/sources.list.d/dotnet-sdk.list:# deb [arch=amd64] https://packages.microsoft.com/ubuntu/18.04/prod focal main # disabled on upgrade to focal
/etc/apt/sources.list.d/hnakamur-ubuntu-libzstd-bionic.list:# deb http://ppa.launchpad.net/hnakamur/libzstd/ubuntu focal main # disabled on upgrade to focal
/etc/apt/sources.list.d/hnakamur-ubuntu-libzstd-bionic.list:# deb-src http://ppa.launchpad.net/hnakamur/libzstd/ubuntu bionic main
/etc/apt/sources.list.d/hnakamur-ubuntu-cmake-bionic.list.save:# deb http://ppa.launchpad.net/hnakamur/cmake/ubuntu focal main # disabled on upgrade to focal
/etc/apt/sources.list.d/hnakamur-ubuntu-cmake-bionic.list.save:# deb-src http://ppa.launchpad.net/hnakamur/cmake/ubuntu bionic main
/etc/apt/sources.list.d/dotnet-sdk.list.save:# deb [arch=amd64] https://packages.microsoft.com/ubuntu/18.04/prod focal main # disabled on upgrade to focal
/etc/apt/sources.list.d/clang-format-7.list:# deb [arch=amd64] http://apt.llvm.org/bionic/ llvm-toolchain-bionic-7 main # disabled on upgrade to focal
/etc/apt/sources.list.d/clang-format-7.list.save:# deb [arch=amd64] http://apt.llvm.org/bionic/ llvm-toolchain-bionic-7 main # disabled on upgrade to focal
/etc/apt/sources.list.d/bazel.list.distUpgrade:deb [arch=amd64] http://storage.googleapis.com/bazel-apt stable jdk1.8
/etc/apt/sources.list.d/pritunl.list.save:# deb http://repo.pritunl.com/stable/apt xenial main # disabled on upgrade to focal
/etc/apt/sources.list.d/pritunl.list.distUpgrade:deb http://repo.pritunl.com/stable/apt xenial main
/etc/apt/sources.list.d/hnakamur-ubuntu-cmake-bionic.list:# deb http://ppa.launchpad.net/hnakamur/cmake/ubuntu focal main # disabled on upgrade to focal
/etc/apt/sources.list.d/hnakamur-ubuntu-cmake-bionic.list:# deb-src http://ppa.launchpad.net/hnakamur/cmake/ubuntu bionic main
/etc/apt/sources.list.d/docker-ce.list.save:deb https://download.docker.com/linux/ubuntu focal stable
/etc/apt/sources.list.d/bluetooth-ubuntu-bluez-bionic.list:# deb http://ppa.launchpad.net/bluetooth/bluez/ubuntu focal main # disabled on upgrade to focal
/etc/apt/sources.list.d/bluetooth-ubuntu-bluez-bionic.list:# deb-src http://ppa.launchpad.net/bluetooth/bluez/ubuntu bionic main
/etc/apt/sources.list.d/osquery_repo.list:# deb [arch=amd64] https://pkg.osquery.io/deb deb main # disabled on upgrade to focal
/etc/apt/sources.list.d/puppet5.list:# deb http://apt.puppetlabs.com focal puppet5 # disabled on upgrade to focal
/etc/apt/sources.list.d/puppet5.list:# deb-src http://apt.puppetlabs.com bionic puppet5
/etc/apt/sources.list.d/dotnet-sdk.list.distUpgrade:deb [arch=amd64] https://packages.microsoft.com/ubuntu/18.04/prod bionic main
/etc/apt/sources.list.d/iovisor.list:# deb https://repo.iovisor.org/apt/bionic focal main # disabled on upgrade to focal
/etc/apt/sources.list.d/sbt.list.distUpgrade:deb http://dl.bintray.com/sbt/debian /
/etc/apt/sources.list.d/hnakamur-ubuntu-libarchive-bionic.list:# deb http://ppa.launchpad.net/hnakamur/libarchive/ubuntu focal main # disabled on upgrade to focal
/etc/apt/sources.list.d/hnakamur-ubuntu-libarchive-bionic.list:# deb-src http://ppa.launchpad.net/hnakamur/libarchive/ubuntu bionic main
/etc/apt/sources.list.d/docker-ce.list:deb https://download.docker.com/linux/ubuntu focal stable
/etc/apt/sources.list.d/google-chrome.list:deb [arch=amd64] http://dl.google.com/linux/chrome/deb/ stable main
/etc/apt/sources.list.d/vscode.list:# deb [arch=amd64] https://packages.microsoft.com/repos/vscode stable main # disabled on upgrade to focal
/etc/apt/sources.list.d/sbt.list.save:# deb http://dl.bintray.com/sbt/debian / # disabled on upgrade to focal
/etc/apt/sources.list.d/vscode.list.distUpgrade:deb [arch=amd64] https://packages.microsoft.com/repos/vscode stable main
/etc/apt/sources.list.d/clang-format-7.list.distUpgrade:deb [arch=amd64] http://apt.llvm.org/bionic/ llvm-toolchain-bionic-7 main
/etc/apt/sources.list.d/libreoffice-ubuntu-ppa-bionic.list.save:# deb http://ppa.launchpad.net/libreoffice/ppa/ubuntu focal main # disabled on upgrade to focal
/etc/apt/sources.list.d/libreoffice-ubuntu-ppa-bionic.list.save:# deb-src http://ppa.launchpad.net/libreoffice/ppa/ubuntu bionic main
/etc/apt/sources.list.d/chrome-remote-desktop.list:deb [arch=amd64] http://dl.google.com/linux/chrome-remote-desktop/deb/ stable main
编辑2
我设法pritunl-client-gtk
通过exit 0
在删除脚本的开头插入来卸载:/var/lib/dpkg/info/pritunl-client-gtk.prerm
此后,apt --fix-broken remove
/... install
以及和apt autoremove
一切apt reinstall libappstream4
都正常工作并清理干净。
但是,apt-get update
仍然如上所述失败。
答案1
所以我修复了它。
简而言之,关键部分是
- 识别失败的预移除和插入
exit 0
以跳过它。 - 重新安装所有 libappstream 包。
详细说明(可能不需要全部,但这是我所做的):
- 正如上面“EDIT 2”中所写,我
exit 0
在预删除脚本的开头插入了:/var/lib/dpkg/info/pritunl-client-gtk.prerm
apt --fix-broken remove
apt --fix-broken install
apt autoremove
- 列出 appstream 包:
:~$ dpkg -l | grep -i appstream
ii appstream 0.12.10-2 amd64 Software component metadata management
ii libappstream-glib8:amd64 0.7.16-1ubuntu1 amd64 GNOME library to access AppStream services
ii libappstream4:amd64 0.12.10-2 amd64 Library to access AppStream services
- 然后我
apt reinstall xxx
对这三个分别做了:libappstream4
,,appstream
libappstream-glib8
现在apt-get update
工作正常。
答案2
噢,这么多 ppa。
首先备份您的重要数据。
在
/etc/apt/sources.list.d/docker-ce.list:deb https://download.docker.com/linux/ubuntu focal stable
添加 [arch=amd64]
deb [arch=amd64] https://download.docker.com/linux/ubuntu focal stable
然后删除破坏性的软件包。
sudo dpkg -P pritunl-client-gtk
只有这个工作才有效。
sudo apt update && sudo apt-get clean && sudo apt-get autoclean
第二个命令删除部分下载的软件包,第三个命令删除 /var/cache/apt/archives 中无法再下载且基本无用的软件包
sudo dpkg --configure -a && sudo apt -f install
如果你很幸运并且这个方法可行那么请准备好升级
sudo apt full-upgrade