![mysql-server-5.5 每次运行 apt-get 时未满足的依赖关系](https://linux22.com/image/78646/mysql-server-5.5%20%E6%AF%8F%E6%AC%A1%E8%BF%90%E8%A1%8C%20apt-get%20%E6%97%B6%E6%9C%AA%E6%BB%A1%E8%B6%B3%E7%9A%84%E4%BE%9D%E8%B5%96%E5%85%B3%E7%B3%BB.png)
每次我运行“sudo apt-get install package-name”时,即使我尝试安装除 mysql 之外的其他软件包,也会发生以下错误:
You might want to run 'apt-get -f install' to correct these:
The following packages have unmet dependencies:
mysql-server-5.5 : Depends: mysql-server-core-5.5 (= 5.5.44-0ubuntu0.12.04.1) but 5.5.46-0ubuntu0.12.04.2 is to be installed
E: Unmet dependencies. Try 'apt-get -f install' with no packages (or specify a solution).
例如:当我下载 mysql-5.5.44 并尝试通过运行“cmake .”来安装它时,它告诉我 cmake 尚未安装。当我运行“sudo apt-get install cmake”时,发生以下错误。
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:
cmake : Depends: libxmlrpc-core-c3 but it is not going to be installed
Depends: cmake-data (= 2.8.7-0ubuntu5) but it is not going to be installed
mysql-server-5.5 : Depends: mysql-server-core-5.5 (= 5.5.44-0ubuntu0.12.04.1) but 5.5.46-0ubuntu0.12.04.2 is to be installed
E: Unmet dependencies. Try 'apt-get -f install' with no packages (or specify a solution).
更新
在这个网站上发现了很多类似的问题,但仍然陷入问题。我的来源列表:
# deb cdrom:[Ubuntu 12.04.2 LTS _Precise Pangolin_ - Release amd64 (20130213)]/ dists/precise/main/binary-i386/
# deb cdrom:[Ubuntu 12.04.2 LTS _Precise Pangolin_ - Release amd64 (20130213)]/ dists/precise/restricted/binary-i386/
# deb cdrom:[Ubuntu 12.04.2 LTS _Precise Pangolin_ - Release amd64 (20130213)]/ precise main restricted
# See http://help.ubuntu.com/community/UpgradeNotes for how to upgrade to
# newer versions of the distribution.
deb http://ca.archive.ubuntu.com/ubuntu/ precise main restricted
deb-src http://ca.archive.ubuntu.com/ubuntu/ precise main restricted
## Major bug fix updates produced after the final release of the
## distribution.
deb http://ca.archive.ubuntu.com/ubuntu/ precise-updates main restricted
deb-src http://ca.archive.ubuntu.com/ubuntu/ precise-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://ca.archive.ubuntu.com/ubuntu/ precise universe
deb-src http://ca.archive.ubuntu.com/ubuntu/ precise universe
deb http://ca.archive.ubuntu.com/ubuntu/ precise-updates universe
deb-src http://ca.archive.ubuntu.com/ubuntu/ precise-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://ca.archive.ubuntu.com/ubuntu/ precise multiverse
deb-src http://ca.archive.ubuntu.com/ubuntu/ precise multiverse
deb http://ca.archive.ubuntu.com/ubuntu/ precise-updates multiverse
deb-src http://ca.archive.ubuntu.com/ubuntu/ precise-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 http://security.ubuntu.com/ubuntu precise-security main restricted
deb-src http://security.ubuntu.com/ubuntu precise-security main restricted
deb http://security.ubuntu.com/ubuntu precise-security universe
deb-src http://security.ubuntu.com/ubuntu precise-security universe
deb http://security.ubuntu.com/ubuntu precise-security multiverse
deb-src http://security.ubuntu.com/ubuntu precise-security multiverse
## Uncomment the following two lines to add software from Canonical's
## 'partner' repository.
## 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 precise partner
# deb-src http://archive.canonical.com/ubuntu precise partner
## This software is not part of Ubuntu, but is offered by third-party
## developers who want to ship their latest software.
deb http://extras.ubuntu.com/ubuntu precise main
deb-src http://extras.ubuntu.com/ubuntu precise main
deb http://ubunturepo.internal/orgname precise/devgroup/devel main
deb http://archive.canonical.com/ precise partner
deb-src http://archive.canonical.com/ precise partner
运行输出: apt-cache policy cmake libxmlrpc-core-c3 cmake-data mysql-server-5.5 mysql-server-core-5.5
cmake:
Installed: (none)
Candidate: 2.8.7-0ubuntu5
Version table:
2.8.7-0ubuntu5 0
500 http://ca.archive.ubuntu.com/ubuntu/ precise-updates/main amd64 Packages
2.8.7-0ubuntu4 0
500 http://ca.archive.ubuntu.com/ubuntu/ precise/main amd64 Packages
libxmlrpc-core-c3:
Installed: (none)
Candidate: 1.16.33-3.1ubuntu5.1
Version table:
1.16.33-3.1ubuntu5.1 0
500 http://ca.archive.ubuntu.com/ubuntu/ precise-updates/main amd64 Packages
500 http://security.ubuntu.com/ubuntu/ precise-security/main amd64 Packages
1.16.33-3.1ubuntu5 0
500 http://ca.archive.ubuntu.com/ubuntu/ precise/main amd64 Packages
cmake-data:
Installed: (none)
Candidate: 2.8.7-0ubuntu5
Version table:
2.8.7-0ubuntu5 0
500 http://ca.archive.ubuntu.com/ubuntu/ precise-updates/main amd64 Packages
2.8.7-0ubuntu4 0
500 http://ca.archive.ubuntu.com/ubuntu/ precise/main amd64 Packages
mysql-server-5.5:
Installed: 5.5.44-0ubuntu0.12.04.1
Candidate: 5.5.46-0ubuntu0.12.04.2
Version table:
5.5.46-0ubuntu0.12.04.2 0
500 http://ca.archive.ubuntu.com/ubuntu/ precise-updates/main amd64 Packages
500 http://security.ubuntu.com/ubuntu/ precise-security/main amd64 Packages
*** 5.5.44-0ubuntu0.12.04.1 0
100 /var/lib/dpkg/status
5.5.22-0ubuntu1 0
500 http://ca.archive.ubuntu.com/ubuntu/ precise/main amd64 Packages
mysql-server-core-5.5:
Installed: 5.5.46-0ubuntu0.12.04.2
Candidate: 5.5.46-0ubuntu0.12.04.2
Version table:
*** 5.5.46-0ubuntu0.12.04.2 0
500 http://ca.archive.ubuntu.com/ubuntu/ precise-updates/main amd64 Packages
500 http://security.ubuntu.com/ubuntu/ precise-security/main amd64 Packages
100 /var/lib/dpkg/status
5.5.22-0ubuntu1 0
500 http://ca.archive.ubuntu.com/ubuntu/ precise/main amd64 Packages
更新 我将以下内容添加到 source.list:
deb http://ca.archive.ubuntu.com/ubuntu/ precise-updates/main amd64 Packages
deb-src http://ca.archive.ubuntu.com/ubuntu/ precise-updates/main amd64 Packages
deb http://security.ubuntu.com/ubuntu/ precise-security/main amd64 Packages
deb-src http://security.ubuntu.com/ubuntu/ precise-security/main amd64 Packages
然后,运行 apt-get update。错误是:
W: Failed to fetch http://security.ubuntu.com/ubuntu/dists/precise-security/main/amd64/source/Sources 404 Not Found [IP: 91.189.91.13 80]
W: Failed to fetch http://security.ubuntu.com/ubuntu/dists/precise-security/main/Packages/source/Sources 404 Not Found [IP: 91.189.91.13 80]
W: Failed to fetch http://security.ubuntu.com/ubuntu/dists/precise-security/main/amd64/binary-amd64/Packages 404 Not Found [IP: 91.189.91.13 80]
W: Failed to fetch http://security.ubuntu.com/ubuntu/dists/precise-security/main/Packages/binary-amd64/Packages 404 Not Found [IP: 91.189.91.13 80]
W: Failed to fetch http://security.ubuntu.com/ubuntu/dists/precise-security/main/amd64/binary-i386/Packages 404 Not Found [IP: 91.189.91.13 80]
W: Failed to fetch http://security.ubuntu.com/ubuntu/dists/precise-security/main/Packages/binary-i386/Packages 404 Not Found [IP: 91.189.91.13 80]
W: Failed to fetch http://ca.archive.ubuntu.com/ubuntu/dists/precise-updates/main/amd64/source/Sources 404 Not Found [IP: 91.189.91.14 80]
W: Failed to fetch http://ca.archive.ubuntu.com/ubuntu/dists/precise-updates/main/Packages/source/Sources 404 Not Found [IP: 91.189.91.14 80]
W: Failed to fetch http://ca.archive.ubuntu.com/ubuntu/dists/precise-updates/main/amd64/binary-amd64/Packages 404 Not Found [IP: 91.189.91.14 80]
W: Failed to fetch http://ca.archive.ubuntu.com/ubuntu/dists/precise-updates/main/Packages/binary-amd64/Packages 404 Not Found [IP: 91.189.91.14 80]
W: Failed to fetch http://ca.archive.ubuntu.com/ubuntu/dists/precise-updates/main/amd64/binary-i386/Packages 404 Not Found [IP: 91.189.91.14 80]
W: Failed to fetch http://ca.archive.ubuntu.com/ubuntu/dists/precise-updates/main/Packages/binary-i386/Packages 404 Not Found [IP: 91.189.91.14 80]
E: Some index files failed to download. They have been ignored, or old ones used instead.
答案1
通常第一步是:
sudo apt-get install mysql-server=5.5.46-0ubuntu0.12.04.2 mysql-server-5.5=5.5.46-0ubuntu0.12.04.2
但不是你的情况,因此
apt-get download mysql-server mysql-server-5.5
sudo dpkg -i --force-all mysql-server*.deb