DA OpenLiteSpeed doesn't start after Restart Issued

Mahfuz-SS-EHL

Verified User
Joined
Oct 11, 2019
Messages
7
Hello, Whenever I restart OpenLiteSpeed, it shows it's failed & it takes about 5 minutes. I tried restarting from SSH, System Information > LiteSpeed > Reload, Service Monitor > LiteSpeed > Restart/Reload, /usr/local/lsws/bin/lswsctrl start etc. The log is as following:

Code:
[root@srv1 ~]# service litespeed status -l
Redirecting to /bin/systemctl status  -l litespeed.service
● litespeed.service - The LiteSpeed HTTP Server
   Loaded: loaded (/etc/systemd/system/litespeed.service; enabled; vendor preset: disabled)
   Active: failed (Result: protocol) since Mon 2021-08-16 20:46:04 +06; 1h 6min ago
  Process: 18500 ExecStop=/usr/local/lsws/bin/lswsctrl stop (code=exited, status=0/SUCCESS)
  Process: 4968 ExecStart=/usr/local/lsws/bin/lswsctrl start (code=exited, status=0/SUCCESS)
 Main PID: 25058 (code=exited, status=1/FAILURE)


Aug 16 20:46:01 srv1.ecarehost.com systemd[1]: Starting The LiteSpeed HTTP Server...
Aug 16 20:46:01 srv1.ecarehost.com lswsctrl[4968]: [OK] Send SIGUSR1 to 15497
Aug 16 20:46:04 srv1.ecarehost.com systemd[1]: Refusing to accept PID outside of service control group, acquired through unsafe symlink chain: /tmp/lshttpd/lshttpd.pid
Aug 16 20:46:04 srv1.ecarehost.com systemd[1]: Refusing to accept PID outside of service control group, acquired through unsafe symlink chain: /tmp/lshttpd/lshttpd.pid
Aug 16 20:46:04 srv1.ecarehost.com systemd[1]: Failed to start The LiteSpeed HTTP Server.
Aug 16 20:46:04 srv1.ecarehost.com systemd[1]: Unit litespeed.service entered failed state.
Aug 16 20:46:04 srv1.ecarehost.com systemd[1]: litespeed.service failed.

But, surprisingly, LiteSpeed is running & everything is working. DirectAdmin also showing it's running. Only, in the service list, it's showing failed & sometimes it shows it can't be started because it's in inactive mode.

Do you have any idea why litespeed doesn't start if I issue a restart command ??
 
Can you show systemd version?

also please: ls -la /tmp/lshttpd/lshttpd.pid + ps -o cgroup PID (that one that is content of this file).

Also please paste content of your systemd service unit: systemctl cat litespeed.service.
 
Can you show systemd version?

also please: ls -la /tmp/lshttpd/lshttpd.pid + ps -o cgroup PID (that one that is content of this file).

Also please paste content of your systemd service unit: systemctl cat litespeed.service.

Code:
[root@srv1 ~]# systemctl --version
systemd 219
+PAM +AUDIT +SELINUX +IMA -APPARMOR +SMACK +SYSVINIT +UTMP +LIBCRYPTSETUP +GCRYPT +GNUTLS +ACL +XZ +LZ4 -SECCOMP +BLKID +ELFUTILS +KMOD +IDN

Code:
[root@srv1 ~]# ls -la /tmp/lshttpd/lshttpd.pid
-rw-r--r-- 1 root apache 6 Aug 17 00:34 /tmp/lshttpd/lshttpd.pid


[root@srv1 ~]# cat /tmp/lshttpd/lshttpd.pid
15803

[root@srv1 ~]# ps -o cgroup 15803
CGROUP
12:devices:/user.slice,1:name=systemd:/user.slice/user-0.slice/session-c4510.scope

Code:
[root@srv1 ~]# systemctl cat litespeed.service
# /etc/systemd/system/litespeed.service
# should be added as /etc/systemd/system/litespeed.service
[Unit]
Description=The LiteSpeed HTTP Server
After=network.target remote-fs.target nss-lookup.target
Wants=network-online.target


[Service]
Type=forking
PIDFile=/tmp/lshttpd/lshttpd.pid
ExecStart=/usr/local/lsws/bin/lswsctrl start
ExecReload=/usr/local/lsws/bin/lswsctrl restart
ExecStop=/usr/local/lsws/bin/lswsctrl stop


KillMode=none
PrivateTmp=false


# do not want to be limited in anyway
CPUAccounting=false
TasksAccounting=false
MemoryAccounting=false


[Install]
WantedBy=multi-user.target
Alias=lsws.service
Alias=lshttpd.service
Alias=openlitespeed.service
 
Error is due to hardening of systemd 219.67.

As systemd service is enabled you should use systemctl to manage it's state, for example you had started service via systemd you should't be stopping from wrapper manually. If you want to manage it from panel it should also use systemctl.

You can move PIDFile to /var/run/litespeed chowned by root:root?
I run ls-sapi so not familliar with litespeed. Are these scripts dropping priviledges from root?
Or you can remove PIDFile from service definition. Systemd is quite good at determinig MAINPID in forking. As long as cgroup will be not empty service monitoring should be good.
 
Error is due to hardening of systemd 219.67.

As systemd service is enabled you should use systemctl to manage it's state, for example you had started service via systemd you should't be stopping from wrapper manually. If you want to manage it from panel it should also use systemctl.

You can move PIDFile to /var/run/litespeed chowned by root:root?
I run ls-sapi so not familliar with litespeed. Are these scripts dropping priviledges from root?
Or you can remove PIDFile from service definition. Systemd is quite good at determinig MAINPID in forking. As long as cgroup will be not empty service monitoring should be good.
Though I didn't understand most of the part, did you mean I should issue the commands of start, stop, restart via systemctl ??
 
Yes. You can try deleting PIDFile section and see if this fixes the issue.
If you want only systemd to startup your service on boot, as you don't have defined any restart options can also give a try with oneshoot service type.
If your wrapper will exit successfully systemd will assume service is active and will not care at all about content of cgroup or if MAINPID is alive.
That way you can restart it from wrappers and manage - Systemd will only make startup on reboot.
Using forking type of service means that systemd will take as MAINPID fork children and will monitor it's state and with some restart option like on-failure if MAINPID dies it will restart the service automaticaly.
 
Back
Top