首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >当Apt报告MariaDB时安装MariaDB有未满足的依赖项或损坏的包

当Apt报告MariaDB时安装MariaDB有未满足的依赖项或损坏的包
EN

Ask Ubuntu用户
提问于 2013-10-26 04:52:53
回答 4查看 26.8K关注 0票数 11

我已经尝试过在这个干净的Ubuntu安装上安装MariaDB,但是我一直收到这个错误,

代码语言:javascript
复制
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 : Depends: mariadb-server-5.5 (= 5.5.33a+maria-1~saucy) 
but it is not going to be installed
E: Unable to correct problems, you have held broken packages.

我按照本指南来尝试并安装它,http://www.unixmen.com/install-lemp-server-nginx-mysql-mariadb-php-ubuntu-13-10-server/

我还遵循了MariaDB下载页面上13.10 https://downloads.mariadb.org/mariadb/repositories/的“官方”指南

但似乎什么都没起作用。

编辑1

我尝试过如何在添加PPA之后解决未满足的依赖关系?如何安装MariaDB?,但是它仍然给了我上面发布的错误。

这是一个新的Ubuntu安装,几乎没有安装任何东西。

编辑2

所有复选框都是更新中的票证。我跑了:

代码语言:javascript
复制
sudo apt-get update && sudo apt-get -f install mariadb-server-5.5"=5.5.33a+maria-1~saucy"

它给了我一个错误:

代码语言:javascript
复制
The following packages have unmet dependencies:
mariadb-server-5.5 : Depends: mariadb-client-5.5 (>= 5.5.33a+maria-1~saucy) 
but it is not going to be installed
Depends: mariadb-server-core-5.5 (>= 5.5.33a+maria-1~saucy) 
but it is not going to be installed
E: Unable to correct problems, you have held broken packages.
EN

回答 4

Ask Ubuntu用户

回答已采纳

发布于 2013-10-27 02:16:31

请参阅马里亚布和Ubuntu Debian存储库之间的版本不匹配

在官方的Ubuntu或Debian存储库中,mysql的版本号--公共库或libmysqlclient --很少比MariaDB存储库中的版本号高,但这种情况已经发生了。无论何时,它都是因为MySQL版本中存在于发行版存储库中但已经修复了MariaDB存储库中的MariaDB版本中的bug而发布的关键bug修复版。如果在尝试安装 时存在上述情况,则会得到如下错误:

代码语言:javascript
复制
The following packages have unmet dependencies:
mariadb-server : Depends: mariadb-server-5.5 but it is not going to be installed
E: Unable to correct problems, you have held broken packages.

解决此问题的一种方法是指定要安装的两个包的确切版本。为此,首先确定受影响包的完整版本号。要做到这一点,一个简单的方法是使用“apt-cache show”:

代码语言:javascript
复制
apt-cache show mysql-common | grep Version
apt-cache show libmysqlclient18 | grep Version

这就是撰写本文时的情况,因为版本号显示为:

代码语言:javascript
复制
Version: 5.5.34-0ubuntu0.13.10.1
Version: 5.5.34+maria-1~saucy

MariaDB页面给出了两个解决方案。

第一解决方案:指定包版本

对于上述每一个版本,您都将得到一个版本列表。MariaDB存储库中的存储库将在版本字符串中包含"mariadb“,并且是您想要的。有了手头的版本号,您就可以通过显式指定版本号来安装MariaDB,如下所示:

代码语言:javascript
复制
apt-get install mariadb-server-5.5 mariadb-client-5.5 \
libmysqlclient18=<version-number> \
mysql-common=<version-number>

这就是

代码语言:javascript
复制
apt-get install mariadb-server-5.5 mariadb-client-5.5 \
 libmysqlclient18=5.5.34+maria-1~saucy \
 mysql-common=5.5.34+maria-1~saucy

注意:更新到5.5.34以反映安装后的2014.01.28 RealPariah的当前版本,您需要保存软件包,直到版本号恢复同步为止。

安装MariaDB之后,只要存在版本号问题,apt-get dist-upgrade就会尝试删除MariaDB,以便安装“升级”的libmysqlclient和mysql通用包。为了防止这种情况发生,你可以保持它们,这样apt就不会试图升级它们。为此,打开一个终端,使用sudo -s成为根,然后输入以下内容:

代码语言:javascript
复制
echo libmysqlclient18 hold | dpkg --set-selections
echo mysql-common hold | dpkg --set-selections

搁置将阻止您升级MariaDB,因此,当您想要删除搁置时,打开一个终端,成为根与'sudo -s',然后输入以下内容:

代码语言:javascript
复制
echo libmysqlclient18 install | dpkg --set-selections
echo mysql-common install | dpkg --set-selections

然后,您将能够正常地升级MariaDB (例如,使用sudo apt-get update; sudo apt-get upgrade)。

如何知道版本号何时匹配?

您可以通过在MariaDB上注册新版本的电子邮件警报来跟踪MariaDB.org版本号。根据网站的说法,这是一个low-traffic announce-only list

此外,当包版本再次同步时,您应该停止在apt中看到一条消息,即只有两个持有的包将被保存,但是所有的mariadb包都将被保存:

代码语言:javascript
复制
The following packages have been kept back:
libmariadbclient18 libmysqlclient18 linux-generic linux-headers-generic
linux-image-generic mariadb-client-5.5 mariadb-client-core-5.5
mariadb-server mariadb-server-5.5 mariadb-server-core-5.5 mysql-common

这表明包号已恢复同步,也可以在synaptic或类似工具中进行检查。

第二个解决方案:固定MariaDB存储库

您可以做的另一件事是将您使用的MariaDB存储库固定起来。这是通过在/etc/apt/preferences.d/下创建一个具有以下内容的文件来完成的:

代码语言:javascript
复制
Package: *
Pin: origin <mirror-domain>
Pin-Priority: 1000

<mirror-domain>替换为您使用的MariaDB镜像的域名。例如,ftp.osuosl.org。在pin文件就位后,来自MariaDB存储库的包将比来自系统存储库的包具有优先级。

您可以找到在系统设置>>软件和更新中使用的镜像名称,或者如果您使用的是Ubuntu的另一种风格,则可以找到Synaptic >>设置>>存储库或cat /etc/apt/sources.list

在这种情况下,Pin-Priority需要大于或等于1000,causes a version to be installed even if this constitutes a downgrade of the package

(有关其他情况下的选项的更多信息,请参见man 5 apt_preferences。)

命名钉扎首选项文件

Note that the file in the /etc/apt/preferences.d directory are parsed in alphanumeric ascending order and need to obey the following naming convention:

The files have either no or "pref" as filename extension and only contain alphanumeric, hyphen (-), undescore (_), and period (.) characters. Otherwise APT will print a notice that it has ignored a file...

(资料来源:man 5 apt_preferences)

所以,这个名字本身并不重要,但是一个好的名字应该是像50_mariadb这样的名字。这将标识所涉及的包,并允许将其他固定首选项文件按处理顺序放置在此文件之后。

票数 17
EN

Ask Ubuntu用户

发布于 2015-02-09 07:35:43

我在Ubuntu14.10中也有类似的问题,从MySQL升级到Maria。也就是说,我会被困在

代码语言:javascript
复制
 libmysqlclient18:amd64 10.0.16+maria-1~utopic (Multi-Arch: no) is not co-installable with libmysqlclient18 which has multiple installed instances

在遵循这些建议但没有结果之后,下面的建议对我帮助很大:Ubuntu中如何用MySQL替换马里aDB by JournalXtra。

编辑/var/lib/dpkg/status并删除libmysqlclient18的两个实例如下:

代码语言:javascript
复制
Package: libmysqlclient18
Status: deinstall ok config-files
Priority: optional
Section: libs
Installed-Size: 3392
Maintainer: Ubuntu Developers <ubuntu-devel-discuss@lists.ubuntu.com>
Architecture: i386
Multi-Arch: same
Source: mysql-5.5
Version: 5.5.40-0ubuntu1
Config-Version: 5.5.40-0ubuntu1
Depends: mysql-common (>= 5.5.40-0ubuntu1), libc6 (>= 2.4), libgcc1 (>= 1:4.1.1), zlib1g (>= 1:1.1.4)
Pre-Depends: multiarch-support
Description: MySQL database client library


MySQL is a fast, stable and true multi-user, multi-threaded SQL database 
server. SQL (Structured Query Language) is the most popular database query 
language in the world. The main goals of MySQL are speed, robustness and
ease of use.


This package includes the client library.
Homepage: http://dev.mysql.com/
Original-Maintainer: Debian MySQL Maintainers <pkg-mysql-maint@lists.alioth.debian.org>

允许我在之后顺利地安装MariaDB。

代码语言:javascript
复制
sudo apt-get install mariadb-server

注意:在此解决方案生效之前,我在多次尝试删除libmariadbclient18libmysqlclient18之后才来到这里。我无法通过apt-get问题,直到这两个被删除,因为他们被报告为坏包之前,我可以尝试任何其他修复。

票数 2
EN

Ask Ubuntu用户

发布于 2021-02-17 08:20:24

为了解决这个问题,我删除了先前安装的mysql。

代码语言:javascript
复制
sudo apt remove mysql-server

然后安装了mariadb服务器。

代码语言:javascript
复制
sudo apt install mariadb-server

这适用于新安装,如果已经运行mysql,请不要尝试此解决方案。

票数 0
EN
页面原文内容由Ask Ubuntu提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://askubuntu.com/questions/365992

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档