wazuh-packages
wazuh-packages copied to clipboard
`systemctl disable` output is masked and failure is not handled
I just tried to remove wazuh from a system and the apt/dpkg process failed miserably.
It took too much effort to debug, the error was from this line: https://github.com/wazuh/wazuh-packages/blob/daeeaa51b6d7f1c60d30ccbd69e413e414fca7b0/debs/SPECS/wazuh-manager/debian/preinst#L69
At the very least, if the output and error are going to be ignored, the error code should as well.
For debugging, I changed the code...
-systemctl disable wazuh-api.service > /dev/null 2>&1
+systemctl disable wazuh-api.service || echo echo disable failed -- oh well
Here's the run w/ that change (under sh -x
):
+ systemctl disable wazuh-agent
Synchronizing state of wazuh-agent.service with SysV service script with /lib/systemd/systemd-sysv-install.
Executing: /lib/systemd/systemd-sysv-install disable wazuh-agent
Failed to disable unit: Too many levels of symbolic links
+ echo disable failed -- oh well
disable failed -- oh well