Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Investigate RHEL9 service installation error #1626

Closed
alberpilot opened this issue Jun 6, 2022 · 8 comments · Fixed by #1675 or #2053
Closed

Investigate RHEL9 service installation error #1626

alberpilot opened this issue Jun 6, 2022 · 8 comments · Fixed by #1675 or #2053
Assignees

Comments

@alberpilot
Copy link
Contributor

The Wazuh agent installation have the following error on RHEL9:

Failed to execute /usr/lib/systemd/systemd-sysv-instal: No such file or directory

We need to determine the root cause and try to fix it.

@DFolchA
Copy link
Contributor

DFolchA commented Jun 9, 2022

Update

This issue appears when enabling the service in RHEL9

[root@rhel9 vagrant]# systemctl enable wazuh-agent
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 director

The problem appears because in RHEL9 the file /usr/lib/systemd/systemd-sysv-install was removed. Here RHEL indicates the following:

SYSV INIT.D SCRIPTS:
        When calling "systemctl enable/disable/is-enabled" on a unit which is a
        SysV init.d script, it calls /usr/lib/systemd/systemd-sysv-install;
        this needs to translate the action into the distribution specific
        mechanism such as chkconfig or update-rc.d. Packagers need to provide
        this script if you need this functionality (you don't if you disabled
        SysV init support).

        Please see src/systemctl/systemd-sysv-install.SKELETON for how this
        needs to look like, and provide an implementation at the marked places.

So we will need to add the systemd-sysv-install to the packages or not install the init.d script in rhel9 systems.

@rauldpm rauldpm self-assigned this Jun 14, 2022
@rauldpm rauldpm moved this from Todo to In progress in Release 4.3.5 Jun 14, 2022
@rauldpm rauldpm removed their assignment Jun 14, 2022
@rauldpm rauldpm moved this from In progress to Todo in Release 4.3.5 Jun 14, 2022
@snaow
Copy link
Contributor

snaow commented Jun 15, 2022

Related: wazuh/wazuh#13602

@alberpilot alberpilot assigned okynos and unassigned DFolchA Jun 20, 2022
Repository owner moved this from Todo to Done in Release 4.3.5 Jun 22, 2022
@didierm
Copy link

didierm commented Oct 5, 2022

@alberpilot @okynos
Please reopen, as this issue also occurs on e.g. AlmaLinux 9 (an RHEL9 derivative), and probably on all other derivatives (e.g. Rocky Linux 9) too.

The fix in https://github.com/wazuh/wazuh-packages/pull/1675/files/e2ddbef5a383b9a81d216fe959cda7dcae009662#r988236307 only checks for {NAME}" = "Red Hat Enterprise Linux"

AlmaLinux 9 /etc/os-release example :

NAME="AlmaLinux"
VERSION="9.0 (Emerald Puma)"
ID="almalinux"
ID_LIKE="rhel centos fedora"
VERSION_ID="9.0"
PLATFORM_ID="platform:el9"
PRETTY_NAME="AlmaLinux 9.0 (Emerald Puma)"
ANSI_COLOR="0;34"
LOGO="fedora-logo-icon"
CPE_NAME="cpe:/o:almalinux:almalinux:9::baseos"
HOME_URL="https://almalinux.org/"
DOCUMENTATION_URL="https://wiki.almalinux.org/"
BUG_REPORT_URL="https://bugs.almalinux.org/"

ALMALINUX_MANTISBT_PROJECT="AlmaLinux-9"
ALMALINUX_MANTISBT_PROJECT_VERSION="9.0"
REDHAT_SUPPORT_PRODUCT="AlmaLinux"
REDHAT_SUPPORT_PRODUCT_VERSION="9.0"

@rauldpm
Copy link
Member

rauldpm commented Nov 2, 2022

Related: #1918

@verdx
Copy link
Contributor

verdx commented Jan 19, 2023

As said in previous comments, not installing init.d when it is not needed would solve this problem. Issue #1918 would so solve this problem for any distribution. As a temporary workaround, the fix that was done for Red Hat Enterprise Linux 9> is being extended to the rest of its derivative OS's. The only Red Hat Enterprise Linux derivatives that have released a version based on version 9 are Alma Linux, Rocky Linux , as seen here. The rest of distributions have been checked one by one and at date 19/01/2023 none have a version based on RHEL 9. Oracle version does have a version 9 based off of Red Hat Enterprise Linux 9, but has been tested and does not replicate the error, for whatever reason.

Replicated in each distribution

  • Alma Linux 9:
[root@alma9 vagrant]# systemctl enable wazuh-agent
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
  • Rocky LInux 9:
[root@rocky9 vagrant]# systemctl enable wazuh-agent
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
[root@rocky9 vagrant]# 

  • Oracle Linux 9:
[root@oracle9 vagrant]# systemctl enable wazuh-agent
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
Created symlink /etc/systemd/system/multi-user.target.wants/wazuh-agent.service → /usr/lib/systemd/system/wazuh-agent.service.
[root@oracle9 vagrant]#  

@verdx
Copy link
Contributor

verdx commented Jan 23, 2023

After some problems with the debugging for the Github Actions test, finally using act made it possible to see the errors, a file wrongly typed and the fact that the variables used in the ubuntu docker aren't accessible in the docker created inside it. Both errors are now fixed in commit 163d3b6 and the tests have been launched again.

@verdx
Copy link
Contributor

verdx commented Jan 23, 2023

@verdx
Copy link
Contributor

verdx commented Feb 2, 2023

As per this commentary in the Pull Request, both CentOS 9 Stream and Fedora 34 have been tested and the error has been discovered in both of them. Both have been added to the fix.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
No open projects
Status: Done
Status: Done
8 participants