Cannot open /var/lib/cmk-agent/scripts/super-server/0_systemd/setup: No such file

CMK version: 2.2.0p27.cee
OS version: Debian 12

Error message:
Some days after the I migrated from 2.1.0 to 2.2.0 I have a lot of issues with my agent bakery. On some of my servers I have issues with the agent bakery upgrading and installation (reinstall):

apt install ./check-mk-agent_2.2.0p27-a89a0acdc7384d5e_all.deb
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
Note, selecting 'check-mk-agent' instead of './check-mk-agent_2.2.0p27-a89a0acdc7384d5e_all.deb'
The following NEW packages will be installed:
  check-mk-agent
0 upgraded, 1 newly installed, 0 to remove and 72 not upgraded.
Need to get 0 B/13.7 MB of archives.
After this operation, 13.7 MB of additional disk space will be used.
Get:1 /home/username/check-mk-agent_2.2.0p27-a89a0acdc7384d5e_all.deb check-mk-agent all 2.2.0p27-2.a89a0acdc7384d5e [13.7 MB]
Selecting previously unselected package check-mk-agent.
(Reading database ... 194268 files and directories currently installed.)
Preparing to unpack .../check-mk-agent_2.2.0p27-a89a0acdc7384d5e_all.deb ...
Unpacking check-mk-agent (2.2.0p27-2.a89a0acdc7384d5e) ...
Setting up check-mk-agent (2.2.0p27-2.a89a0acdc7384d5e) ...
/bin/sh: 0: cannot open /var/lib/cmk-agent/scripts/super-server/0_systemd/setup: No such file
/bin/sh: 0: cannot open /var/lib/cmk-agent/scripts/super-server/0_systemd/setup: No such file
/bin/sh: 0: cannot open /var/lib/cmk-agent/scripts/super-server/0_systemd/setup: No such file
---------------------------------------------
WARNING

This package comes with configuration files
for the following super server(s):
  systemd
It is configured to try these (in order of
preference):
  systemd
None of these have been applicable.

Hint: It's also possible to call the
Checkmk agent via SSH without a running
agent service.
---------------------------------------------
/bin/sh: 0: cannot open /var/lib/cmk-agent/scripts/super-server/0_systemd/setup: No such file
/bin/sh: 0: cannot open /var/lib/cmk-agent/scripts/super-server/0_systemd/setup: No such file
/bin/sh: 0: cannot open /var/lib/cmk-agent/scripts/super-server/0_systemd/setup: No such file
Scanning processes...
Scanning candidates...
Scanning linux images...

Running kernel seems to be up-to-date.

Restarting services...
 systemctl restart cmk-agent-ctl-daemon.service
Failed to restart cmk-agent-ctl-daemon.service: Unit cmk-agent-ctl-daemon.service not found.

But systemd is installed and it worked before:

systemctl --version
systemd 247 (247.3-7+deb11u4)
+PAM +AUDIT +SELINUX +IMA +APPARMOR +SMACK +SYSVINIT +UTMP +LIBCRYPTSETUP +GCRYPT +GNUTLS +ACL +XZ +LZ4 +ZSTD +SECCOMP +BLKID +ELFUTILS +KMOD +IDN2 -IDN +PCRE2 default-hierarchy=unified

If I try with “dpkg -i” I get to following error:

sudo dpkg -i check-mk-agent_2.2.0p27-a89a0acdc7384d5e_all.deb
Selecting previously unselected package check-mk-agent.
(Reading database ... 194268 files and directories currently installed.)
Preparing to unpack check-mk-agent_2.2.0p27-a89a0acdc7384d5e_all.deb ...
Unpacking check-mk-agent (2.2.0p27-2.a89a0acdc7384d5e) ...
Setting up check-mk-agent (2.2.0p27-2.a89a0acdc7384d5e) ...
/bin/sh: 0: cannot open /var/lib/cmk-agent/scripts/super-server/setup: No such file
/bin/sh: 0: cannot open /var/lib/cmk-agent/scripts/super-server/setup: No such file
/bin/sh: 0: cannot open /var/lib/cmk-agent/scripts/super-server/setup: No such file
dpkg: error processing package check-mk-agent (--install):
 installed check-mk-agent package post-installation script subprocess returned error exit status 2
Errors were encountered while processing:
 check-mk-agent

When I compare the new installed check-mk agent to one of a server where everything is working fine, a lot of files are missing in the “/var/lib/cmk-agent/” folder:

The affected system:

cmk-agent/
└── scripts
    └── super-server
        ├── 0_systemd
        │   ├── cmk-update-agent.service
        │   └── cmk-update-agent.timer
        └── setup

One server without issues:

cmk-agent/
├── cmk-agent-ctl.gz
├── cmk-agent-ctl.toml
├── registered_connections.json
└── scripts
    ├── cmk-agent-useradd.sh
    └── super-server
        ├── 0_systemd
        │   ├── check-mk-agent-async.service
        │   ├── check-mk-agent@.service
        │   ├── check-mk-agent.socket
        │   ├── check-mk-agent.socket.fallback
        │   ├── cmk-agent-ctl-daemon.service
        │   ├── cmk-update-agent.service
        │   ├── cmk-update-agent.timer
        │   └── setup
        ├── 1_xinetd
        │   └── setup
        └── setup

Ok I deletet everything from check-mk-agent from that system and installed again with “dpkg -i” and got the same result:

Selecting previously unselected package check-mk-agent.
(Reading database ... 194268 files and directories currently installed.)
Preparing to unpack check-mk-agent_2.2.0p27-a89a0acdc7384d5e_all.deb ...
Unpacking check-mk-agent (2.2.0p27-2.a89a0acdc7384d5e) ...
Setting up check-mk-agent (2.2.0p27-2.a89a0acdc7384d5e) ...
/bin/sh: 0: cannot open /var/lib/cmk-agent/scripts/super-server/setup: No such file
/bin/sh: 0: cannot open /var/lib/cmk-agent/scripts/super-server/setup: No such file
/bin/sh: 0: cannot open /var/lib/cmk-agent/scripts/super-server/setup: No such file
dpkg: error processing package check-mk-agent (--install):
 installed check-mk-agent package post-installation script subprocess returned error exit status 2
Errors were encountered while processing:
 check-mk-agent

I dont know if there is a bug inside the backing process?

While trying around I got a new error on another system:

Agent Controller is not packaged. Falling back to legacy systemd setup.

Nothing has changed

Ok I figured out where the problem was. The rule for systemd under “Add rule: Checkmk agent network service (Linux)” was missing. To fix everything I had to do:

  1. Bake the agent again and install
  2. Delete the agent: apt remove --purge check-mk-agent
  3. Stop the services and delete the files:

Services stop

systemctl stop cmk-agent-ctl-daemon.service
systemctl stop cmk-update-agent.timer
systemctl stop check-mk-agent-async.service
systemctl stop check-mk-agent.socket
systemctl reset-failed

Delete the files

rm /etc/systemd/system/multi-user.target.wants/check-mk-agent-async.service
rm /etc/systemd/system/sockets.target.wants/check-mk-agent.socket
rm /run/check-mk-agent.socket
rm -r /var/lib/cmk-agent
rm /etc/cmk-update-agent.state
rm /etc/cmk-update-agent.state.bak
rm /etc/systemd/system/multi-user.target.wants/cmk-agent-ctl-daemon.service
rm /etc/systemd/system/timers.target.wants/cmk-update-agent.timer
rm -r /usr/bin/check_mk_agent
rm -r /usr/lib/check_mk_agent
  1. Delete the reg on the monitoring server “~/var/check_mk/agent_deployment”
  2. cmk-agent-ctl register and cmk-update-agent register
  3. cmk-update-agent -v

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.