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

Unexpected Prompt About PackageKit Restart When Installing Wazuh Agent DEB After apt purge #347

Closed
Tracked by #241
vikman90 opened this issue Nov 25, 2024 · 2 comments · Fixed by #375
Closed
Tracked by #241
Assignees
Labels
level/task Task issue module/packages Agent packages mvp Minimum Viable Product refinement type/bug Bug issue

Comments

@vikman90
Copy link
Member

vikman90 commented Nov 25, 2024

Parent Issue: #241

Description

After completely removing the Wazuh Agent DEB package using apt purge, reinstalling the package triggers an unexpected prompt during the installation process. The prompt asks whether the packagekit service should be restarted. This behavior is unusual and not expected during the installation of the Wazuh Agent.

image

Expected Behavior

  • Installing the Wazuh Agent DEB package should proceed without any prompts related to packagekit or unrelated services.

Steps to Reproduce

  1. Install the Wazuh Agent DEB package:
    sudo apt install ./wazuh-agent_x.x.x_xxx.deb
  2. Remove the package completely:
    sudo apt purge wazuh-agent
  3. Reinstall the same package:
    sudo apt install ./wazuh-agent_x.x.x_xxx.deb
  4. Observe the unexpected prompt about restarting the packagekit service.

Root Cause Hypothesis

This behavior might be linked to:

  1. Incorrect dependencies or hooks included in the DEB package.
  2. An unexpected interaction with systemd service management during the installation process.

Tasks

  1. Investigate the package metadata and scripts (preinst, postinst, etc.) to identify any triggers or dependencies related to packagekit.
  2. Verify if the packagekit service is being incorrectly referenced or affected during the package installation.
  3. Adjust the package configuration to eliminate the prompt unless absolutely necessary.
  4. Test the updated package to ensure the prompt no longer appears.
@vikman90 vikman90 added level/task Task issue type/bug Bug issue module/packages Agent packages mvp Minimum Viable Product refinement labels Nov 25, 2024
@wazuhci wazuhci moved this to Backlog in Release 5.0.0 Nov 25, 2024
@jotacarma90 jotacarma90 self-assigned this Nov 25, 2024
@wazuhci wazuhci moved this from Backlog to In progress in Release 5.0.0 Nov 25, 2024
@jotacarma90
Copy link
Member

jotacarma90 commented Nov 25, 2024

Update 25/11/2024

  • Researching packagekit
  • Problem reproduced very easily.
  • Researching possible triggers related to packagekit:
    • I have read that it could be the modification or use of the following path:
      • /usr/lib/
      • /etc/dbus-1/system.d/
      • /etc/
    • Could be related to libc-bin
  • Testing different changes in postinst script.

Update 26/11/2024

  • On ubuntu24 the problem does not appear (the packagekit service restarts sometimes, but it does not ask for confirmation and promt does not appear asking to accept the restart).
  • On ubuntu22 it does appear the promt asking for confirmation, I have been trying different things to try to solve it, using these environment variables:
    • DEBIAN_FRONTEND
    • NEEDRESTART_MODE
  • Detected file that is not deleted after uninstallation, /etc/ld.so.conf.d/wazuh-agentlibs.conf, in principle does not seem related to this problem.
  • Continue testing.

Update 27/11/2024

2024-11-27 12:07:11 trigproc libc-bin:amd64 2.35-0ubuntu3.8 <none>
2024-11-27 12:07:11 status half-configured libc-bin:amd64 2.35-0ubuntu3.8
2024-11-27 12:07:11 status installed libc-bin:amd64 2.35-0ubuntu3.8
  • This is handled by the needrestart process which is run as a trigger after the installation of the wazuh package (it happens even after the SPECS postinst script).

  • By default, it is set to interactive, but it can be changed to automatic in two different ways:

    • Using the envvar NEEDRESTART_MODE=a but we could only do it in the installation run itself:
      NEEDRESTART_MODE=a sudo -E apt install ./wazuh-agent_5.0.0-0_amd64_c2432b1dc.deb

    • Modifying the needrestart config (globally to the system), we can do it in the postinst script, but we leave that configuration modified:
      echo '$nrconf{restart} = “a”;' > /etc/needrestart/conf.d/no-prompt.conf

  • Link with related info: Deactivate temporally needrestart during a system upgrade liske/needrestart#71

  • At the moment we have those two options:

    • Add the envvar in the install command.
    • Modify the needrestart configuration globally while wazuh-agent is installed on the system.
  • I have read about the possibility of also modifying those triggers I mentioned (specifically the needrestart one) to see if we can not affect the configuration.

Update 28/11/2024

@jotacarma90 jotacarma90 linked a pull request Nov 28, 2024 that will close this issue
@wazuhci wazuhci moved this from In progress to Pending review in Release 5.0.0 Nov 28, 2024
@wazuhci wazuhci moved this from Pending review to Blocked in Release 5.0.0 Nov 29, 2024
@jotacarma90 jotacarma90 linked a pull request Dec 2, 2024 that will close this issue
@wazuhci wazuhci moved this from Blocked to Pending review in Release 5.0.0 Dec 2, 2024
@jotacarma90
Copy link
Member

This issue can be closed with: #375
By converting the libstdc++ library to static, it is no longer necessary to restart any process. The initial PR for this issue has been closed.

@wazuhci wazuhci moved this from Pending review to Done in Release 5.0.0 Dec 3, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
level/task Task issue module/packages Agent packages mvp Minimum Viable Product refinement type/bug Bug issue
Projects
Status: Done
2 participants