如果我尝试在 ubuntu 中安装任何软件包(例如 dart),则会收到以下错误:
sudo apt-get install dart
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:
libwxgtk2.8-0 : Depends: libpng12-0 (>= 1.2.13-4) but it is not going to be installed
E: Unmet dependencies. Try 'apt --fix-broken install' with no packages (or specify a solution).
如果我尝试安装 fix-broken,那么
sudo apt --fix-broken install
Reading package lists... Done
Building dependency tree
Reading state information... Done
Correcting dependencies... Done
The following additional packages will be installed:
libpng12-0
The following NEW packages will be installed:
libpng12-0
0 upgraded, 1 newly installed, 0 to remove and 78 not upgraded.
3 not fully installed or removed.
Need to get 0 B/117 kB of archives.
After this operation, 312 kB of additional disk space will be used.
Do you want to continue? [Y/n] y
(Reading database ... 219006 files and directories currently installed.)
Preparing to unpack .../libpng12-0_1.2.50-1ubuntu2_amd64.deb ...
Unpacking libpng12-0:amd64 (1.2.50-1ubuntu2) ...
dpkg: error processing archive /var/cache/apt/archives/libpng12-0_1.2.50-1ubuntu
2_amd64.deb (--unpack):
unable to install new version of '/lib/x86_64-linux-gnu/libpng12.so.0': No such
file or directory
No apport report written because the error message indicates an issue on the loc
al system
Errors were encountered while processing:
/var/cache/apt/archives/libpng12-0_1.2.50-1ubuntu2_amd64.deb
E: Sub-process /usr/bin/dpkg returned an error code (1)
我甚至尝试安装缺少的依赖项,但没有效果
sudo apt update
Hit:1 http://oem.archive.canonical.com focal InRelease
Hit:2 http://dell.archive.canonical.com focal InRelease
Ign:3 https://storage.googleapis.com/download.dartlang.org/linux/debian stable InRelease
Hit:4 https://download.docker.com/linux/ubuntu focal InRelease
Hit:5 http://dl.google.com/linux/chrome/deb stable InRelease
Hit:6 http://archive.canonical.com/ubuntu focal InRelease
Hit:7 https://repo.pritunl.com/stable/apt focal InRelease
Hit:8 http://archive.ubuntu.com/ubuntu focal InRelease
Hit:9 https://storage.googleapis.com/download.dartlang.org/linux/debian stable Release
Ign:10 http://binaries.erlang-solutions.com/debian focal InRelease
Hit:11 http://archive.ubuntu.com/ubuntu focal-updates InRelease
Hit:12 http://ppa.launchpad.net/somerville-dla-team/ppa/ubuntu bionic InRelease
Hit:13 http://security.ubuntu.com/ubuntu focal-security InRelease
Hit:14 http://binaries.erlang-solutions.com/debian focal Release
Hit:15 http://archive.ubuntu.com/ubuntu focal-backports InRelease
Hit:16 http://deb.anydesk.com all InRelease
Hit:17 http://apt.postgresql.org/pub/repos/apt focal-pgdg InRelease
Ign:19 http://archive.ubuntu.com/ubuntu trusty InRelease
Hit:20 http://archive.ubuntu.com/ubuntu trusty Release
Reading package lists... Done
Building dependency tree
Reading state information... Done
78 packages can be upgraded. Run 'apt list --upgradable' to see them.
N: Skipping acquire of configured file 'main/binary-i386/Packages' as repository 'http://apt.postgresql.org/pub/repos/apt focal-pgdg InRelease' doesn't support architecture 'i386'
sudo apt 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:
libwxgtk2.8-0 : Depends: libpng12-0 (>= 1.2.13-4) but it is not installed
E: Unmet dependencies. Try 'apt --fix-broken install' with no packages (or specify a solution).
cat /etc/apt/sources.list
# See http://help.ubuntu.com/community/UpgradeNotes for how to upgrade to
# newer versions of the distribution.
deb http://archive.ubuntu.com/ubuntu/ focal main restricted
# deb-src http://archive.ubuntu.com/ubuntu/ focal main restricted
## Major bug fix updates produced after the final release of the
## distribution.
deb http://archive.ubuntu.com/ubuntu/ focal-updates main restricted
# deb-src http://archive.ubuntu.com/ubuntu/ focal-updates main restricted
## N.B. software from this repository is ENTIRELY UNSUPPORTED by the Ubuntu
## team. Also, please note that software in universe WILL NOT receive any
## review or updates from the Ubuntu security team.
deb http://archive.ubuntu.com/ubuntu/ focal universe
# deb-src http://archive.ubuntu.com/ubuntu/ focal universe
deb http://archive.ubuntu.com/ubuntu/ focal-updates universe
# deb-src http://archive.ubuntu.com/ubuntu/ focal-updates universe
## N.B. software from this repository is ENTIRELY UNSUPPORTED by the Ubuntu
## team, and may not be under a free licence. Please satisfy yourself as to
## your rights to use the software. Also, please note that software in
## multiverse WILL NOT receive any review or updates from the Ubuntu
## security team.
deb http://archive.ubuntu.com/ubuntu/ focal multiverse
# deb-src http://archive.ubuntu.com/ubuntu/ focal multiverse
deb http://archive.ubuntu.com/ubuntu/ focal-updates multiverse
# deb-src http://archive.ubuntu.com/ubuntu/ focal-updates multiverse
## N.B. software from this repository may not have been tested as
## extensively as that contained in the main release, although it includes
## newer versions of some applications which may provide useful features.
## Also, please note that software in backports WILL NOT receive any review
## or updates from the Ubuntu security team.
# deb-src http://archive.ubuntu.com/ubuntu/ focal-backports main restricted universe multiverse
## This software is not part of Ubuntu, but is offered by Canonical and the
## respective vendors as a service to Ubuntu users.
deb http://archive.canonical.com/ubuntu focal partner
# deb-src http://archive.canonical.com/ubuntu focal partner
deb http://security.ubuntu.com/ubuntu focal-security main restricted
# deb-src http://security.ubuntu.com/ubuntu focal-security main restricted
deb http://security.ubuntu.com/ubuntu focal-security universe
# deb-src http://security.ubuntu.com/ubuntu focal-security universe
deb http://security.ubuntu.com/ubuntu focal-security multiverse
# deb-src http://security.ubuntu.com/ubuntu focal-security multiverse
deb http://archive.ubuntu.com/ubuntu/ focal-backports restricted multiverse universe main
答案1
看来您已将trusty
存储库添加到系统中。需要删除这些存储库,因为添加来自其他 Ubuntu 版本的源可能会破坏软件包管理,并会阻止您更新或添加新软件。
备份/etc/apt/sources.list
,然后编辑该文件,删除包含 的行。您也可以通过在行前trusty
添加 来“注释掉”个别行。注释行将在您的源列表中被忽略。#
如果您没有看到任何trusty
行/etc/apt/sources.list
,它们可能位于.list
下的另一个文件中/etc/apt/
。
或者,您可以在 GUI 软件中心查看和禁用源。
完成此操作后,您应该运行sudo apt update
,然后使用 重试,sudo apt --fix-broken install
然后sudo apt upgrade
。如果这解决了错误并使您的系统保持最新状态,您应该能够安装新软件。