几天前我升级了系统,之后出现了软件包损坏的问题,影响到了 MySQL 和几个库。之后我可以更新,但不能安装、升级、删除或清除软件包,而且我找不到任何方法来解决依赖关系损坏的问题。
我不确定依赖关系中断的问题和 MySQL 的问题是否直接相关,因此我将尝试分别描述这两个问题。
首先,如果我尝试安装软件包或进行升级,我会收到以下消息:
$ sudo apt-get upgrade
Reading package lists... Done
Building dependency tree
Reading state information... Done
You might want to run 'apt-get -f install' to correct these.
The following packages have unmet dependencies:
libsasl2-modules:i386 : Depends: libssl1.0.0:i386 (>= 1.0.0) but it is not installed
skype-bin:i386 : Depends: libssl1.0.0:i386 but it is not installed
E: Unmet dependencies. Try using -f.
如果我使用升级 -f 选项,那么我会得到
$ sudo apt-get -f upgrade
Reading package lists... Done
Building dependency tree
Reading state information... Done
Correcting dependencies... Done
Calculating upgrade... Done
The following NEW packages will be installed:
libssl1.0.0:i386
The following packages will be upgraded:
snapd
1 upgraded, 1 newly installed, 0 to remove and 0 not upgraded.
3 not fully installed or removed.
Need to get 0 B/5,235 kB of archives.
After this operation, 6,545 kB of additional disk space will be used.
Do you want to continue? [Y/n] Y
Preconfiguring packages ...
Setting up mysql-common (5.7.12-0ubuntu1.1) ...
update-alternatives: error: alternative path /etc/mysql/my.cnf.fallback doesn't exist
dpkg: error processing package mysql-common (--configure):
subprocess installed post-installation script returned error exit status 2
Errors were encountered while processing:
mysql-common
E: Sub-process /usr/bin/dpkg returned an error code (1)
通过 Synaptic 查看我发现以下损坏的包裹
libsasl2-modules;i386
skype-bin:i386
如果我尝试删除、重新安装或使用 Synaptic 时遇到任何错误,总是会出现相同的错误消息
E: mysql-common: subprocess installed post-installation script returned error exit status 2
如果我尝试配置 MySQL(理论上安装在最新版本中),那么我会收到以下消息:
$ sudo dpkg --configure -a
Setting up mysql-common (5.7.12-0ubuntu1.1) ...
update-alternatives: error: alternative path /etc/mysql/my.cnf.fallback doesn't exist
dpkg: error processing package mysql-common (--configure):
subprocess installed post-installation script returned error exit status 2
dpkg: dependency problems prevent configuration of mysql-server-5.7:
mysql-server-5.7 depends on mysql-common (>= 5.6.22-1~); however:
Package mysql-common is not configured yet.
mysql-server-5.7 depends on mysql-common (>= 5.5); however:
Package mysql-common is not configured yet.
dpkg: error processing package mysql-server-5.7 (--configure):
dependency problems - leaving unconfigured
dpkg: dependency problems prevent configuration of mysql-server:
mysql-server depends on mysql-server-5.7; however:
Package mysql-server-5.7 is not configured yet.
dpkg: error processing package mysql-server (--configure):
dependency problems - leaving unconfigured
Errors were encountered while processing:
mysql-common
mysql-server-5.7
mysql-server
在升级 MySQL 时,有些事情确实很奇怪。例如,查找文件my.cnf
等my.cnf.fallback
...我意识到这些文件及其文件夹不再存在。我忽略了它们在升级过程中是如何消失的。
当我尝试重新安装 MySQL 时,却没有任何希望,我收到了以下消息:
$ sudo apt-get -f install mysql-common
Reading package lists... Done
Building dependency tree
Reading state information... Done
mysql-common is already the newest version (5.7.12-0ubuntu1.1).
You might want to run 'apt-get -f install' to correct these:
The following packages have unmet dependencies:
libsasl2-modules:i386 : Depends: libssl1.0.0:i386 (>= 1.0.0) but it is not going to be installed
skype-bin:i386 : Depends: libssl1.0.0:i386 but it is not going to be installed
E: Unmet dependencies. Try 'apt-get -f install' with no packages (or specify a solution).
如果我使用清除来卸载它们并从头开始,那么我也会遇到同样的问题
$ sudo apt-get purge mysql-common
Reading package lists... Done
Building dependency tree
Reading state information... Done
You might want to run 'apt-get -f install' to correct these:
The following packages have unmet dependencies:
libmysqlclient18 : Depends: mysql-common (>= 5.5) but it is not going to be installed
libmysqlclient18:i386 : Depends: mysql-common:i386 (>= 5.5)
libmysqlclient20 : Depends: mysql-common (>= 5.5) but it is not going to be installed
libsasl2-modules:i386 : Depends: libssl1.0.0:i386 (>= 1.0.0) but it is not going to be installed
mysql-client-5.7 : Depends: mysql-common (>= 5.5) but it is not going to be installed
mysql-server-5.7 : PreDepends: mysql-common (>= 5.5) but it is not going to be installed
Depends: mysql-common (>= 5.6.22-1~) but it is not going to be installed
skype-bin:i386 : Depends: libssl1.0.0:i386 but it is not going to be installed
E: Unmet dependencies. Try 'apt-get -f install' with no packages (or specify a solution).
如果我尝试,apt-get -f install
那么我就会得到
$ sudo apt-get -f install
[sudo] password for user:
Reading package lists... Done
Building dependency tree
Reading state information... Done
Correcting dependencies... Done
The following additional packages will be installed:
libssl1.0.0:i386
The following NEW packages will be installed:
libssl1.0.0:i386
0 upgraded, 1 newly installed, 0 to remove and 1 not upgraded.
3 not fully installed or removed.
Need to get 0 B/949 kB of archives.
After this operation, 3,207 kB of additional disk space will be used.
Do you want to continue? [Y/n] Y
Preconfiguring packages ...
Setting up mysql-common (5.7.12-0ubuntu1.1) ...
update-alternatives: error: alternative path /etc/mysql/my.cnf.fallback doesn't exist
dpkg: error processing package mysql-common (--configure):
subprocess installed post-installation script returned error exit status 2
Errors were encountered while processing:
mysql-common
E: Sub-process /usr/bin/dpkg returned an error code (1)
有人有想法,我该做什么?
答案1
运行以下命令:
mkdir MYSQL
cd MYSQL
sudo apt-get download mysql-common
ar xvf mysql*
tar xvf dat*
sudo cp ./etc/mysql/my.cnf.fallback /etc/mysql/my.cnf.fallback
sudo dpkg -i mysql*deb
cd
sudo apt-get -f install