Comment 2 for bug 2051766

Revision history for this message
NetVicious (netvicious) wrote (last edit ):

Sorry for the late answer. I got the same problem today with nginx.

On this box I'm using "Ubuntu 22.04.4 LTS" fully updated.

Log for today problem:

Restarting services...
 systemctl restart acpid.service atd.service chrony.service irqbalance.service multipathd.service nginx.service packagekit.service polkit.service rsyslog.service <email address hidden> snapd.service ssh.service systemd-journald.service systemd-networkd.service systemd-resolved.service systemd-udevd.service udisks2.service
Job for nginx.service failed because the control process exited with error code.
See "systemctl status nginx.service" and "journalctl -xeu nginx.service" for details.
Service restarts being deferred:
 systemctl restart ModemManager.service
 /etc/needrestart/restart.d/dbus.service
 systemctl restart <email address hidden>
 systemctl restart networkd-dispatcher.service
 systemctl restart systemd-logind.service
 systemctl restart unattended-upgrades.service

After that failure I restarted nginx manually and all went ok.

Journal:

Jun 03 09:32:16 ip-172-31-14-249 systemd[1]: Failed to start A high performance web server and a reverse proxy server.
░░ Subject: A start job for unit nginx.service has failed
░░ Defined-By: systemd
░░ Support: http://www.ubuntu.com/support
░░
░░ A start job for unit nginx.service has finished with a failure.
░░
░░ The job identifier is 35305 and the job result is failed.
Jun 03 09:32:37 ip-172-31-14-249 systemd[1]: Starting A high performance web server and a reverse proxy server...
░░ Subject: A start job for unit nginx.service has begun execution
░░ Defined-By: systemd
░░ Support: http://www.ubuntu.com/support
░░
░░ A start job for unit nginx.service has begun execution.
░░
░░ The job identifier is 36224.

tail -f /var/log/nginx/error.log
(name of the upstreamserver changed ;-)

2024/06/03 00:54:37 [notice] 136414#136414: signal process started
2024/06/03 09:32:16 [emerg] 140604#140604: host not found in upstream "myupstreamserver.com" in /etc/nginx/sites-enabled/upstreams.conf:14
2024/06/03 09:32:37 [info] 140749#140749: Using 131072KiB of shared memory for nchan in /etc/nginx/nginx.conf:62
2024/06/03 09:37:06 [info] 140769#140769: Using 131072KiB of shared memory for nchan in /etc/nginx/nginx.conf:62
2024/06/03 09:37:09 [notice] 140772#140772: signal process started

As you can see on my previous message, proftpd said it cannot determine IP address of a dns resource. And on this case nginx says something similar.

So I think needrestart doesn't waits till the network and dns are ok before restarting other services which need network and dns operative.