Error when updating server from Debian 11 to Debian 12

I am trying to update a different server from Debian 11 to Debian 12. I had no problem updating this server from Debian 10 to Debian 11 a few years ago. But now there appears to be a big problem. I created a full admin backup with Hestia and downloaded it and I made sure I was using the latest version of Hestia. Which is 1.9.6. Then I opened a terminal in root and used: apt update && apt upgrade -y

I then changed the sources from bullseye to bookworm with: nano /etc/apt/sources.list

I then updated with this: apt update

The system provided the following message: 584 packages can be upgraded.

But then listed these errors:

Failed to fetch https://packages.sury.org/apache2/dists/bullseye/InRelease The following signatures were invalid: EXPKEYSIG B188E2B695BD4743 DEB.SURY.ORG Automatic Signing Key <[email protected]>

W: Failed to fetch https://packages.sury.org/php/dists/bullseye/InRelease The following signatures were invalid: EXPKEYSIG B188E2B695BD4743 DEB.SURY.ORG Automatic Signing Key <[email protected]>

W: Some index files failed to download. They have been ignored, or old ones used instead.

I then did the first step in the two part process with this:

apt upgrade --without-new-pkgs

This ended with the following error message:

E: Failed to fetch https://packages.sury.org/php/pool/main/m/mpdecimal/libmpdec3_2.5.1-2%2b0%7e20240210.5%2bdebian11%7e1.gbp216c03_amd64.deb 404 Not Found [IP: 151.101.131.52 443]

E: Unable to fetch some archives, maybe run apt-get update or try with –fix-missing?

So I ran: apt-get update But it ended with:

W: Failed to fetch https://packages.sury.org/apache2/dists/bullseye/InRelease The following signatures were invalid: EXPKEYSIG B188E2B695BD4743 DEB.SURY.ORG Automatic Signing Key <[email protected]>

W: Failed to fetch https://packages.sury.org/php/dists/bullseye/InRelease The following signatures were invalid: EXPKEYSIG B188E2B695BD4743 DEB.SURY.ORG Automatic Signing Key <[email protected]>

W: Some index files failed to download. They have been ignored, or old ones used instead.

Hoping this problem might resolve itself, I did:

apt full-upgrade -y

But it ended with this error:

Reading package lists... Done

Building dependency tree... Done

Reading state information... Done

Calculating upgrade... Error!

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:

mariadb-client-core-10.6 : Conflicts: mariadb-client-10.6 (< 1:10.6.27+maria~deb11) but 1:10.6.16+maria~deb11 is to be installed

mariadb-server-core-10.6 : Breaks: mariadb-client-10.6 (< 1:10.6.27+maria~deb11) but 1:10.6.16+maria~deb11 is to be installed

Breaks: mariadb-server-10.6 (< 1:10.6.27+maria~deb11) but 1:10.6.16+maria~deb11 is to be installed

E: Error, pkgProblemResolver::Resolve generated breaks, this may be caused by held packages.

At this point I do not know what to do. Any suggestions would be appreciated.

Execute this to update the keys used by the repo packages (we did the same the other day):

curl -sSlo /usr/share/keyrings/sury-keyring.gpg https://packages.sury.org/php/apt.gpg
curl -sSlo /usr/share/keyrings/apache2-keyring.gpg https://packages.sury.org/apache2/apt.gpg
curl -s https://nginx.org/keys/nginx_signing.key | gpg --dearmor | sudo tee /usr/share/keyrings/nginx-keyring.gpg > /dev/null 2>&1
apt update`

Before the upgrade, read this and keep a backup of every file on your server.

I did the three commands to add the keys. I then did: apt update

ended with:

610 packages can be upgraded. Run 'apt list --upgradable' to see them.

So I ran: apt upgrade --without-new-pkgs

But the terminal responded with:

Reading package lists... Done

Building dependency tree... Done

Reading state information... Done

E: Unable to locate package –without-new-pkgs

So I ran: apt full-upgrade -y

But the terminal responded with the same error as earlier:

Reading package lists... Done

Building dependency tree... Done

Reading state information... Done

Calculating upgrade... Error!

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:

mariadb-client-core-10.6 : Conflicts: mariadb-client-10.6 (< 1:10.6.27+maria~deb11) but 1:10.6.16+maria~deb11 is to be installed

mariadb-server-core-10.6 : Breaks: mariadb-client-10.6 (< 1:10.6.27+maria~deb11) but 1:10.6.16+maria~deb11 is to be installed

Breaks: mariadb-server-10.6 (< 1:10.6.27+maria~deb11) but 1:10.6.16+maria~deb11 is to be installed

E: Error, pkgProblemResolver::Resolve generated breaks, this may be caused by held packages.

That command doesn’t ask a question?

No. The command never asked a question. I copy pasted the entire terminal reply. It started with building the package list and ended with the error.

Show the output of these commands:

apt-mark showhold
cat /etc/apt/sources.list.d/mariadb.list

apt-mark showhold

had no reply.

cat /etc/apt/sources.list.d/mariadb.list

replied:

deb [arch=amd64 signed-by=/usr/share/keyrings/mariadb-keyring.gpg] https://mirror.mva-n.net/mariadb/repo/10.6/debian` bullseye main`

Show this:

apt policy mariadb-client-10.6 mariadb-client-core-10.6 mariadb-server-core-10.6
grep -R maria /etc/apt/sources.list /etc/apt/sources.list.d/*

mariadb-client-10.6:
Installed: 1:10.6.16+maria~deb11
Candidate: 1:10.6.27+maria~deb11
Version table:
1:10.6.27+maria~deb11 500
500 https://mirror.mva-n.net/mariadb/repo/10.6/debian` bullseye/main amd64 Packages 1:10.6.26+maria~deb11 500 500 https://mirror.mva-n.net/mariadb/repo/10.6/debian bullseye/main amd64 Packages 1:10.6.25+maria~deb11 500 500 https://mirror.mva-n.net/mariadb/repo/10.6/debian bullseye/main amd64 Packages *** 1:10.6.16+maria~deb11 100 100 /var/lib/dpkg/status mariadb-client-core-10.6: Installed: 1:10.6.16+maria~deb11 Candidate: 1:10.6.27+maria~deb11 Version table: 1:10.6.27+maria~deb11 500 500 https://mirror.mva-n.net/mariadb/repo/10.6/debian bullseye/main amd64 Packages 1:10.6.26+maria~deb11 500 500 https://mirror.mva-n.net/mariadb/repo/10.6/debian bullseye/main amd64 Packages 1:10.6.25+maria~deb11 500 500 https://mirror.mva-n.net/mariadb/repo/10.6/debian bullseye/main amd64 Packages *** 1:10.6.16+maria~deb11 100 100 /var/lib/dpkg/status mariadb-server-core-10.6: Installed: 1:10.6.16+maria~deb11 Candidate: 1:10.6.27+maria~deb11 Version table: 1:10.6.27+maria~deb11 500 500 https://mirror.mva-n.net/mariadb/repo/10.6/debian bullseye/main amd64 Packages 1:10.6.26+maria~deb11 500 500 https://mirror.mva-n.net/mariadb/repo/10.6/debian bullseye/main amd64 Packages 1:10.6.25+maria~deb11 500 500 https://mirror.mva-n.net/mariadb/repo/10.6/debian bullseye/main amd64 Packages *** 1:10.6.16+maria~deb11 100 100 /var/lib/dpkg/status /etc/apt/sources.list.d/mariadb.list:deb [arch=amd64 signed-by=/usr/share/keyrings/mariadb-keyring.gpg] https://mirror.mva-n.net/mariadb/repo/10.6/debian bullseye main`

There is a backtick in the repo:

Execute this:

sed -i 's/`//g' /etc/apt/sources.list /etc/apt/sources.list.d/mariadb.list
apt update
apt full-upgrade -y 

apt update went well but the last command did not:

Reading package lists… Done

Building dependency tree… Done

Reading state information... Done

Calculating upgrade... Error!

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:

mariadb-client-core-10.6 : Conflicts: mariadb-client-10.6 (< 1:10.6.27+maria~deb11) but 1:10.6.16+maria~deb11 is to be installed

mariadb-server-core-10.6 : Breaks: mariadb-client-10.6 (< 1:10.6.27+maria~deb11) but 1:10.6.16+maria~deb11 is to be installed

Breaks: mariadb-server-10.6 (< 1:10.6.27+maria~deb11) but 1:10.6.16+maria~deb11 is to be installed

E: Error, pkgProblemResolver::Resolve generated breaks, this may be caused by held packages.

I need access to your server, I’m going to send a private message.

Just for the record.

The user mixed packages from bookworm in sources.list and packages bullseye in sources.list.d/*.list. Also, the big problem was that MariaDB 10.x is not anymore in repos so we had to rollback all repos to bullseye, update MariaDB to 11.4 and after that to 11.8. Once done, we modified the source files to use bookworm and upgrade the OS.