Upgrade Agents to 2.1.0p15: Error during installation of package

CMK version: 2.1.0p15
OS version: Oracle Linux Server release 7.9 / Oracle Linux Server release 6.10

Error message:

%pre(check-mk-agent-2.1.0p15-1.51bc5c5152ef00d0.noarch) scriptlet failed, exit status 127

I updated our CMK instances from 2.1.0p13 → p15. I ran the bakery with signing nd let AU do its job (as usual).

But all Oracle Linux servers got the same problem: The first call of the time based updater fails. If I execute it again, the update is applied. It seems, the first time try to update the agent fails this time.

Affects only Oracle Linux hosts. The ubuntu/windows hosts updated without any issue.

Want to leave it here for further checks…?

2022-11-02 09:36:30,264 DEBUG: Starting Checkmk Agent Updater v2.1.0p13
2022-11-02 09:36:30,265 DEBUG: Successfully read /etc/cmk-update-agent.state.
2022-11-02 09:36:30,265 DEBUG: Successfully read /etc/check_mk/cmk-update-agent.cfg.
2022-11-02 09:36:30,267 INFO: Starting Update mode as plugin.
2022-11-02 09:36:30,267 INFO: Getting target agent configuration for host 'myhost' from deployment server
2022-11-02 09:36:30,383 DEBUG: Fetching content (using requests): http://1.2.3.4/km/check_mk/deploy_agent.py
2022-11-02 09:36:30,564 DEBUG: Response from agent bakery:
{'result_code': 0, 'result': {'update_url': 'http://1.2.3.4/km/check_mk/', 'AgentAvailable': True, 'TargetHash': '51bc5c5152ef00d0', 'Signatures': [xxx]}, 'severity': 'success'}
2022-11-02 09:36:30,565 DEBUG: Successfully read /etc/cmk-update-agent.state.
2022-11-02 09:36:30,569 DEBUG: Saved deployment status to /etc/cmk-update-agent.state.
2022-11-02 09:36:30,570 DEBUG: Successfully read /etc/cmk-update-agent.state.
2022-11-02 09:36:30,572 DEBUG: Saved deployment status to /etc/cmk-update-agent.state.
2022-11-02 09:36:30,572 INFO: Target state (from deployment server):
2022-11-02 09:36:30,573 INFO:   Agent Available:     True
2022-11-02 09:36:30,573 INFO:   Signatures:          1
2022-11-02 09:36:30,573 INFO:   Target Hash:         51bc5c5152ef00d0
2022-11-02 09:36:30,719 DEBUG: Fetching content (using requests): http://1.2.3.4/km/check_mk/deploy_agent.py
2022-11-02 09:36:34,881 DEBUG: Response from agent bakery:
{'result_code': 0, 'result': {'agent': '7avu2wMAAA...lktIcOAQ=='}, 'severity': 'success'}
2022-11-02 09:36:35,536 INFO: Downloaded agent has size 17745451 bytes.
2022-11-02 09:36:35,565 INFO: Signature check OK.
2022-11-02 09:36:35,576 INFO: Invoking package manager: rpm -vU --oldpackage --replacepkgs /tmp/check-mk-agent-tnbelpuc
2022-11-02 09:36:36,218 INFO: Output from rpm:
  Preparing packages...
  error: %pre(check-mk-agent-2.1.0p15-1.51bc5c5152ef00d0.noarch) scriptlet failed, exit status 127
  error: check-mk-agent-2.1.0p15-1.51bc5c5152ef00d0.noarch: install failed
  error: check-mk-agent-2.1.0p13-1.4999daaa77137405.noarch: erase skipped

2022-11-02 09:36:36,219 DEBUG: Caught Exception:
Traceback (most recent call last):
  File "cmk_update_agent.py", line 1742, in _perform_installation
  File "cmk_update_agent.py", line 1767, in _invoke_installer
  File "cmk_update_agent.py", line 1783, in _install_agent_linux_rpm
  File "cmk_update_agent.py", line 1876, in _invoke_unix_pkg_manager
Exception: Error during installation of package
2022-11-02 09:36:36,220 ERROR: Failed installing Checkmk agent: Error during installation of package.
2022-11-02 09:36:36,221 INFO: Hint: You can try to install or analyze the agent package manually by downloading it from the checkmk server. You can find it by looking for your OS's package for host myhost with agent hash 51bc5c5152ef00d0 at the agent bakery.
2022-11-02 09:36:36,228 DEBUG: Successfully read /etc/cmk-update-agent.state.
2022-11-02 09:36:36,231 DEBUG: Saved deployment status to /etc/cmk-update-agent.state.
2022-11-02 09:36:36,231 DEBUG: Caught Exception:
Traceback (most recent call last):
  File "cmk_update_agent.py", line 1347, in _do_update_as_plugin
  File "cmk_update_agent.py", line 1419, in _do_update_agent
  File "cmk_update_agent.py", line 1659, in _trigger_installation
  File "cmk_update_agent.py", line 1726, in install_agent
  File "cmk_update_agent.py", line 1742, in _perform_installation
  File "cmk_update_agent.py", line 1767, in _invoke_installer
  File "cmk_update_agent.py", line 1783, in _install_agent_linux_rpm
  File "cmk_update_agent.py", line 1876, in _invoke_unix_pkg_manager
Exception: Error during installation of package
2022-11-02 09:36:36,241 DEBUG: Writing agent section to stdout:
<<<check_mk>>>
AgentUpdate: last_check 1667378190.5698864 last_update 1666709768.5841646 aghash 4999daaa77137405 pending_hash None update_url http://1.2.3.4/km/check_mk error Error during installation of package

2022-11-02 09:36:36,241 DEBUG: Sending new state data to agent bakery
2022-11-02 09:36:36,397 DEBUG: Fetching content (using requests): http://1.2.3.4/km/check_mk/deploy_agent.py
2022-11-02 09:36:36,629 DEBUG: Response from agent bakery:
{'result_code': 0, 'result': {'update_url': 'http://1.2.3.4/km/check_mk/', 'AgentAvailable': True, 'TargetHash': '51bc5c5152ef00d0', 'Signatures': [xxx]}, 'severity': 'success'}
2022-11-02 09:36:36,630 DEBUG: Done.

Okay - updated infos:

Every AUTOMATIC run of the cmk-update-agent end up in error state. The 2nd automatic call:

2022-11-02 10:52:48,376 INFO: Output from rpm:
  Preparing packages for installation...
  error: %pre(check-mk-agent-2.1.0p15-1.51bc5c5152ef00d0.noarch) scriptlet failed, exit status 127
  error:   install: %pre scriptlet failed (2), skipping check-mk-agent-2.1.0p15-1.51bc5c5152ef00d0

2022-11-02 10:52:48,376 DEBUG: Caught Exception:
Traceback (most recent call last):
  File "cmk_update_agent.py", line 1742, in _perform_installation
  File "cmk_update_agent.py", line 1767, in _invoke_installer
  File "cmk_update_agent.py", line 1783, in _install_agent_linux_rpm
  File "cmk_update_agent.py", line 1876, in _invoke_unix_pkg_manager
Exception: Error during installation of package
2022-11-02 10:52:48,377 ERROR: Failed installing Checkmk agent: Error during installation of package.
2022-11-02 10:52:48,378 INFO: Hint: You can try to install or analyze the agent package manually by downloading it from the checkmk server. You can find it by looking for your OS's package for host km-orax2 with agent hash 51bc5c5152ef00d0 at the agent bakery.
2022-11-02 10:52:48,385 DEBUG: Successfully read /etc/cmk-update-agent.state.
2022-11-02 10:52:48,388 DEBUG: Saved deployment status to /etc/cmk-update-agent.state.
2022-11-02 10:52:48,389 DEBUG: Caught Exception:
Traceback (most recent call last):
  File "cmk_update_agent.py", line 1347, in _do_update_as_plugin
  File "cmk_update_agent.py", line 1419, in _do_update_agent
  File "cmk_update_agent.py", line 1659, in _trigger_installation
  File "cmk_update_agent.py", line 1726, in install_agent
  File "cmk_update_agent.py", line 1742, in _perform_installation
  File "cmk_update_agent.py", line 1767, in _invoke_installer
  File "cmk_update_agent.py", line 1783, in _install_agent_linux_rpm
  File "cmk_update_agent.py", line 1876, in _invoke_unix_pkg_manager
Exception: Error during installation of package

Running cmk-update-agent as root manually runs without issues:

2022-11-02 10:53:05,541 DEBUG: Starting Checkmk Agent Updater v2.1.0p13
2022-11-02 10:53:05,542 DEBUG: Successfully read /etc/cmk-update-agent.state.
2022-11-02 10:53:05,543 DEBUG: Successfully read /etc/check_mk/cmk-update-agent.cfg.
2022-11-02 10:53:05,547 DEBUG: Starting manual update mode.
2022-11-02 10:53:05,547 INFO: Getting target agent configuration for host 'myhost' from deployment server
2022-11-02 10:53:05,698 DEBUG: Fetching content (using requests): http://1.2.3.4/km/check_mk/deploy_agent.py
2022-11-02 10:53:05,922 DEBUG: Response from agent bakery:
{'result_code': 0, 'result': {'update_url': 'http://1.2.3.4/km/check_mk/', 'AgentAvailable': True, 'TargetHash': '51bc5c5152ef00d0', 'Signatures': [xxxx}, 'severity': 'success'}
2022-11-02 10:53:05,924 DEBUG: Successfully read /etc/cmk-update-agent.state.
2022-11-02 10:53:05,932 DEBUG: Saved deployment status to /etc/cmk-update-agent.state.
2022-11-02 10:53:05,933 DEBUG: Successfully read /etc/cmk-update-agent.state.
2022-11-02 10:53:05,936 DEBUG: Saved deployment status to /etc/cmk-update-agent.state.
2022-11-02 10:53:05,936 INFO: Target state (from deployment server):
2022-11-02 10:53:05,937 INFO:   Agent Available:     True
2022-11-02 10:53:05,937 INFO:   Signatures:          1
2022-11-02 10:53:05,938 INFO:   Target Hash:         51bc5c5152ef00d0
2022-11-02 10:53:06,092 DEBUG: Fetching content (using requests): http://1.2.3.4/km/check_mk/deploy_agent.py
2022-11-02 10:53:07,075 DEBUG: Response from agent bakery:
{'result_code': 0, 'result': {'agent': '7avu2wMAAA...lktIcOAQ=='}, 'severity': 'success'}
2022-11-02 10:53:07,835 INFO: Downloaded agent has size 17745451 bytes.
2022-11-02 10:53:07,857 INFO: Signature check OK.
2022-11-02 10:53:07,878 INFO: Invoking package manager: rpm -vU --oldpackage --replacepkgs /tmp/check-mk-agent-qzcqm1ch
2022-11-02 10:53:09,313 INFO: Output from rpm:
  Preparing packages for installation...
  Unable to figure out where to put the systemd units.
  This package knows about /usr/lib/systemd/system and
  /lib/systemd/system, but none of these are present.

  check-mk-agent-2.1.0p15-1.51bc5c5152ef00d0
  systemd not found on this system
  Unable to figure out where to put the systemd units.
  This package knows about /usr/lib/systemd/system and
  /lib/systemd/system, but none of these are present.

  Unable to figure out where to put the systemd units.
  This package knows about /usr/lib/systemd/system and
  /lib/systemd/system, but none of these are present.

  systemd not found on this system
  Deployed xinetd
  Creating/updating cmk-agent user account ...
  Unable to figure out where to put the systemd units.
  This package knows about /usr/lib/systemd/system and
  /lib/systemd/system, but none of these are present.
  Unable to figure out where to put the systemd units.
  This package knows about /usr/lib/systemd/system and
  /lib/systemd/system, but none of these are present.
  systemd not found on this system
  Reloading xinetd
  Konfiguration neu laden: [  OK  ]

2022-11-02 10:53:09,323 DEBUG: Successfully read /etc/cmk-update-agent.state.
2022-11-02 10:53:09,331 DEBUG: Saved deployment status to /etc/cmk-update-agent.state.
2022-11-02 10:53:09,331 INFO: Successfully installed agent 51bc5c5152ef00d0.
2022-11-02 10:53:09,347 DEBUG: Could not find and update cachefile.
2022-11-02 10:53:09,347 DEBUG: Done.

Where is the difference between automatic and manual triggering the updater here?

For all others: This issue is being discussed inside the ticket system in parallel.

Long story short: SELinux->enforcing is the issue in that case.

One solution: Agent Updates & SELinux

1 Like

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed. Contact an admin if you think this should be re-opened.