I have a VPN daemon that needs to run before the client will work. Normally, this would have been set up automatically by its install script, but the system is immutable.

I’ve created the systemd service via sysyemctl edit --force --full daemon.service with the following parameters:

[Unit] 
Description=Blah
After=network-online.target

[Service]
User=root
Group=root
ExecStart=/usr/bin/env /path/to/daemon

[Install]
WantedBy=multi-user.target

I’ve verified that the daemon is actually executable, and it runs fine when I manually call it via sudo daemon. When I try to run it with sudo systemctl enable --now daemon.service, it exits with error code 126.

What am I missing?

Edit: typo

Edit 2: Added script modifications. Daemon appears to be some kind of pre-compiled binary.

Solution: ExecStart wanted /usr/bin/env to launch the binary. The service file above has been edited to reflect the correct solution. See this post for further discussion.

You are viewing a single thread.
View all comments View context
1 point

Does the service include execute permission for the root user or group? Unsure if root user or group can be blocked from permissions or not, but do you have chmod +x and the service is owned by root and/or the x is in the “everyone” place?

permalink
report
parent
reply
1 point

Root is required, but it’s already an executable binary, not a script. chmod +x and chmod 755 both had no effect on the 126.

Fortunately, it was solved by adding /usr/bin/env to the ExecStart line. According to another user, the default environment is limited, so the script was probably looking for some specific environment variables, which env can provide.

Normally, this would be set up by default with the installation script, but I’m trying to set this up on Bazzite, so there’s some problematic issues to overcome.

permalink
report
parent
reply

Linux 101 stuff. Questions are encouraged, noobs are welcome!

!linux4noobs@lemmy.world

Create post

Linux introductions, tips and tutorials. Questions are encouraged. Any distro, any platform! Explicitly noob-friendly.

Community stats

  • 90

    Monthly active users

  • 86

    Posts

  • 177

    Comments