我正在使用 Debian 9.5,最近卸载了一个软件包 ( mariadb
),现在当我尝试安装新软件包时,我不断收到以下消息:
E: Unable to correct problems, you have held broken packages.
我已经尝试过这些命令但没有结果:
sudo dpkg --configure -a
sudo apt-get install -f
apt-get install --fix-broken
我还运行了此命令来显示损坏的软件包,但它没有显示任何内容:
apt-mark showhold
即使当我尝试运行 sudo 时apt-get upgrade
我也会得到这个:
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
然后我能够安装 aptitude 包管理器(不知道如何),并尝试安装新包,sudo aptitude install mysql-server
它显示了一些内容:
The following packages have unmet dependencies:
libdbi-perl : Depends: perlapi-5.24.1 which is a virtual package, provided by:
- perl-base (5.24.1-3+deb9u4), but 5.26.2-7 is installed
libfcgi-perl : Depends: perlapi-5.24.1 which is a virtual package, provided by:
- perl-base (5.24.1-3+deb9u4), but 5.26.2-7 is installed
libterm-readkey-perl : Depends: perlapi-5.24.1 which is a virtual package, provided by:
- perl-base (5.24.1-3+deb9u4), but 5.26.2-7 is installed
libdbd-mysql-perl : Depends: perlapi-5.24.1 which is a virtual package, provided by:
- perl-base (5.24.1-3+deb9u4), but 5.26.2-7 is installed
The following actions will resolve these dependencies:
Keep the following packages at their current version:
1) default-mysql-server [Not Installed]
2) libcgi-fast-perl [Not Installed]
3) libdbd-mysql-perl [Not Installed]
4) libdbi-perl [Not Installed]
5) libfcgi-perl [Not Installed]
6) libterm-readkey-perl [Not Installed]
7) mariadb-server-10.1 [Not Installed]
8) mysql-server [Not Installed]
Leave the following dependencies unresolved:
9) libcgi-pm-perl recommends libcgi-fast-perl (>= 1:2.01)
10) mariadb-client-10.1 recommends libdbd-mysql-perl (>= 1.2202)
11) mariadb-client-10.1 recommends libdbi-perl
12) mariadb-client-10.1 recommends libterm-readkey-perl
这是的输出apt policy pearl-base
:
perl-base:
Installed: 5.26.2-7
Candidate: 5.26.2-7
Version table:
*** 5.26.2-7 500
500 http://ftp.us.debian.org/debian testing/main amd64 Packages
100 /var/lib/dpkg/status
5.24.1-3+deb9u4 500
500 http://httpredir.debian.org/debian stretch/main amd64 Packages
500 http://ftp.de.debian.org/debian stretch/main amd64 Packages
500 http://deb.debian.org/debian stretch/main amd64 Packages
答案1
您的存储库中有测试,优先级为 500,与稳定存储库相同;这实际上意味着您正在运行 Debian 测试,而不是 Debian 9.5。 (感谢您帮助测试 Debian 的下一个版本!)
mysql-server
目前在测试中不可用,因此apt install mysql-server
(或其变体)尝试在 Debian stable 中安装该版本;但这需要 Perl 的 Debian 稳定版,而不是 Debian 测试版,因此安装无法继续。
为了解决这个问题,我建议恢复到 Debian 稳定版。如果你想继续测试,你必须等待 MySQL 迁移到那里,或者切换到混合测试/不稳定设置。