Mariadb Service Broken After Upgrade

I’ve just updated mariadb on my Leap 16 installation, and now the service won’t start. The journal for mariadb reveals:

Feb 03 11:56:59 ryzen9 systemd[1]: Starting MariaDB database server...
Feb 03 11:56:59 ryzen9 mysql-systemd-helper[14589]: Checking MySQL configuration for obsolete options...
Feb 03 11:56:59 ryzen9 mysql-systemd-helper[14589]: Trying to run upgrade of MySQL databases...
Feb 03 11:56:59 ryzen9 mysql-systemd-helper[14589]: Stale files from previous upgrade detected, cleaned them up
Feb 03 11:56:59 ryzen9 mysql-systemd-helper[14589]: Running protected MySQL...
Feb 03 11:56:59 ryzen9 mysql-systemd-helper[14589]: Waiting for MySQL to start
Feb 03 11:56:59 ryzen9 mysql-systemd-helper[14609]: /usr/sbin/mysqld: Deprecated program name. It will be removed in a future release, use '/usr/sbin/mariadbd' instead
Feb 03 11:57:00 ryzen9 mysql-systemd-helper[14589]: MySQL is alive
Feb 03 11:57:00 ryzen9 mysql-systemd-helper[14589]: Running upgrade itself...
Feb 03 11:57:00 ryzen9 mysql-systemd-helper[14589]: It will do some chek first and report all errors and tries to correct them
Feb 03 11:57:00 ryzen9 mysql-systemd-helper[14626]: /usr/bin/mysql_upgrade: Deprecated program name. It will be removed in a future release, use '/usr/bin/mariadb-upgrade' instead
Feb 03 11:57:01 ryzen9 mysql-systemd-helper[14626]: Note that mysql_upgrade should be run as the same user as the MariaDB server binary, normally 'mysql' or 'root'.
Feb 03 11:57:01 ryzen9 mysql-systemd-helper[14626]: Alternatively you can use mysql_upgrade --force --force. Please check the documentation if you decide to use the force option!
Feb 03 11:57:01 ryzen9 mysql-systemd-helper[14626]: FATAL ERROR: Could not open or create the upgrade info file '/var/lib/mysql/mariadb_upgrade_info' in the MariaDB Servers data directory, errno: 13 (Permission denied)
Feb 03 11:57:01 ryzen9 mysql-systemd-helper[14589]: Upgrade failed
Feb 03 11:57:01 ryzen9 mysql-systemd-helper[14589]: Shutting down protected MySQL
Feb 03 11:57:02 ryzen9 mysql-systemd-helper[14589]: Final cleanup
Feb 03 11:57:02 ryzen9 mysql-systemd-helper[14589]: Something failed during upgrade, please check logs
Feb 03 11:57:02 ryzen9 systemd[1]: mariadb.service: Control process exited, code=exited, status=1/FAILURE
Feb 03 11:57:02 ryzen9 systemd[1]: mariadb.service: Failed with result 'exit-code'.
Feb 03 11:57:02 ryzen9 systemd[1]: Failed to start MariaDB database server.

I’ve tried changing ownership of mariadb_upgrade_info, but this didn’t help, so I put it back to what it was:
-rw-rw----. 1 mysql root 14 Jan 7 23:21 /var/lib/mysql/mariadb_upgrade_info

I’ve tried removing the entire /run/mysql and /var/lib/mysql directories and reinstalling mariadb, but it still fails with the same problem.

I’ve also tried downgrading mariadb with no improvement.

Anyone got any ideas?

@nickelarse Quick guess, SELinux… See https://en.opensuse.org/Portal:SELinux/Common_issues and https://en.opensuse.org/Portal:SELinux/Troubleshooting

Thanks for quick reply. I will try and see if there’s something in SELinux logs as suggested.

Just to clarify: mariadb server worked just fine before the upgrade. However, it’s possible this is the first time it has ever been upgraded since I installed Leap 16.

@malcolmlewis You were correct: SELinux prevents mariadb upgrading (presumably this is a bug?). I managed to get around it as follows:

Disable SELinux for mariadb:

semanage permissive -a mysqld_t

Confirm disabled with semanage permissive -l:

Customized Permissive Types

mysqld_t

Run upgrade and re-enable SELinux for mariadb:

systemctl start mariadb
semanage permissive -d mysqld_t

Confirm SELinux re-enabled for mariadb using semanage permissive -l: mysqld_t should no longer be listed under Customized Permissive Types.

Thanks for the hints! Should I report this as a bug? I’m sure it should be possible to upgrade mariadb without doing this.

hello,

I think that this is a problem with SELinux that is described in https://bugzilla.opensuse.org/show_bug.cgi?id=1255024

In short an update program for mariadb fails to run with SELinux activated.
So via root user set SELinux to permissive mode via setenforce 0. Then
restart mariadb via
systemctl restart mariadb
if this is seccusfully reset SELinux to enforcing setenforce 1

Regards
Philipppe

@phil524 Yes, I think you’re right: a known bug already.

@nickelarse Could you confirm if this is still an issue or may be fixed now? The fix should be part of mariadb-11.8.5-160000.3.1 . The only thing not working is the mariadb@.service which needs a pending update to the selinux-policy, that is currently in QA.

The normal mariadb.service should be fixed with the rpm and that should have gone out roughly around 17:00 on Feb 3rd. So far I got positive feedback, but not sure if there might be still something I missed to fix.

@rfrohl I’ve just run some updates, and it has pulled in a newer mariadb version, and it installed fine this time. Thanks for fixing!
Nick

1 Like

thanks, the confirmation is much appreciated.