Part of Datorkirurgen AB – IT experts across Sweden

How it went when we upgraded MariaDB from 10.5 to 10.11 LTS on Amazon Linux: package conflicts, repository errors, Access denied and the solutions.

Why we needed to upgrade MariaDB

WordPress showed a warning in Site Health that the database server was outdated. The server ran MariaDB 10.5, while WordPress recommends 10.6 or later. In addition, 10.5 was approaching the end of its support. Therefore, we decided to upgrade MariaDB to 10.11, which is a long-term version with support for several years. The server ran Amazon Linux 2023 with six WordPress sites, so there was a lot to lose.

Amazon Linux 2023 only has version 10.5 in its own repositories. Therefore, we needed to add MariaDB’s official repository. The upgrade is well documented, but during the work several faults appeared. The screenshots show them in the order they appeared. We share them, since the same faults affect many people who do the same thing.

Checking the version and installed packages before we upgrade MariaDB
Checking the version and installed packages before we upgrade MariaDB. A real screenshot from our server. Host names are masked.

Fault 1: the backup got Permission denied

The first step was a full backup of all databases. But the command failed immediately with Permission denied. The cause was clear: we stood in the root directory, where ordinary users may not write. In fact, the redirection to the file happens before sudo applies, and therefore it does not help to put sudo in front. The solution was to write the file to the home directory instead.

After that, we checked that the file really contained all databases and that it was readable. In fact, a backup that nobody has checked is an assumption. In addition, we gave the file strict permissions, since it contains all user details. Only when that was done did we continue with the upgrade itself.

A backup to the home directory before the database upgrade
A backup to the home directory before we upgrade MariaDB. Do you need help with Linux? Linux Service helps you in Stockholm and across Sweden, on site or remotely.

Fault 2: the repository could not be read

The next fault appeared when we created the file for MariaDB’s repository. The package manager responded with a parsing error in repomd.xml. The cause was that the address in the file pointed to the wrong directory. Amazon Linux 2023 is not Red Hat, and therefore the version number variable does not work in the same way. The solution was to give the directory for RHEL 9 directly in the address.

At the same time, we saw another problem. When we tried to sign in as root to the database, we got Access denied. However, it was not a bug. In fact, root in MariaDB signs in via the operating system account, and therefore sudo mysql works but a password does not. We adjusted the commands and moved on.

A parsing error in the repository and Access denied when we were going to upgrade MariaDB
A parsing error in the repository and Access denied when we were going to upgrade MariaDB. An example from our work for clients in Östermalm and Kungsholmen.

Fault 3: package conflicts when we upgrade MariaDB

When the repository worked, we tried to install the new version. Then a long list of file conflicts appeared. Both the old packages for 10.5 and the new ones for 10.11 wanted to own the same files. The package manager therefore refused to continue, which is basically good. It protects the system from ending up in a half-finished state.

The solution was to first stop the database and remove the old packages. Here it is important to understand that the data files remain, since they do not belong to the packages. Even so, we checked that the data directory was untouched before we moved on. After that, we installed the new packages without conflicts. We also checked that the service was set to start automatically, since the new packages use a different service name from the old ones.

File conflicts between old and new packages during the upgrade
File conflicts between old and new packages when we were going to upgrade MariaDB. Linux Service, part of Datorkirurgen AB, helps businesses in Solna and Sundbyberg with servers, scripts and databases.
Removing the old packages for MariaDB 10.5 before installing 10.11
Removing the old packages for MariaDB 10.5 before installing 10.11. This is how Linux Service, part of Datorkirurgen AB, works for businesses in Stockholm.

Finally: mariadb-upgrade and verification

When the new packages were in place, we started the database and ran mariadb-upgrade. The command updates the system tables to the new version. After that, we checked the version and that all six databases remained. In addition, we opened each website and signed in to WordPress. The warning in Site Health was gone, and everything worked as before.

The lesson is that the groundwork decides the result. With a backup, the right repository and calm troubleshooting, the upgrade succeeded despite the faults along the way. Since then, we have used the same routine on more servers, and it has worked every time. Read more about ongoing operation in the article on MariaDB on Linux.

Contact Linux Service when you want to upgrade MariaDB

Linux Service is part of Datorkirurgen AB and upgrades databases for businesses across Sweden. We take backups, test and carry out the upgrade with as short an interruption as possible. MariaDB describes upgrades in its documentation.

Therefore, contact us before you upgrade, or if an upgrade has gone wrong. We take over remotely and make sure that your data is safe. Moreover, you receive a short report of what we did.

Frequently asked questions about upgrading MariaDB

Questions about upgrading MariaDB

Upgrading MariaDB: faults and solutions

More about databases and support

Website developed by Datorkirurgen AB · Privacy policy