Source: mariadb-10.5
Version: 1:10.5.11-1
Severity: important
Tags: patch

Dear Maintainer,

When using a non-default configuration with password access to the database, 
the logrotate postscript fails causing the systemd service to be marked as 
failed:

 ● logrotate.service - Rotate log files
      Loaded: loaded (/lib/systemd/system/logrotate.service; static)
      Active: failed (Result: exit-code) since Wed 2021-09-15 00:00:01 CEST; 6h 
ago
 TriggeredBy: ● logrotate.timer
        Docs: man:logrotate(8)
              man:logrotate.conf(5)
     Process: 4138993 ExecStart=/usr/sbin/logrotate /etc/logrotate.conf 
(code=exited, status=1/FAILURE)
    Main PID: 4138993 (code=exited, status=1/FAILURE)
         CPU: 204ms

 Sep 15 00:00:01 foobar systemd[1]: Starting Rotate log files...
 Sep 15 00:00:01 foobar logrotate[4139061]: [64B blob data]
 Sep 15 00:00:01 foobar logrotate[4139061]: error: 'Access denied for user 
'root'@'localhost' (using password: NO)'
 Sep 15 00:00:01 foobar logrotate[4138993]: error: error running shared 
postrotate script for '/var/lib/mysql/mysqld.log /var/log/mysql/mysql.log 
/var/lib/mysql/mariadb.log /var/log/mysql/mysql-slow.log 
/var/log/mysql/mariadb-s>
 Sep 15 00:00:01 foobar systemd[1]: logrotate.service: Main process exited, 
code=exited, status=1/FAILURE
 Sep 15 00:00:01 foobar systemd[1]: logrotate.service: Failed with result 
'exit-code'.
 Sep 15 00:00:01 foobar systemd[1]: Failed to start Rotate log files.

The problem is that the postrotate script only uses /etc/mysql/debian.cnf when 
it is executable, which a config file should not be. Changing the test from -x 
to -r to ensure the file exists and is readable resolves the issue.

Please consider applying the attached patch and including it in the next stable 
update.

Kind Regards,

Bas
--- debian/patches/1556.patch.orig      2021-09-15 06:39:17.106829777 +0200
+++ debian/patches/1556.patch   2021-09-15 06:40:47.294168561 +0200
@@ -146,7 +146,7 @@
 +  # has thanks to the default use of Unix socket authentication for the 'root'
 +  # account used everywhere since MariaDB 10.4.
 +  postrotate
-+    if test -x /etc/mysql/debian.cnf
++    if test -r /etc/mysql/debian.cnf
 +    then
 +      EXTRAPARAM='--defaults-file=/etc/mysql/debian.cnf'
 +    fi

Reply via email to