There is a bug on systemd script Virtualmin creates for domains. After setting up server with Virtualmin and nginx, all sites go down with error 502 Bad Gateway after a reboot. Everything works fine until the reboot.
After researching I found that it is an error with startup scripts Virtualmin creates inside /lib/systemd/system/ directory. The error is in the line 6 of each file.
ExecStop=su user -c kill\ \`cat\ \/var\/php\-nginx\/160827070023515\.php\.pid\` ; sleep 1
This needs to be changed to
ExecStop=/bin/sh -c 'su user -c kill\ \`cat\ \/var\/php\-nginx\/160827070023515\.php\.pid\` ; sleep 1'
for sites to work again. I think this is something that need to be corrected on the next release. I've posted detailed information and temporary workaround for this on my blog post https://vpsfix.com/13883/nginx-executable-path-is-not-absolute/
Thanks!
Status:
Active
Virtualmin version:
6.14
Webmin version:
1.962
Comments
Submitted by JamieCameron on Sat, 12/19/2020 - 14:10 Comment #1
Instead, would it work to use the absolute path to the
su
command instead of putting it inside /bin/sh ?Submitted by tonyant on Mon, 12/21/2020 - 18:40 Comment #2
I can confirm this bug on my Ubuntu 18.04.5 Virtuozzo VPS instance with PHP7.4
Yes JamieCameron, if you try it this way:
** You just have to remember to encapsulate the entire kill command + sleep 'in single quotes'
The alternate method that works is to make it similar to the ExecStart as Freddy63 which is ALREADY using /bin/sh
This bug seems to have been introduced sometime on the last update by virtualmin or ubuntu.
ISSUE SHOULD BE CHANGED TO CRITICAL -- As soon as anyone reboots their server, all their websites will not come back up with PHP daemons until it is fixed.
Submitted by tonyant on Mon, 12/21/2020 - 23:43 Comment #3
By the way, the troubling thing also, is when setting up a new virtualmin virtual server, it shows:
...after an extra long pause. (it must be exiting status 0??) Even if systemctl status shows this:
This is enough to drive a system administrator crazy not knowing why php-fcgi isn't starting an daemon for the site and why virtualmin isn't complaining either.
Submitted by JamieCameron on Tue, 12/22/2020 - 15:55 Comment #4
In the next release, we'll use the absolute path to the su command.
It's odd that on some Linux distros, just using "su" does work fine though. Normally I'd expect that command to be in the regular $PATH