In this tutorial, I’ll walk you through resolving a common issue encountered when setting up services like the Wazuh-Agent on Linux. I am using Rocky Linux and the problem showed as I tried to enable wazuh-agent. Let’s use the Wazuh-Agent as our example to illustrate the solution to the following error message when attempting to enable a service:

wazuh_agent_error
output:

  Synchronizing state of wazuh-agent.service with SysV service script with /usr/lib/systemd/systemd-sysv-install. 
Executing: /usr/lib/systemd/systemd-sysv-install enable wazuh-agent 
Failed to execute /usr/lib/systemd/systemd-sysv-install: No such file or directory
  

However, the solution is straightforward. You just need to install a package called chkconfig. Here’s what you need to do:

Open your terminal and run the following command and accept the installation:

  dnf install chkconfig
  

Once the installation is complete, you’re almost there. Now, attempt to enable the service you want again. In my case it is the Wazuh-Agent service:

  systemctl enable wazuh-agent
  

With chkconfig installed, the command should execute successfully without encountering any errors. You’re now all set to proceed with running Wazuh-Agent on your Rocky Linux system hassle-free.

Conclusion

In conclusion, troubleshooting errors like “Failed to execute /usr/lib/systemd/systemd-sysv-install” during service setup on Rocky Linux can be challenging, but with the right guidance, it becomes a manageable task. By using the Wazuh-Agent installation as an example, we’ve demonstrated a straightforward solution that involves installing the chkconfig package. This not only resolves the specific error encountered but also provides a valuable learning opportunity for handling similar issues in the future.