认识到这基本上是一个常见问题解答:
nicholas@mordor:~$
nicholas@mordor:~$ sudo apt --fix-broken install
Reading package lists... Done
Building dependency tree
Reading state information... Done
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
nicholas@mordor:~$
nicholas@mordor:~$ sudo apt autoremove
Reading package lists... Done
Building dependency tree
Reading state information... Done
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
nicholas@mordor:~$
nicholas@mordor:~$ sudo dpkg --get-selections | grep hold
nicholas@mordor:~$
nicholas@mordor:~$ sudo apt install mariadb-server mariadb-client
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 resolve the situation:
The following packages have unmet dependencies:
mariadb-server : Depends: mariadb-server-10.3 (>= 1:10.3.25-0ubuntu0.20.04.1) but it is not going to be installed
E: Unable to correct problems, you have held broken packages.
nicholas@mordor:~$
nicholas@mordor:~$ sudo apt upgrade
Reading package lists... Done
Building dependency tree
Reading state information... Done
Calculating upgrade... Done
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
nicholas@mordor:~$
nicholas@mordor:~$ sudo apt update
Hit:1 http://ca.archive.ubuntu.com/ubuntu focal InRelease
Hit:2 http://ca.archive.ubuntu.com/ubuntu focal-updates InRelease
Hit:3 http://ca.archive.ubuntu.com/ubuntu focal-backports InRelease
Hit:4 http://security.ubuntu.com/ubuntu focal-security InRelease
Reading package lists... Done
Building dependency tree
Reading state information... Done
All packages are up to date.
nicholas@mordor:~$
nicholas@mordor:~$ sudo apt install mariadb-server mariadb-client
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 resolve the situation:
The following packages have unmet dependencies:
mariadb-server : Depends: mariadb-server-10.3 (>= 1:10.3.25-0ubuntu0.20.04.1) but it is not going to be installed
E: Unable to correct problems, you have held broken packages.
nicholas@mordor:~$
但是我怎样才能知道什么东西被扣留了或者损坏了呢?
还:
nicholas@mordor:~$
nicholas@mordor:~$ sudo apt-get install -f
Reading package lists... Done
Building dependency tree
Reading state information... Done
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
nicholas@mordor:~$
nicholas@mordor:~$ sudo dpkg --configure -a
nicholas@mordor:~$
来源:
nicholas@mordor:~$
nicholas@mordor:~$ cat /etc/apt/sources.list
# deb cdrom:[Ubuntu 20.04 LTS _Focal Fossa_ - Release amd64 (20200423)]/ focal 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/ focal main restricted
# deb-src http://ca.archive.ubuntu.com/ubuntu/ focal main restricted
## Major bug fix updates produced after the final release of the
## distribution.
deb http://ca.archive.ubuntu.com/ubuntu/ focal-updates main restricted
# deb-src http://ca.archive.ubuntu.com/ubuntu/ focal-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/ focal universe
# deb-src http://ca.archive.ubuntu.com/ubuntu/ focal universe
deb http://ca.archive.ubuntu.com/ubuntu/ focal-updates universe
# deb-src http://ca.archive.ubuntu.com/ubuntu/ focal-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/ focal multiverse
# deb-src http://ca.archive.ubuntu.com/ubuntu/ focal multiverse
deb http://ca.archive.ubuntu.com/ubuntu/ focal-updates multiverse
# deb-src http://ca.archive.ubuntu.com/ubuntu/ focal-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://ca.archive.ubuntu.com/ubuntu/ focal-backports main restricted universe multiverse
# deb-src http://ca.archive.ubuntu.com/ubuntu/ focal-backports main restricted universe 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 focal partner
# deb-src http://archive.canonical.com/ubuntu focal partner
deb http://security.ubuntu.com/ubuntu focal-security main restricted
# deb-src http://security.ubuntu.com/ubuntu focal-security main restricted
deb http://security.ubuntu.com/ubuntu focal-security universe
# deb-src http://security.ubuntu.com/ubuntu focal-security universe
deb http://security.ubuntu.com/ubuntu focal-security multiverse
# deb-src http://security.ubuntu.com/ubuntu focal-security multiverse
# This system was installed using small removable media
# (e.g. netinst, live or single CD). The matching "deb cdrom"
# entries were disabled at the end of the installation process.
# For information about how to configure apt package sources,
# see the sources.list(5) manual.
nicholas@mordor:~$
政策:
nicholas@mordor:~$
nicholas@mordor:~$ apt policy
Package files:
100 /var/lib/dpkg/status
release a=now
500 http://security.ubuntu.com/ubuntu focal-security/multiverse amd64 Packages
release v=20.04,o=Ubuntu,a=focal-security,n=focal,l=Ubuntu,c=multiverse,b=amd64
origin security.ubuntu.com
500 http://security.ubuntu.com/ubuntu focal-security/universe i386 Packages
release v=20.04,o=Ubuntu,a=focal-security,n=focal,l=Ubuntu,c=universe,b=i386
origin security.ubuntu.com
500 http://security.ubuntu.com/ubuntu focal-security/universe amd64 Packages
release v=20.04,o=Ubuntu,a=focal-security,n=focal,l=Ubuntu,c=universe,b=amd64
origin security.ubuntu.com
500 http://security.ubuntu.com/ubuntu focal-security/restricted i386 Packages
release v=20.04,o=Ubuntu,a=focal-security,n=focal,l=Ubuntu,c=restricted,b=i386
origin security.ubuntu.com
500 http://security.ubuntu.com/ubuntu focal-security/restricted amd64 Packages
release v=20.04,o=Ubuntu,a=focal-security,n=focal,l=Ubuntu,c=restricted,b=amd64
origin security.ubuntu.com
500 http://security.ubuntu.com/ubuntu focal-security/main i386 Packages
release v=20.04,o=Ubuntu,a=focal-security,n=focal,l=Ubuntu,c=main,b=i386
origin security.ubuntu.com
500 http://security.ubuntu.com/ubuntu focal-security/main amd64 Packages
release v=20.04,o=Ubuntu,a=focal-security,n=focal,l=Ubuntu,c=main,b=amd64
origin security.ubuntu.com
100 http://ca.archive.ubuntu.com/ubuntu focal-backports/universe i386 Packages
release v=20.04,o=Ubuntu,a=focal-backports,n=focal,l=Ubuntu,c=universe,b=i386
origin ca.archive.ubuntu.com
100 http://ca.archive.ubuntu.com/ubuntu focal-backports/universe amd64 Packages
release v=20.04,o=Ubuntu,a=focal-backports,n=focal,l=Ubuntu,c=universe,b=amd64
origin ca.archive.ubuntu.com
500 http://ca.archive.ubuntu.com/ubuntu focal-updates/multiverse i386 Packages
release v=20.04,o=Ubuntu,a=focal-updates,n=focal,l=Ubuntu,c=multiverse,b=i386
origin ca.archive.ubuntu.com
500 http://ca.archive.ubuntu.com/ubuntu focal-updates/multiverse amd64 Packages
release v=20.04,o=Ubuntu,a=focal-updates,n=focal,l=Ubuntu,c=multiverse,b=amd64
origin ca.archive.ubuntu.com
500 http://ca.archive.ubuntu.com/ubuntu focal-updates/universe i386 Packages
release v=20.04,o=Ubuntu,a=focal-updates,n=focal,l=Ubuntu,c=universe,b=i386
origin ca.archive.ubuntu.com
500 http://ca.archive.ubuntu.com/ubuntu focal-updates/universe amd64 Packages
release v=20.04,o=Ubuntu,a=focal-updates,n=focal,l=Ubuntu,c=universe,b=amd64
origin ca.archive.ubuntu.com
500 http://ca.archive.ubuntu.com/ubuntu focal-updates/restricted i386 Packages
release v=20.04,o=Ubuntu,a=focal-updates,n=focal,l=Ubuntu,c=restricted,b=i386
origin ca.archive.ubuntu.com
500 http://ca.archive.ubuntu.com/ubuntu focal-updates/restricted amd64 Packages
release v=20.04,o=Ubuntu,a=focal-updates,n=focal,l=Ubuntu,c=restricted,b=amd64
origin ca.archive.ubuntu.com
500 http://ca.archive.ubuntu.com/ubuntu focal-updates/main i386 Packages
release v=20.04,o=Ubuntu,a=focal-updates,n=focal,l=Ubuntu,c=main,b=i386
origin ca.archive.ubuntu.com
500 http://ca.archive.ubuntu.com/ubuntu focal-updates/main amd64 Packages
release v=20.04,o=Ubuntu,a=focal-updates,n=focal,l=Ubuntu,c=main,b=amd64
origin ca.archive.ubuntu.com
500 http://ca.archive.ubuntu.com/ubuntu focal/multiverse i386 Packages
release v=20.04,o=Ubuntu,a=focal,n=focal,l=Ubuntu,c=multiverse,b=i386
origin ca.archive.ubuntu.com
500 http://ca.archive.ubuntu.com/ubuntu focal/multiverse amd64 Packages
release v=20.04,o=Ubuntu,a=focal,n=focal,l=Ubuntu,c=multiverse,b=amd64
origin ca.archive.ubuntu.com
500 http://ca.archive.ubuntu.com/ubuntu focal/universe i386 Packages
release v=20.04,o=Ubuntu,a=focal,n=focal,l=Ubuntu,c=universe,b=i386
origin ca.archive.ubuntu.com
500 http://ca.archive.ubuntu.com/ubuntu focal/universe amd64 Packages
release v=20.04,o=Ubuntu,a=focal,n=focal,l=Ubuntu,c=universe,b=amd64
origin ca.archive.ubuntu.com
500 http://ca.archive.ubuntu.com/ubuntu focal/restricted i386 Packages
release v=20.04,o=Ubuntu,a=focal,n=focal,l=Ubuntu,c=restricted,b=i386
origin ca.archive.ubuntu.com
500 http://ca.archive.ubuntu.com/ubuntu focal/restricted amd64 Packages
release v=20.04,o=Ubuntu,a=focal,n=focal,l=Ubuntu,c=restricted,b=amd64
origin ca.archive.ubuntu.com
500 http://ca.archive.ubuntu.com/ubuntu focal/main i386 Packages
release v=20.04,o=Ubuntu,a=focal,n=focal,l=Ubuntu,c=main,b=i386
origin ca.archive.ubuntu.com
500 http://ca.archive.ubuntu.com/ubuntu focal/main amd64 Packages
release v=20.04,o=Ubuntu,a=focal,n=focal,l=Ubuntu,c=main,b=amd64
origin ca.archive.ubuntu.com
Pinned packages:
nicholas@mordor:~$
答案1
我遇到了类似的问题。安装了 Mysql-server,但两者无法同时运行。使用 user535733 评论找到了它。卸载 mysql 和 mariadb 后就可以了。
答案2
如果您已经安装了 mysql,请将其删除并尝试一下。它在我的场景中起作用。
sudo apt-get remove --purge mysql-server mysql-client mysql-common
sudo apt-get autoremove
sudo apt-get autoclean
THIS WILL WIPE ALL YOUR EXISTING DATABASES -->> sudo rm -rf /var/lib/mysql
sudo rm -rf /etc/mysql
sudo apt install mariadb-server mariadb-client
答案3
当我使用 mariadb.org repo 本身将主要的 mariadb 版本从 10.3 升级到 10.4 时发生了这种情况。
可能是我缺乏洞察力,但apt depends -r <package>
没有给我提示,但我知道链是 mariadb-server -> mariadb-server-10.x -> mariadb-server-core-10.x。
首先删除所有 mariadb 包并提供所有包后,apt 确实符合要求。
apt remove mariadb-server mariadb-server-10.3 mariadb-server-core-10.3
apt install mariadb-server mariadb-server-10.4 mariadb-server-core-10.4
就我而言,我还不能升级到 10.4.19,因此使用 apt-cache policy 的输出来使用特定版本。
apt-cache policy mariadb-server
apt install mariadb-server="1:10.4.18+maria~bionic" \
mariadb-server-10.4="1:10.4.18+maria~bionic" \
mariadb-server-core-10.4="1:10.4.18+maria~bionic
答案4
感谢 wbob 的提示
以下是我解决问题的方法。
- apt-cache 策略 mariadb-server
mariadb-server:
Installed: (none)
Candidate: 1:10.3.22-1ubuntu1
Version table:
1:10.6.11+maria~ubu2004 1000
1000 https://dlm.mariadb.com/repo/mariadb-server/10.6/repo/ubuntu focal/main amd64 Packages
1000 https://dlm.mariadb.com/repo/mariadb-server/10.6/repo/ubuntu focal/main arm64 Packages
1:10.6.10+maria~ubu2004 1000
1000 https://dlm.mariadb.com/repo/mariadb-server/10.6/repo/ubuntu focal/main amd64 Packages
1000 https://dlm.mariadb.com/repo/mariadb-server/10.6/repo/ubuntu focal/main arm64 Packages
1:10.6.9+maria~ubu2004 1000
1000 https://dlm.mariadb.com/repo/mariadb-server/10.6/repo/ubuntu focal/main amd64 Packages
1000 https://dlm.mariadb.com/repo/mariadb-server/10.6/repo/ubuntu focal/main arm64 Packages
1:10.3.37-0ubuntu0.20.04.1 500
500 http://archive.ubuntu.com/ubuntu focal-updates/universe amd64 Packages
500 http://archive.ubuntu.com/ubuntu focal-security/universe amd64 Packages
1:10.3.22-1ubuntu1 1001
1001 http://archive.ubuntu.com/ubuntu focal/universe amd64 Packages
首先安装 mariadb-common (安装 mariadb-server-10.6 时出现错误)
apt install mariadb-common="1:10.6.11+maria~ubu2004"
然后安装 mariadb-server-10.6
apt install mariadb-server-10.6="1:10.6.11+maria~ubu2004"
最后,安装 mariadb-server
apt install mariadb-server="1:10.6.11+maria~ubu2004"
检查 MariaDB 版本
root@1010010101:~# mysql -V
mysql Ver 15.1 Distrib 10.6.11-MariaDB, for debian-linux-gnu (x86_64) using readline 5.2