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
  • can the blackbox user execute /usr/local/bin/blackbox_exporter?
    – Jeff Schaller
    Commented Apr 30, 2020 at 13:50
  • @JeffSchaller yes it can. Same result as when root runs it. It works fine. The only issue seems to be systemd. Commented Apr 30, 2020 at 15:13
  • Thought I'd try the easy answer --"The actual process execution failed (specifically, the execve(2) system call". Most likely this is caused by a missing or non-accessible executable file); I now wonder if SELinux is catching it.
    – Jeff Schaller
    Commented Apr 30, 2020 at 15:19
  • @JeffSchaller great call out! It was SELinux. If you want to make this a comment I will accept it as a resolution! Commented Apr 30, 2020 at 15:37

1 Answer 1

1

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.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .