APT upgrade error while upgrading Galera cluster node from MariaDB 10.3 to MariaDB 10.4

Written by - 0 comments

Published on - Listed in Galera Database MariaDB


While doing a version upgrade of a Galera cluster from MariaDB 10.3 to 10.4, I ran into an unexpected APT error during the package upgrades.

Galera 3 to Galera 4: Compatible or not?

The version upgrade from MariaDB 10.3 to 10.4 also involves a change in the Galera protocol version; the galera package is upgraded from galera-3 to galera-4. Although there could be Galera protocol mismatch errors, an upgrade from 10.3 to 10.4 is supported as galera-4 is backward compatible:

If you are upgrading from the most recent MariaDB 10.3 release to MariaDB 10.4, then the versions will be compatible. MariaDB 10.3 uses Galera 3 (i.e. Galera wsrep provider versions 25.3.x), and MariaDB 10.4 uses Galera 4 (i.e. Galera wsrep provider versions 26.4.x). This means that upgrading to MariaDB 10.4 also upgrades the system to Galera 4. However, Galera 3 and Galera 4 should be compatible for the purposes of a rolling upgrade, as long as you are using Galera 26.4.2 or later. 

Errors were encountered while processing upgrade

Once the APT repositories were adjusted for the newer MariaDB version, the package upgrade was initiated using apt:

root@mysql01:~# apt-get install mariadb-server
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following additional packages will be installed:
  galera-4 mariadb-backup mariadb-client-10.4 mariadb-client-core-10.4 mariadb-common mariadb-server-10.4 mariadb-server-core-10.4
Suggested packages:
  mailx mariadb-test tinyca
The following packages will be REMOVED:
  galera-3 mariadb-client-10.3 mariadb-client-core-10.3 mariadb-server-10.3 mariadb-server-core-10.3
The following NEW packages will be installed:
  galera-4 mariadb-client-10.4 mariadb-client-core-10.4 mariadb-server-10.4 mariadb-server-core-10.4
The following packages will be upgraded:
  mariadb-backup mariadb-common mariadb-server

3 upgraded, 5 newly installed, 5 to remove and 2 not upgraded.
Need to get 28.7 MB of archives.
After this operation, 15.6 MB of additional disk space will be used.
Do you want to continue? [Y/n] y
[...]
Setting up mariadb-common (1:10.4.30+maria~ubu1804) ...
Selecting previously unselected package mariadb-server-10.4.
(Reading database ... 51543 files and directories currently installed.)
Preparing to unpack .../mariadb-server-10.4_1%3a10.4.30+maria~ubu1804_amd64.deb ...
/var/lib/mysql: found previous version 10.3
Failed to stop mysql.service: Unit mysql.service not loaded.
'systemctl stop mysql' returned 5
There is a MySQL server running, but we failed in our attempts to stop it.
Stop it yourself and try again!

dpkg: error processing archive /var/cache/apt/archives/mariadb-server-10.4_1%3a10.4.30+maria~ubu1804_amd64.deb (--unpack):
 new mariadb-server-10.4 package pre-installation script subprocess returned error exit status 1
Failed to stop mysql.service: Unit mysql.service not loaded.
Errors were encountered while processing:
 /var/cache/apt/archives/mariadb-server-10.4_1%3a10.4.30+maria~ubu1804_amd64.deb
E: Sub-process /usr/bin/dpkg returned an error code (1)

Obviously the preinst script from the MariaDB 10.4 package does not contain a stop service. That means you must stop MariaDB manually before running the upgrade. Let's do this again, correctly this time:

root@mysql01:~# systemctl stop mariadb
root@mysql01:~# apt-get install mariadb-server
Reading package lists... Done
Building dependency tree       
Reading state information... Done
mariadb-server is already the newest version (1:10.4.30+maria~ubu1804).
You might want to run 'apt --fix-broken install' to correct these.
The following packages have unmet dependencies:
 mariadb-server : Depends: mariadb-server-10.4 (>= 1:10.4.30+maria~ubu1804) but it is not going to be installed
E: Unmet dependencies. Try 'apt --fix-broken install' with no packages (or specify a solution).

APT still remembers that it ran into a problem during the last attempt, so now can fix the broken installation:

root@mysql01:~# apt --fix-broken install
Reading package lists... Done
Building dependency tree       
Reading state information... Done
Correcting dependencies... Done
The following additional packages will be installed:
  mariadb-server-10.4
Suggested packages:
  mailx mariadb-test tinyca
The following NEW packages will be installed:
  mariadb-server-10.4
0 upgraded, 1 newly installed, 0 to remove and 2 not upgraded.
6 not fully installed or removed.
Need to get 0 B/4,835 kB of archives.
After this operation, 79.2 MB of additional disk space will be used.
Do you want to continue? [Y/n] Y
Preconfiguring packages ...
(Reading database ... 51543 files and directories currently installed.)
Preparing to unpack .../mariadb-server-10.4_1%3a10.4.30+maria~ubu1804_amd64.deb ...
/var/lib/mysql: found previous version 10.3
Unpacking mariadb-server-10.4 (1:10.4.30+maria~ubu1804) ...
Setting up galera-4 (26.4.14-ubu1804) ...
Setting up mariadb-client-core-10.4 (1:10.4.30+maria~ubu1804) ...
Setting up mariadb-client-10.4 (1:10.4.30+maria~ubu1804) ...
Setting up mariadb-backup (1:10.4.30+maria~ubu1804) ...
Setting up mariadb-server-core-10.4 (1:10.4.30+maria~ubu1804) ...
Setting up mariadb-server-10.4 (1:10.4.30+maria~ubu1804) ...
Installing new version of config file /etc/logrotate.d/mysql-server ...
Installing new version of config file /etc/mysql/debian-start ...
/usr/sbin/policy-rc.d returned 101, not running 'start mariadb.service'
/usr/sbin/policy-rc.d returned 101, not running 'start mariadb.service'
Setting up mariadb-server (1:10.4.30+maria~ubu1804) ...
Processing triggers for man-db (2.8.3-2ubuntu0.1) ...

And now MariaDB can be started again:

root@mysql01:~# systemctl start mariadb

Galera cluster back in sync

A few seconds later, the Galera cluster was back in sync:

2023-06-20  9:45:24 0 [Note] WSREP: Server status change donor -> joined
2023-06-20  9:45:24 0 [Note] WSREP: wsrep_notify_cmd is not defined, skipping notification.
2023-06-20  9:45:24 0 [Note] WSREP: 0.0 (mysql02): State transfer to 1.0 (mysql01) complete.
2023-06-20  9:45:24 0 [Note] WSREP: Shifting DONOR/DESYNCED -> JOINED (TO: 434803645)
2023-06-20  9:45:24 0 [Note] WSREP: Processing event queue:... -nan% (0/0 events) complete.
2023-06-20  9:45:24 0 [Note] WSREP: Member 0.0 (mysql02) synced with group.
2023-06-20  9:45:24 0 [Note] WSREP: Processing event queue:...100.0% (1/1 events) complete.
2023-06-20  9:45:24 0 [Note] WSREP: Shifting JOINED -> SYNCED (TO: 434803645)
2023-06-20  9:45:24 25 [Note] WSREP: Server mysql02 synced with group
2023-06-20  9:45:24 25 [Note] WSREP: Server status change joined -> synced
2023-06-20  9:45:24 25 [Note] WSREP: Synchronized with group, ready for connections
2023-06-20  9:45:24 25 [Note] WSREP: wsrep_notify_cmd is not defined, skipping notification.
WSREP_SST: [INFO] rsync IST completed on donor (20230620 09:45:24.804)
2023-06-20  9:45:24 0 [Note] WSREP: Donor monitor thread ended with total time 0 sec
2023-06-20  9:45:25 5344 [Warning] Aborted connection 5344 to db: 'unconnected' user: 'unauthenticated' host: '192.168.253.42' (This connection closed normally without authentication)
2023-06-20  9:45:25 0 [Note] WSREP: (2d28c6aa-be41, 'tcp://0.0.0.0:4567') turning message relay requesting off
2023-06-20  9:45:26 0 [Note] WSREP: async IST sender served
2023-06-20  9:45:26 0 [Note] WSREP: 1.0 (mysql01): State transfer from 0.0 (mysql02) complete.
2023-06-20  9:45:26 0 [Note] WSREP: Member 1.0 (mysql01) synced with group.

So remember to stop MariaDB on the Galera cluster node before upgrading the version.


Add a comment

Show form to leave a comment

Comments (newest first)

No comments yet.

RSS feed

Blog Tags:

  AWS   Android   Ansible   Apache   Apple   Atlassian   BSD   Backup   Bash   Bluecoat   CMS   Chef   Cloud   Coding   Consul   Containers   CouchDB   DB   DNS   Database   Databases   Docker   ELK   Elasticsearch   Filebeat   FreeBSD   Galera   Git   GlusterFS   Grafana   Graphics   HAProxy   HTML   Hacks   Hardware   Icinga   Icingaweb   Icingaweb2   Influx   Internet   Java   KVM   Kibana   Kodi   Kubernetes   LVM   LXC   Linux   Logstash   Mac   Macintosh   Mail   MariaDB   Minio   MongoDB   Monitoring   Multimedia   MySQL   NFS   Nagios   Network   Nginx   OSSEC   OTRS   Office   PGSQL   PHP   Perl   Personal   PostgreSQL   Postgres   PowerDNS   Proxmox   Proxy   Python   Rancher   Rant   Redis   Roundcube   SSL   Samba   Seafile   Security   Shell   SmartOS   Solaris   Surveillance   Systemd   TLS   Tomcat   Ubuntu   Unix   VMWare   VMware   Varnish   Virtualization   Windows   Wireless   Wordpress   Wyse   ZFS   Zoneminder   


Update cookies preferences