I have experienced two Zabbix Server outages this week after unattended-upgrades on our Linux monitoring stack.

The problem Link to heading

During an unattended upgrade, needrestart attempted to restart a number of services - including MySQL and Zabbix Server:

Running kernel seems to be up-to-date.

Restarting services...
 /etc/needrestart/restart.d/systemd-manager
 systemctl restart ... mysql.service ... zabbix-server.service

Though Zabbix Server seems to hang when MySQL isn’t available to it:

● zabbix-server.service - Zabbix Server
     Loaded: loaded (/usr/lib/systemd/system/zabbix-server.service; enabled; preset: enabled)
     Active: deactivating (stop-sigterm) since Wed 2026-09-02 06:19:03 BST; 5h 52min ago

The Zabbix logs show a number of entries complaining about failing to connect to the DB:

2207357:20260902:121234.134 [Z3001] connection to database 'zabbix' failed: [2002] Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2)
2207357:20260902:121234.134 database is down: reconnecting in 10 seconds

The fix Link to heading

The fix is two-fold:

Tell needrestart not to touch Zabbix-Server or the DB Link to heading

Create a config file, amending for your database of choice:

sudo tee /etc/needrestart/conf.d/90-zabbix-mysql.conf >/dev/null <<'EOF'

$nrconf{override_rc}{qr(^zabbix-server\.service$)} = 0;
$nrconf{override_rc}{qr(^mysql\.service$)} = 0;
EOF

Set a timeout for Zabbix-Server Link to heading

The service file provided infinite for the timeout, meaning this outage dragged on for just under 6 hours.

Edit the zabbix-server config file with sudo systemctl edit zabbix-server, adding an override:

[Service]
TimeoutStopSec=5min

This should provide enough time for database commits and a clean shutdown under normal circumstances, yet not too long if the DB fails / stops before zabbix-server tries to shut down.