Wie man unter Debian „E: Broken packages“ am einfachsten löst

Release-Upgrades von Debian GNU/Linux-Kisten sind immer so eine Sache. Bei der Migration von Stretch auf Bullseye stand ich vor folgendem Problem:

# apt-get dist-upgrade
Reading package lists... Done
Building dependency tree
Reading state information... Done
Calculating upgrade... Done
The following packages have been kept back:
apt apt-utils cpp gcc libmariadb-dev
0 upgraded, 0 newly installed, 0 to remove and 5 not upgraded.

# apt upgrade apt
Reading package lists... Done
Building dependency tree
Reading state information... Done
Calculating upgrade... 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:
apt : Depends: libapt-pkg6.0 (>= 2.2.4) but it is not going to be installed
Depends: libstdc++6 (>= 9) but 8.3.0-6 is to be installed
apt-utils : Depends: apt (= 1.8.2.3) but 2.2.4 is to be installed
E: Broken packages

Wie ich endlich, nach all den Jahren herausgefunden habe, löst man solche Probleme am einfachsten mit dem Downgrade eines oder mehrerer Pakete. Dies, indem man apt-get install %paketname%=%versionsnummer% ausführt.

Welches Paket man im obigen Fall downgraden muss? Gar nicht so einfach. Irgendeinmal hatte ich es dann doch herausgefunden:

# apt-get install gcc-10-base=10.2.1-6

Danach flutschte apt-get upgrade durch.

Nachtrag 1

Gerade wieder ein solches Problem:

# apt-get dist-upgrade
...
The following packages have been kept back:
locales
0 upgraded, 0 newly installed, 0 to remove and 1 not upgraded.

Manueller Versuch:

# apt-get upgrade locales
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
Calculating upgrade... 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:
libc-bin : Depends: libc6 (> 2.32) but 2.31-13+deb11u2 is to be installed
E: Broken packages

Von welcher Version sprechen wir?

# dpkg --list | grep -i locales
...
ii locales 2.31-17 all GNU C Library: National Language (locale) data [support]
...

Welche Version ist stable für meine aktuelle Distribution?

# cat /etc/debian_version
11.1

Debian 11 ist Bullseye, also gehen wir rüber zu packages.debian.org und sehen, dass die aktuelle stabile Version Package: locales (2.31-13+deb11u2) ist. Somit:

# apt-get install locales=2.31-13+deb11u2
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
The following packages will be DOWNGRADED:
locales
0 upgraded, 0 newly installed, 1 downgraded, 0 to remove and 1 not upgraded.
Need to get 4,082 kB of archives.
After this operation, 2,048 B of additional disk space will be used.
Do you want to continue? [Y/n] y
Get:1 https://debian.ethz.ch/debian bullseye/main amd64 locales all 2.31-13+deb11u2 [4,082 kB]
Fetched 4,082 kB in 0s (11.1 MB/s)
Preconfiguring packages ...
dpkg: warning: downgrading locales from 2.31-17 to 2.31-13+deb11u2
(Reading database ... 139926 files and directories currently installed.)
Preparing to unpack .../locales_2.31-13+deb11u2_all.deb ...
Unpacking locales (2.31-13+deb11u2) over (2.31-17) ...
Setting up locales (2.31-13+deb11u2) ...
Generating locales (this might take a while)...
en_US.UTF-8... done
Generation complete.
Processing triggers for man-db (2.9.4-2) ...

Und Feierabend.

Nachtrag 2

Kürzlich ist das Problem wieder einmal aufgetreten:

# apt-get upgrade libfido2-1
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
Calculating upgrade... 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:
libfido2-1 : Depends: libc6 (>= 2.33) but 2.31-13+deb11u2 is to be installed
E: Broken packages

# dpkg --list | grep libfido2-1
ii libfido2-1:amd64 1.9.0-1 amd64 library for generating and verifying FIDO 2.0 objects

Nun, da schauen wir mal, welche Version dieses Pakets aktuell ist: packages.debian.org meldet für Debian Bullseye (11) Version 1.6.0-2 als aktuell. Somit downgrade initiieren:

# apt-get install libfido2-1=1.6.0-2
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
The following package was automatically installed and is no longer required:
libcbor0.8
Use 'apt autoremove' to remove it.
The following additional packages will be installed:
libcbor0
The following NEW packages will be installed:
libcbor0
The following packages will be DOWNGRADED:
libfido2-1
0 upgraded, 1 newly installed, 1 downgraded, 0 to remove and 1 not upgraded.
Need to get 77.3 kB of archives.
After this operation, 37.9 kB of additional disk space will be used.
Do you want to continue? [Y/n] y
Get:1 https://debian.ethz.ch/debian bullseye/main amd64 libcbor0 amd64 0.5.0+dfsg-2 [24.0 kB]
Get:2 https://debian.ethz.ch/debian bullseye/main amd64 libfido2-1 amd64 1.6.0-2 [53.3 kB]
Fetched 77.3 kB in 0s (436 kB/s)
Selecting previously unselected package libcbor0:amd64.
(Reading database ... 145105 files and directories currently installed.)
Preparing to unpack .../libcbor0_0.5.0+dfsg-2_amd64.deb ...
Unpacking libcbor0:amd64 (0.5.0+dfsg-2) ...
dpkg: warning: downgrading libfido2-1:amd64 from 1.9.0-1 to 1.6.0-2
Preparing to unpack .../libfido2-1_1.6.0-2_amd64.deb ...
Unpacking libfido2-1:amd64 (1.6.0-2) over (1.9.0-1) ...
Setting up libcbor0:amd64 (0.5.0+dfsg-2) ...
Setting up libfido2-1:amd64 (1.6.0-2) ...
Processing triggers for libc-bin (2.31-17) ...
[ Rootkit Hunter version 1.4.6 ]
File updated: searched for 180 files, found 147

libc-bin war auf demselben System auch störrisch:

# apt-get upgrade libc-bin
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
Calculating upgrade... 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:
libc-bin : Depends: libc6 (> 2.33) but 2.31-13+deb11u2 is to be installed
E: Broken packages

# dpkg --list | grep libc-bin
ii libc-bin 2.31-17 amd64 GNU C Library: Binaries

packages.debian.org meldet als aktuelle Version 2.31-13+deb11u2, somit auch hier ein Downgrade:

# apt-get upgrade libc-bin=2.31-13+deb11u2
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
Calculating upgrade... Done
The following packages will be DOWNGRADED:
libc-bin
0 upgraded, 0 newly installed, 1 downgraded, 0 to remove and 0 not upgraded.
Need to get 817 kB of archives.
After this operation, 1,024 B disk space will be freed.
Do you want to continue? [Y/n] y
Get:1 https://debian.ethz.ch/debian bullseye/main amd64 libc-bin amd64 2.31-13+deb11u2 [817 kB]
Fetched 817 kB in 0s (3,055 kB/s)
dpkg: warning: downgrading libc-bin from 2.31-17 to 2.31-13+deb11u2
(Reading database ... 145105 files and directories currently installed.)
Preparing to unpack .../libc-bin_2.31-13+deb11u2_amd64.deb ...
Unpacking libc-bin (2.31-13+deb11u2) over (2.31-17) ...
Setting up libc-bin (2.31-13+deb11u2) ...
Processing triggers for man-db (2.9.4-2) ...
[ Rootkit Hunter version 1.4.6 ]
File updated: searched for 180 files, found 147