Ad Widget

Collapse

mysql service is shutdown auto in Ubuntu,

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • nczaw
    Member
    • Sep 2023
    • 31

    #1

    mysql service is shutdown auto in Ubuntu,

    Hi all,

    I'm running Zabbix 7.2.2 on Ubuntu 24 LTS with MySQL. I got the log below, and it looks like the MySQL service is RECEIVE SHUTDOWN, and I can't start it manually. However, after rebooting the VM, it starts fine. Has anyone experienced this issue before?

    2025-02-21T06:44:02.291959Z 0 [System] [MY-013172] [Server] Received SHUTDOWN from user <via user signal>. Shutting down mysqld (Version: 8.0.41-0ubuntu0.24.04.1).
    2025-02-21T06:44:04.296743Z 0 [Warning] [MY-010909] [Server] /usr/sbin/mysqld: Forcing close of thread 127536 user: 'zabbix'.
    2025-02-21T06:44:04.296835Z 0 [Warning] [MY-010909] [Server] /usr/sbin/mysqld: Forcing close of thread 127554 user: 'zabbix'.
    2025-02-21T06:44:04.296877Z 0 [Warning] [MY-010909] [Server] /usr/sbin/mysqld: Forcing close of thread 127570 user: 'zabbix2'.
    2025-02-21T06:44:04.296948Z 0 [Warning] [MY-010909] [Server] /usr/sbin/mysqld: Forcing close of thread 127539 user: 'zabbix'.
    2025-02-21T06:44:04.297177Z 0 [Warning] [MY-010909] [Server] /usr/sbin/mysqld: Forcing close of thread 127548 user: 'zabbix'.
    2025-02-21T06:44:04.297224Z 0 [Warning] [MY-010909] [Server] /usr/sbin/mysqld: Forcing close of thread 127540 user: 'zabbix'.
    2025-02-21T06:44:04.297255Z 0 [Warning] [MY-010909] [Server] /usr/sbin/mysqld: Forcing close of thread 127565 user: 'zabbix'.
    2025-02-21T06:44:04.297288Z 0 [Warning] [MY-010909] [Server] /usr/sbin/mysqld: Forcing close of thread 127541 user: 'zabbix'.
    2025-02-21T06:44:04.297349Z 0 [Warning] [MY-010909] [Server] /usr/sbin/mysqld: Forcing close of thread 127551 user: 'zabbix'.
    2025-02-21T06:44:04.297388Z 0 [Warning] [MY-010909] [Server] /usr/sbin/mysqld: Forcing close of thread 127543 user: 'zabbix'.
    2025-02-21T06:44:04.297443Z 0 [Warning] [MY-010909] [Server] /usr/sbin/mysqld: Forcing close of thread 127535 user: 'zabbix'.
    2025-02-21T06:44:07.080754Z 0 [System] [MY-010910] [Server] /usr/sbin/mysqld: Shutdown complete (mysqld 8.0.41-0ubuntu0.24.04.1) (Ubuntu).
    ​
  • nickologicsnmp
    Junior Member
    • Sep 2023
    • 1

    #2
    Yes, I am experiencing the same issue. I am running Zabbix V7 with Ubuntu 24.04.1 LTS

    @zabbix:~$ tail /var/log/mysql/error.log

    2025-02-26T07:05:05.162641Z 0 [Warning] [MY-010909] [Server] /usr/sbin/mysqld: Forcing close of thread 5604 user: 'zabbix'.
    2025-02-26T07:05:05.163624Z 0 [Warning] [MY-010909] [Server] /usr/sbin/mysqld: Forcing close of thread 5620 user: 'zabbix'.
    2025-02-26T07:05:05.163766Z 0 [Warning] [MY-010909] [Server] /usr/sbin/mysqld: Forcing close of thread 5613 user: 'zabbix'.
    2025-02-26T07:05:05.164646Z 0 [Warning] [MY-010909] [Server] /usr/sbin/mysqld: Forcing close of thread 5605 user: 'zabbix'.
    2025-02-26T07:05:05.164843Z 0 [Warning] [MY-010909] [Server] /usr/sbin/mysqld: Forcing close of thread 5614 user: 'zabbix'.
    2025-02-26T07:05:05.165530Z 0 [Warning] [MY-010909] [Server] /usr/sbin/mysqld: Forcing close of thread 5606 user: 'zabbix'.
    2025-02-26T07:05:05.165706Z 0 [Warning] [MY-010909] [Server] /usr/sbin/mysqld: Forcing close of thread 5615 user: 'zabbix'.
    2025-02-26T07:05:05.166799Z 0 [Warning] [MY-010909] [Server] /usr/sbin/mysqld: Forcing close of thread 5599 user: 'zabbix'.
    2025-02-26T07:05:05.166958Z 0 [Warning] [MY-010909] [Server] /usr/sbin/mysqld: Forcing close of thread 5623 user: 'zabbix'.
    2025-02-26T07:05:06.892762Z 0 [System] [MY-010910] [Server] /usr/sbin/mysqld: Shutdown complete (mysqld 8.0.41-0ubuntu0.24.04.1) (Ubuntu).


    When I reboot the server works fine
    Thanks
    Nick

    Comment

    • Managor
      Junior Member
      • Feb 2025
      • 2

      #3
      I encountered this and I assume the root cause of this is apt-daily-upgrade.timer. The time the service ran and when mysql died seemed to align. Can anyone confirm if the dates on your systems align?

      Comment

      • Keith Langmead
        Junior Member
        • Nov 2026
        • 1

        #4
        I've had the same thing each time a MySQL / Zabbix update installed, when those two services were restarted. From other threads it seems to be somehow related to dependencies, with MySQL starting to shutdown, Zabbix failing to stop because it can't see the DB, and then everything getting stuck so attempts to manually stop either service fails.

        Initially tried updating the zabbix-server.service and mysql.service files in /lib/systemd/system to expressly tell it the order to use, eg adding :

        After=mysql.service

        to the former, and :

        Before=zabbix-server.service

        to the latter, but while that may work for normal shutdown/startup it doesn't seem to do the trick for those unattended updates.

        However, what I've now done, and which appears to have worked (at least the last unattended update last night impacting both Zabbix and MySQL worked without locking everything up) :

        Within /etc/needrestart/restart.d, create a new file called mysql.service, with the same permissions and ownership as the existing files.

        Edit that file and set the following within it :

        Code:
        #!/bin/bash
        # Restarting mysql.service but only after stopping zabbix-server.service and then restarting zabbix afterwards to avoid issue where the services get stuck.
        
        echo "`date` - Stopping Zabbix-Server" >> ~/mysql-zabbix-restart.log
        exec systemctl stop zabbix-server.service &
        sleep 10s
        echo "`date` - Restarting MySQL" >> ~/mysql-zabbix-restart.log
        exec systemctl restart mysql.service &
        sleep 10s
        echo "`date` - Starting Zabbix-Server" >> ~/mysql-zabbix-restart.log
        exec systemctl start zabbix-server.service
        When an unattended update gets installed, because that mysql.service file exists the system will use that script to handle restarting MySQL rather than doing it directly, so it ensures that before restarting MySQL it will stop the Zabbix-Server service, THEN do the MySQL restart, and then start Zabbix-Server again.

        Note, the sleep timer may not be needed, but I added it to be on the same side. And similarly the logging isn't necessarily needed, but I wanted to be able to see when the new method had been used rather than it being done natively.

        Attached Files

        Comment

        Working...