使用 Debian 9.5,全新安装。我想安装mysql-server,但遇到了依赖问题。
sudo apt-get install mysql-server
Reading package lists... Done
Building dependency tree
Reading state information... Done
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:
The following packages have unmet dependencies:
mysql-server : Depends: default-mysql-server but it is not going to be installed
E: Unable to correct problems, you have held broken packages.
apt-get install mysql-server default-mysql-server
Reading package lists... Done
Building dependency tree
Reading state information... Done
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:
The following packages have unmet dependencies:
default-mysql-server : Depends: mariadb-server-10.1 but it is not going to be installed
E: Unable to correct problems, you have held broken packages.
sudo apt-get install mysql-server default-mysql-server mariadb-server-10.1
Reading package lists... Done
Building dependency tree
Reading state information... Done
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:
The following packages have unmet dependencies:
mariadb-server-10.1 : Depends: libdbi-perl but it is not going to be installed
Recommends: libhtml-template-perl but it is not going to be installed
E: Unable to correct problems, you have held broken packages.
sudo apt-get install mysql-server default-mysql-server mariadb-server-10.1 libhtml-template-perl
Reading package lists... Done
Building dependency tree
Reading state information... Done
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:
The following packages have unmet dependencies:
libhtml-template-perl : Depends: libcgi-pm-perl but it is not going to be installed or
perl (< 5.19) but 5.26.2-7 is to be installed
mariadb-server-10.1 : Depends: libdbi-perl but it is not going to be installed
E: Unable to correct problems, you have held broken packages.
sudo apt-get install mysql-server default-mysql-server mariadb-server-10.1 libdbi-perl
Reading package lists... Done
Building dependency tree
Reading state information... Done
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:
The following packages have unmet dependencies:
libdbi-perl : Depends: perlapi-5.24.1
E: Unable to correct problems, you have held broken packages.
编辑1 apt-cache policy
::
apt-cache policy
Package files:
100 /var/lib/dpkg/status
release a=now
500 http://security.debian.org/debian-security stretch/updates/contrib amd64 Packages
release v=9,o=Debian,a=stable,n=stretch,l=Debian-Security,c=contrib,b=amd64
origin security.debian.org
500 http://security.debian.org/debian-security stretch/updates/main amd64 Packages
release v=9,o=Debian,a=stable,n=stretch,l=Debian-Security,c=main,b=amd64
origin security.debian.org
500 http://deb.debian.org/debian stretch-updates/main amd64 Packages
release o=Debian,a=stable-updates,n=stretch-updates,l=Debian,c=main,b=amd64
origin deb.debian.org
500 http://deb.debian.org/debian stretch/main amd64 Packages
release v=9.5,o=Debian,a=stable,n=stretch,l=Debian,c=main,b=amd64
origin deb.debian.org
Pinned packages:
apt policy perl perl-base
编辑2 ::
apt policy perl perl-base
perl:
Installed: 5.26.2-7
Candidate: 5.26.2-7
Version table:
*** 5.26.2-7 100
100 /var/lib/dpkg/status
5.24.1-3+deb9u4 500
500 http://deb.debian.org/debian stretch/main amd64 Packages
500 http://security.debian.org/debian-security stretch/updates/main amd64 Packages
perl-base:
Installed: 5.26.2-7
Candidate: 5.26.2-7
Version table:
*** 5.26.2-7 100
100 /var/lib/dpkg/status
5.24.1-3+deb9u4 500
500 http://deb.debian.org/debian stretch/main amd64 Packages
500 http://security.debian.org/debian-security stretch/updates/main amd64 Packages
如何解决这些依赖问题?
如您的
apt policy perl perl-base
输出所示,并由jordanm指出,您的系统具有 Perl 的 Buster 版本,而不是 Debian 9 版本。所以你的系统并不是真正的 Debian 9.5 的“全新安装”;并且由于 Perl 是 Debian 设置中如此重要的组件,因此很可能还有许多其他软件包已升级到 Buster 版本。这种 Perl 不匹配是您无法安装 MySQL 软件包的原因。
我假设这是最近安装的,因此您没有太多投资;因此,jordanm建议重新安装可能是这种情况下的最佳解决方案。Debian 9 和 Buster 有很大的不同,因此回滚可能会变得相当复杂,尤其是在您升级 Perl 之后。删除
mc
肯定是不够的。以后不要混用稳定版和测试版。如果您遇到阻止您使用包的错误,请提交错误 (
reportbug mc
);如果它足够严重,它可能有资格获得稳定的更新。您也可以要求反向移植;这将为您提供当前的 Buster 版本mc
,为 Debian 9 重建。我根据接受的解决方案成功执行了以下命令:
结果:
sudo apt install mysql-server 正在读取包列表...完成构建依赖关系树
读取状态信息...完成某些包无法安装。这可能意味着您请求了一种不可能的情况,或者如果您使用的是不稳定的发行版,一些必需的软件包尚未创建或已从 Incoming 中移出。以下信息可能有助于解决这种情况:
以下软件包具有未满足的依赖关系: mysql-server :依赖:mysql-server-8.0 但不会安装 E:无法纠正问题,您持有损坏的软件包。raja@raja-latitudee6400:~$ mysql-server default-mysql-server bash: mysql-server: command not found