5
submitted 3 days ago* (last edited 2 days ago) by [email protected] to c/[email protected]

cross-posted from: https://reddthat.com/post/21668140

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, and added the relevant user and group to the Service section. Still throwing a 126.

Solution: the system wanted /usr/bin/env in ExecStart to launch the binary. The .service file above has been edited to show the working solution.

you are viewing a single comment's thread
view the rest of the comments
[-] nhowell77 3 points 3 days ago* (last edited 3 days ago)

If that is your full .service file you are missing the directive to tell the daemon what user to run under. Under service try adding

User=root

Group=root

Before the ExecStart command line.

[-] [email protected] 4 points 3 days ago* (last edited 3 days ago)

Is that necessary for processes running as root? AfaIk, root is default.

Keywords should be in CamelCase format, thus the space in Wanted By is wrong.

[-] [email protected] 2 points 3 days ago

Foiled by autocorrect! There's no space in the original file, and I've edited my post to reflect that.

load more comments (3 replies)
load more comments (16 replies)
this post was submitted on 04 Jul 2024
5 points (85.7% liked)

Linux Questions

913 readers
6 users here now

Linux questions Rules (in addition of the Lemmy.zip rules)

Tips for giving and receiving help

Any rule violations will result in disciplinary actions

founded 11 months ago
MODERATORS