The source project of this merge request has been removed.
Don't require debian.cnf to be executable in logrotate configuration.
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 files should not be. Changing the test from -x
to -r
to ensure the file exists and is readable resolves the issue.