No update of QGIS (3.10) possible on Ubuntu 18.04 – broken packages

qgisrepositoryUbuntuupdate

I tried to update QGIS 3.10 to a newer version on Ubuntu 18.04 (bionic) but it fails every time due to brocken packages probably. I've already followed instructions on https://qgis.org/it/site/forusers/alldownloads.html#debian-ubuntu and https://linuxhint.com/install-qgis3-geospatial-ubuntu/ but it didnt help me.

I have modified the sources.list (sudo nano /etc/apt/sources.list
) several times with all possible repositories but nothing helped and now I'm totally lost.

After changing the sources.list I updated (sudo apt update) and tried to install QGIS (sudo apt install qgis qgis-plugin-grass
) but everytime I get this information:

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 to resolve the situation:

The following packages have unmet dependencies.
 qgis : Depends: libgdal20 (>= 1.8.0) but it is not going to be installed
        Depends: libqgis-3d3.16.3 but it is not going to be installed
        Depends: libqgis-analysis3.16.3 but it is not going to be installed
        Depends: libqgis-app3.16.3 but it is not going to be installed
        Depends: libqgis-core3.16.3 but it is not going to be installed
        Depends: libqgis-gui3.16.3 but it is not going to be installed
        Depends: python3-qgis (= 1:3.16.3+28bionic) but it is not going to be installed
        Depends: qgis-providers (= 1:3.16.3+28bionic) but it is not going to be installed
        Depends: qgis-common (= 1:3.16.3+28bionic) but 3.10.12+dfsg-1~bionic1 is to be installed
 qgis-plugin-grass : Depends: qgis-provider-grass (= 1:3.16.3+28bionic) but 3.10.12+dfsg-1~bionic1 is to be installed
                     Depends: grass740 but it is not installable
                     Depends: libgdal20 (>= 1.8.0) but it is not going to be installed
                     Depends: libqgis-app3.16.3 but it is not going to be installed
                     Depends: libqgis-core3.16.3 but it is not going to be installed
                     Depends: libqgis-gui3.16.3 but it is not going to be installed
                     Depends: libqgisgrass7-3.16.3 but it is not going to be installed
E: Unable to correct problems, you have held broken packages.

And my sources.list looks like this:

  GNU nano 2.9.3                                                                                  /etc/apt/sources.list                                                                                            

deb https://qgis.org/debian bionic main
# deb http://qgis.org/ubuntu bionic main
# deb cdrom:[Ubuntu 18.04 _Bionic_ - Build amd64 LIVE Binary 20180608-09:38]/ bionic main

# deb http://qgis.org/ubuntu-ltr/ bionic main
# deb-src http://qgis.org/ubuntu-ltr/ bionic main

# deb http://archive.ubuntu.com/ubuntu bionic multiverse restricted universe main
# deb-src http://archive.ubuntu.com/ubuntu bionic multiverse restricted universe main #Added by software-properties
# deb-src https://qgis.org/ubuntu bionic main

# deb http://ppa.launchpad.net/ubuntugis/ppa/ubuntu bionic main
# deb-src http://ppa.launchpad.net/ubuntugis/ppa/ubuntu bionic main
# deb http://qgis.org/debian bionic main
deb-src http://qgis.org/debian bionic main
# deb https://qgis.org/debian bionic main

#deb https://qgis.org/ubuntu bionic main

# deb https://qgis.org/ubuntugis bionic main
# deb-src https://qgis.org/ubuntugisbionic main

#deb http://de.archive.ubuntu.com/ubuntu bionic main restricted

# deb-src http://de.archive.ubuntu.com/ubuntu bionic main restricted universe multiverse

#deb http://de.archive.ubuntu.com/ubuntu bionic-updates main restricted
# deb-src http://de.archive.ubuntu.com/ubuntu bionic-updates main restricted universe multiverse

#deb http://de.archive.ubuntu.com/ubuntu bionic universe
#deb http://de.archive.ubuntu.com/ubuntu bionic-updates universe

# deb-src http://de.archive.ubuntu.com/ubuntu bionic-security main restricted universe multiverse

# deb http://de.archive.ubuntu.com/ubuntu bionic-backports main restricted universe multiverse
# deb-src http://de.archive.ubuntu.com/ubuntu bionic-backports main restricted universe multiverse

# deb http://archive.canonical.com/ubuntu bionic partner
# deb-src http://archive.canonical.com/ubuntu bionic partner
# deb https://qgis.org/ubuntu main
# deb-src https://qgis.org/ubuntu main

Can anyone tell me where the problem is?

Best Answer

Start by installing libgdal20, then qgis together with python3-qgis. This should narrow down the list of "not going to be installed".

It might also be necessary to run

sudo apt-get remove libproj15

I mnanaged to get QGIS 3.16.9 running with qgis.org/ubuntugis-ltr bionic main.

Update from comments:

It seems you have used ubuntugis in the past to update GDAL to version 3, so I suggest to stick to that toolchain. Libgdal20 is not needed in this case.

Looking at your sources.list, it looks you have disabled everything except QGIS. So you may run sudo apt update as often as you want, but it will not update any system files. Current QGIS packages are always build against a current version of the OS.

Remove the # from any line with de.archive.ubuntu.com and archive.canonical.com, or use the icon Package sources to select a mirror like ftp.halifax.rwth-aachen.de (which I use on Linux Mint).

After updating the system, QGIS should be installable.

Related Question