Cyberithub

[Solved] Failed to start ConfigServer Firewall & Security - lfd Error

Advertisements

In this article, I will take you through the steps to solve failed to start ConfigServer Firewall & Security - lfd error. Last night when I was working with ConfigServer Security & Firewall(CSF), I encountered this error while trying to restart lfd service. So thought to create an article for this so that it will help others as well in case anyone else facing the same issue. While this error could happen due to multiple issues but we will see the most common one that led to this error. More about CSF.

[Solved] Failed to start ConfigServer Firewall & Security - lfd Error

[Solved] Failed to start ConfigServer Firewall & Security - lfd

Whenever you install CSF for the first time, you might have noticed that Testing mode will be enabled by default. You can notice this either by checking the status of the service using systemctl status csf command after starting or restarting the csf service.

Advertisements
root@localhost:~# systemctl status csf
● csf.service - ConfigServer Firewall & Security - csf
Loaded: loaded (/lib/systemd/system/csf.service; enabled; vendor preset: enabled)
Active: active (exited) since Tue 2021-12-07 13:32:57 IST; 3s ago
Process: 7742 ExecStart=/usr/sbin/csf --initup (code=exited, status=0/SUCCESS)
Main PID: 7742 (code=exited, status=0/SUCCESS)

Dec 07 13:32:57 localhost systemd[1]: Starting ConfigServer Firewall & Security - csf...
Dec 07 13:32:57 localhost csf[7742]: (restoring iptables) (restoring ip6tables) *WARNING* TESTING mode is enabled - do not forget to disable it in th>
Dec 07 13:32:57 localhost systemd[1]: Finished ConfigServer Firewall & Security - csf.

Or, you can also verify this by checking the value of TESTING parameter in /etc/csf/csf.conf file using grep -i Testing /etc/csf/csf.conf command as shown below.

root@localhost:~# grep -i Testing /etc/csf/csf.conf
# Testing flag - enables a CRON job that clears iptables incase of
TESTING = "1"
TESTING_INTERVAL = "5"
# unless TESTING is enabled above. The check is done every 300 seconds

If you forget to disable this Testing mode before starting or restarting lfd service then your lfd service restart will fail with error failed to start ConfigServer Firewall & Security - lfd as I was facing below.

Advertisements
root@localhost:~# systemctl status lfd
● lfd.service - ConfigServer Firewall & Security - lfd
Loaded: loaded (/lib/systemd/system/lfd.service; enabled; vendor preset: enabled)
Active: failed (Result: signal) since Tue 2021-12-07 13:13:50 IST; 29s ago
Process: 7474 ExecStart=/usr/sbin/lfd (code=killed, signal=KILL)

Dec 07 13:13:50 localhost systemd[1]: Starting ConfigServer Firewall & Security - lfd...
Dec 07 13:13:50 localhost systemd[1]: lfd.service: Control process exited, code=killed, status=9/KILL
Dec 07 13:13:50 localhost systemd[1]: lfd.service: Failed with result 'signal'.
Dec 07 13:13:50 localhost systemd[1]: Failed to start ConfigServer Firewall & Security - lfd.

So to fix this error, first you need to open csf.conf file using our favorite nano editor like below.

root@localhost:~# nano /etc/csf/csf.conf

Then search Testing parameter by pressing Ctrl+w and typing Testing in the Search and then Press Enter. If you do not get the correct parameter then Press Alt+w to get to the next match. Once you find it, you can change the Testing mode from 1 to 0 like below.

Advertisements
TESTING = "0"

Then Press Ctrl+X to save and exit. Type Y to confirm and exit. Once done then restart the CSF firewall with csr -r command as shown below.

root@localhost:~# csf -r
Flushing chain `INPUT'
Flushing chain `FORWARD'
Flushing chain `OUTPUT'
Flushing chain `PREROUTING'
Flushing chain `INPUT'
Flushing chain `OUTPUT'
Flushing chain `POSTROUTING'
Flushing chain `PREROUTING'
Flushing chain `OUTPUT'
Flushing chain `PREROUTING'
...........................................

Finally restart the lfd service to verify if indeed it is working. If the restart goes well, then you can check the status using systemctl status lfd command as shown below. It will show the service in active and in running state.

Advertisements
root@localhost:~# systemctl restart lfd
root@localhost:~# systemctl status lfd
● lfd.service - ConfigServer Firewall & Security - lfd
Loaded: loaded (/lib/systemd/system/lfd.service; enabled; vendor preset: enabled)
Active: active (running) since Tue 2021-12-07 14:03:29 IST; 5s ago
Process: 8079 ExecStart=/usr/sbin/lfd (code=exited, status=0/SUCCESS)
Main PID: 8092 (lfd - sleeping)
Tasks: 4 (limit: 4638)
Memory: 156.9M
CGroup: /system.slice/lfd.service
├─8092 lfd - sleeping
├─8100 lfd - checking system integrity
├─8101 sh -c /usr/bin/md5sum /usr/bin/* /usr/sbin/* /bin/* /sbin/* /usr/local/bin/* /usr/local/sbin/* /etc/init.d/* /etc/xinetd.d/*

Leave a Comment