0

I am trying to follow this guide to install and setup blackbox_exporter: https://devconnected.com/how-to-install-and-configure-blackbox-exporter-for-prometheus/

I have followed everything and can manually run the command from the systemd service and get it to run.

However when I try to run systemctl start blackbox.service and then check the status, it fails with exit code 203/EXEC

I check the permissions on /usr/local/bin/blackbox_exporter:

-rwxr-xr-x. 1 blackbox blackbox 17050332 Nov 11 10:27 /usr/local/bin/blackbox_exporter

I can run the command from terminal as such just fine:

/usr/local/bin/blackbox_exporter --config.file=/etc/blackbox/blackbox.yml --web.listen-address=:9115

Here is my systemd service:

[Unit]
Description=Blackbox Exporter Service
Wants=network-online.target
After=network-online.target

[Service]
Type=simple
User=blackbox
Group=blackbox
ExecStart=/usr/local/bin/blackbox_exporter \
  --config.file=/etc/blackbox/blackbox.yml \
  --web.listen-address=":9115"

Restart=always

[Install]
WantedBy=multi-user.target

Logs from journalctl -u blackbox.service:

Apr 30 08:26:55 localhost systemd[1]: Started Blackbox Exporter Service.
Apr 30 08:26:55 localhost systemd[1]: blackbox.service: Main process exited, code=exited, status=203/EXEC
Apr 30 08:26:55 localhost systemd[1]: blackbox.service: Failed with result 'exit-code'.

I am using CentOS 8.

Any help would be greatly appreciated.

4
0

Since you were able to run the command interactively but not independently through systemd, it's possible that SELinux is picking up a different context and disallowing the execution. Depending on the actual intervention by SELinux, you could use ideas from Why do selinux policies apply to commands (e.g: logrotate) running from cronjobs, but not when run directly from command line? to accomodate the situation.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.