Public bug reported:
The apt-daily-upgrade.timer is causing the MySQL service to shut down
repeatedly and unexpectedly. The service starts successfully but is then
stopped within seconds of a scheduled apt-daily-upgrade.timer run.
This behavior is caused by a systemd timer unintentionally calling an
outdated /etc/init.d/mysql script. The script contains killall commands
intended as a fail-safe for graceful shutdowns, but in this context,
they are being executed by the apt-daily process, which forcefully
terminates the MySQL service.
Steps to Reproduce
This issue was diagnosed using the following steps, which can be used to
observe the behavior:
Monitor the MySQL service status using systemctl status mysql.
sudo systemctl status mysql
Observe the systemd journal logs, filtered for the mysql.service, which show
the unexpected shutdowns coinciding with apt processes.
sudo journalctl -u mysql.service --since "1 day ago"
(Example log output showing the issue):
Aug 20 06:25:04 ip-172-31-27-102 systemd[1]: Starting mysql.service - MySQL
Community Server...
Aug 20 06:25:11 ip-172-31-27-102 systemd[1]: Started mysql.service - MySQL
Community Server.
Aug 20 06:25:14 ip-172-31-27-102 apt.systemd.daily[160407]: ...
Aug 20 06:25:16 ip-172-31-27-102 systemd[1]: Stopping mysql.service - MySQL
Community Server...
Aug 20 06:25:17 ip-172-31-27-102 systemd[1]: Stopped mysql.service - MySQL
Community Server.
Inspect the /etc/init.d/mysql script to find the killall commands that are
responsible for the forceful shutdown.
sudo cat /etc/init.d/mysql
(Relevant lines from script):
# Short-Description: Start and stop the mysql database server daemon
...
killall -15 mysqld
if test -z "$server_down"; then killall -9 mysqld; fi
Environment Details
Operating System: Debian/Ubuntu (based on apt, phpsessionclean.service and
/etc/init.d/ file structure).
MySQL Version: 5.7+ (based on /usr/share/doc/mysql-server-5.7/ path in
the script).
Proposed Solution / Workaround
The issue can be resolved by performing two steps:
Modify the legacy /etc/init.d/mysql script by commenting out the killall
commands. This prevents the script from having the ability to forcefully
shut down the service.
sudo nano /etc/init.d/mysql
Change the lines to:
# killall -15 mysqld
# if test -z "$server_down"; then killall -9 mysqld; fi
Disable the apt-daily-upgrade.timer to prevent the unintentional execution of
the legacy script.
sudo systemctl disable --now apt-daily-upgrade.timer
** Affects: apt (Ubuntu)
Importance: Undecided
Status: New
--
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.
https://bugs.launchpad.net/bugs/2121021
Title:
apt-daily-upgrade.timer unexpectedly stops MySQL service on
Ubuntu/Debian.
To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/apt/+bug/2121021/+subscriptions
--
ubuntu-bugs mailing list
[email protected]
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs