4

Recognizing that this is basically a FAQ:

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:~$ 

but how do I find out what's held or broken?

also:

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:~$ 

sources:

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:~$ 

Policy:

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
  • 2
    Look at the long list of 'breaks' and 'conflicts' in apt depends mariadb-server-10.3. Do you have any of those 'breaks' or 'conflicts' packages installed?
    – user535733
    Nov 14, 2020 at 13:15

4 Answers 4

8

I had a similar issue. Mysql-server was installed and both cannot at the same time. found it using user535733 comment. uninstalled mysql and mariadb could then be.

3
2

If you have installed mysql , remove it and give it a try. it worked in my scenario.

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
0

happened to me when upgrading major mariadb versions from 10.3 to 10.4 with the mariadb.org repo itself.

It's possible I lack insight, but apt depends -r <package> didn't give me a cue, but I knew the chain to be mariadb-server -> mariadb-server-10.x -> mariadb-server-core-10.x.

After removing all mariadb packages first and providing all packages, apt did comply.

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

In my case, I couldn't go to 10.4.19 yet so used the output of apt-cache policy to use a specific version.

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
0

thanks wbob for the hint

here's how i solve it.

  1. apt-cache policy 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
  1. install mariadb-common first ( i got error when install mariadb-server-10.6 )

    apt install mariadb-common="1:10.6.11+maria~ubu2004"
    
  2. then install mariadb-server-10.6

    apt install mariadb-server-10.6="1:10.6.11+maria~ubu2004"
    
  3. finally, install mariadb-server

    apt install mariadb-server="1:10.6.11+maria~ubu2004"
    
  4. check MariaDB Version

root@1010010101:~# mysql -V
mysql  Ver 15.1 Distrib 10.6.11-MariaDB, for debian-linux-gnu (x86_64) using readline 5.2

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .