[Bug 2120936] Re: logrotate returns an error if mysql service is disabled
Ghadi Rahme
2120936 at bugs.launchpad.net
Tue Sep 9 07:44:54 UTC 2025
jammy verification:
root at build-jammy:~# apt list --installed mysql-server
Listing... Done
mysql-server/jammy-proposed,now 8.0.43-0ubuntu0.22.04.2 all [installed]
N: There are 2 additional versions. Please use the '-a' switch to see them.
root at build-jammy:~# systemctl stop mysql.service
root at build-jammy:~# systemctl status mysql.service
○ mysql.service - MySQL Community Server
Loaded: loaded (/lib/systemd/system/mysql.service; enabled; vendor preset: enabled)
Active: inactive (dead) since Tue 2025-09-09 07:43:27 UTC; 4s ago
Process: 39781 ExecStartPre=/usr/share/mysql/mysql-systemd-start pre (code=exited, status=0/SUCCESS)
Process: 39789 ExecStart=/usr/sbin/mysqld (code=exited, status=0/SUCCESS)
Main PID: 39789 (code=exited, status=0/SUCCESS)
Status: "Server shutdown complete"
CPU: 1.343s
Sep 09 07:42:14 build-jammy systemd[1]: Starting MySQL Community Server...
Sep 09 07:42:16 build-jammy systemd[1]: Started MySQL Community Server.
Sep 09 07:43:26 build-jammy systemd[1]: Stopping MySQL Community Server...
Sep 09 07:43:27 build-jammy systemd[1]: mysql.service: Deactivated successfully.
Sep 09 07:43:27 build-jammy systemd[1]: Stopped MySQL Community Server.
Sep 09 07:43:27 build-jammy systemd[1]: mysql.service: Consumed 1.343s CPU time.
root at build-jammy:~# sudo logrotate -f /etc/logrotate.conf
root at build-jammy:~# echo $?
0
This confirms that jammy is working as expected after this patch!
** Tags removed: verification-needed-jammy
** Tags added: verification-done-jammy
--
You received this bug notification because you are a member of Ubuntu
Sponsors, which is subscribed to the bug report.
https://bugs.launchpad.net/bugs/2120936
Title:
logrotate returns an error if mysql service is disabled
Status in mysql-8.0 package in Ubuntu:
New
Status in mysql-8.4 package in Ubuntu:
Fix Released
Status in mysql-8.0 source package in Jammy:
Fix Committed
Status in mysql-8.0 source package in Noble:
Fix Committed
Status in mysql-8.4 source package in Plucky:
Fix Committed
Status in mysql-8.4 source package in Questing:
Fix Released
Bug description:
[Description]
After the MR part of this bug report:
https://bugs.launchpad.net/ubuntu/+source/mysql-8.0/+bug/1850980
logrotate returns an error when running the mysql log rotation script
if the mysql service is disabled.
It is expected of logrotate not to return an error if the service is disabled since a disabled service will not generate logs to rotate anyways.
I have written a fix that checks first the status of the mysql service before running the rest of the log rotate script.
[Test Plan]
Run the following commands, and verify the output of logrotate:
$ sudo apt install mysql-server
$ sudo systemctl stop mysql.service
$ sudo logrotate -f /etc/logrotate.conf
If no error is returned by logrotate it means the fix was successful,
else the following error is shown:
error: error running shared postrotate script for '/var/log/mysql.log
/var/log/mysql/*log '
[Where problems could occur]
Since the changes is related to logs, possible issues may be that the script falsely detects that the mysql service is disabled and not rotate the logs.
Any problems resulting from this patch are expected to only be limited to log rotation.
To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/mysql-8.0/+bug/2120936/+subscriptions
More information about the Ubuntu-sponsors
mailing list