I encountered an issue today with the Nginx service running as a container on our Ubuntu 20.04.6 LTS server. The service was in a stopped state, and I had to restart it manually.
I've attached a snippet from the syslog for reference. It appears that several services were restarted automatically, but Nginx failed to start. and we restarted the service manually.
Could anyone shed light on why the Nginx service stopped and didn't restart on its own? I'm also keen to understand how we can prevent similar situations in the future.
Your insights and suggestions are greatly appreciated.
Feb 28 06:44:08 elephantus systemd[1]: Starting Daily apt upgrade and clean activities...
Feb 28 06:44:13 elephantus systemd[1]: Reloading.
Feb 28 06:44:14 elephantus systemd[1]: Stopping Network Time Synchronization...
Feb 28 06:44:14 elephantus systemd[1]: systemd-timesyncd.service: Succeeded.
Feb 28 06:44:14 elephantus systemd[1]: Stopped Network Time Synchronization.
Feb 28 06:44:14 elephantus systemd[1]: Starting Network Time Synchronization...
Feb 28 06:44:14 elephantus systemd[1]: Started Network Time Synchronization.
Feb 28 06:44:14 elephantus systemd-timesyncd[343836]: Initial synchronization to time server 169.254.169.123:123 (169.254.169.123).
Feb 28 06:44:14 elephantus systemd[1]: Reexecuting.
Feb 28 06:44:14 elephantus kernel: [8457879.332950] systemd[1]: systemd 245.4-4ubuntu3.23 running in system mode. (+PAM +AUDIT +SELINUX +IMA +APPARMOR +SMACK +SYSVINIT +UTMP +LIBCRYPTSETUP +GCRYPT +GNUTLS +ACL +XZ +LZ4 +SECCOMP +BLKID +ELFUTILS +KMOD +IDN2 -IDN +PCRE2 default-hierarchy=hybrid)
Feb 28 06:44:14 elephantus kernel: [8457879.333021] systemd[1]: Detected virtualization xen.
Feb 28 06:44:14 elephantus kernel: [8457879.333027] systemd[1]: Detected architecture x86-64.
Feb 28 06:44:14 elephantus systemd[1]: Starting Refresh fwupd metadata and update motd...
Feb 28 06:44:14 elephantus systemd[1]: Condition check resulted in OpenVSwitch configuration for cleanup being skipped.
Feb 28 06:44:14 elephantus systemd[1]: systemd-networkd-wait-online.service: Succeeded.
Feb 28 06:44:14 elephantus systemd[1]: Stopped Wait for Network to be Configured.
Feb 28 06:44:14 elephantus systemd[1]: Stopping Wait for Network to be Configured...
Feb 28 06:44:14 elephantus systemd[1]: Stopping Network Service...
Feb 28 06:44:14 elephantus systemd[343880]: fwupd-refresh.service: Failed to determine user credentials: No such process
Feb 28 06:44:14 elephantus systemd[343880]: fwupd-refresh.service: Failed at step USER spawning /usr/bin/fwupdmgr: No such process
Feb 28 06:44:14 elephantus systemd[1]: fwupd-refresh.service: Main process exited, code=exited, status=217/USER
Feb 28 06:44:14 elephantus systemd[1]: fwupd-refresh.service: Failed with result 'exit-code'.
Feb 28 06:44:14 elephantus systemd[1]: Failed to start Refresh fwupd metadata and update motd.
Feb 28 06:44:14 elephantus systemd[1]: systemd-networkd.service: Succeeded.
Feb 28 06:44:14 elephantus systemd[1]: Stopped Network Service.
Feb 28 06:44:14 elephantus systemd[1]: Starting Network Service...
Feb 28 06:44:41 elephantus systemd[1]: Stopping Login Service...
Feb 28 06:44:41 elephantus systemd[1]: systemd-logind.service: Succeeded.
Feb 28 06:44:41 elephantus systemd[1]: Stopped Login Service.
Feb 28 06:44:41 elephantus systemd[1]: Condition check resulted in Load Kernel Module drm being skipped.
Feb 28 06:44:41 elephantus systemd[1]: Starting Login Service...
Feb 28 06:44:42 elephantus systemd[1]: Started Login Service.
Feb 28 06:44:42 elephantus systemd[1]: Reloading.
Feb 28 06:44:43 elephantus systemd[1]: message repeated 2 times: [ Reloading.]
Feb 28 06:44:43 elephantus systemd[1]: Stopping nginx container...
Feb 28 06:44:44 elephantus nginx[329832]: 2024/02/28 06:44:44 [notice] 1#1: signal 3 (SIGQUIT) received, shutting down
Feb 28 06:44:44 elephantus nginx[329832]: 2024/02/28 06:44:44 [notice] 21#21: gracefully shutting down
Feb 28 06:44:44 elephantus nginx[329832]: 2024/02/28 06:44:44 [notice] 21#21: exiting
Feb 28 06:44:44 elephantus nginx[329832]: 2024/02/28 06:44:44 [notice] 21#21: exit
Feb 28 06:44:44 elephantus nginx[329832]: 2024/02/28 06:44:44 [notice] 1#1: signal 17 (SIGCHLD) received from 21
Feb 28 06:44:44 elephantus nginx[329832]: 2024/02/28 06:44:44 [notice] 1#1: worker process 21 exited with code 0
Feb 28 06:44:44 elephantus nginx[329832]: 2024/02/28 06:44:44 [notice] 1#1: exit
2024/02/28 07:56:35 [emerg] 1#1: host not found in upstream "grafana" in /etc/nginx/conf.d/grafana.conf:15
nginx: [emerg] host not found in upstream "grafana" in /etc/nginx/conf.d/grafana.conf:15
After restarting,
2024/02/28 07:58:02 [notice] 1#1: using the "epoll" event method
2024/02/28 07:58:02 [notice] 1#1: nginx/1.23.0
2024/02/28 07:58:02 [notice] 1#1: built by gcc 11.2.1 20220219 (Alpine 11.2.1_git20220219)
2024/02/28 07:58:02 [notice] 1#1: OS: Linux 5.15.0-1049-aws
2024/02/28 07:58:02 [notice] 1#1: getrlimit(RLIMIT_NOFILE): 1048576:1048576
2024/02/28 07:58:02 [notice] 1#1: start worker processes
2024/02/28 07:58:02 [notice] 1#1: start worker process 21
2024/02/28 07:56:35 [emerg] 1#1: host not found in upstream "grafana" in /etc/nginx/conf.d/grafana.conf:15
That's a hard fail on the NGINX config.