usbmuxd icon indicating copy to clipboard operation
usbmuxd copied to clipboard

(Question) Errors when setting usbmuxd as a service with systemd, but executes normally via terminal.

Open autor3iv opened this issue 6 years ago • 2 comments

I'm trying to set up usbmuxd to run as a service, however I keep running into the following error :

    Dec  3 10:29:19 asci-kubu-NUC7i3BNH systemd[1]: asci-usbmuxd.service: Main process exited, code=exited, status=1/FAILURE
Dec  3 10:29:19 asci-kubu-NUC7i3BNH systemd[1]: asci-usbmuxd.service: Failed with result 'exit-code'.
Dec  3 10:29:24 asci-kubu-NUC7i3BNH systemd[1]: asci-usbmuxd.service: Service hold-off time over, scheduling restart.
Dec  3 10:29:24 asci-kubu-NUC7i3BNH systemd[1]: asci-usbmuxd.service: Scheduled restart job, restart counter is at 46078.
Dec  3 10:29:24 asci-kubu-NUC7i3BNH systemd[1]: Stopped usbmuxd service.
Dec  3 10:29:24 asci-kubu-NUC7i3BNH systemd[1]: Started  usbmuxd service.
Dec  3 10:29:24 asci-kubu-NUC7i3BNH usbmuxd[29950]: [0] Could not open lockfile

When I run it manually like so :

sudo usbmuxd -v --user usbmux --foreground

Everything is fine.

Here is my systemd .service file. I've read through the manual however I'm positive that I may have not set the correct capacities. I've verified the permissions/groups for usbmux user, usbmux is part of plugdev and sudo.

[Unit]
Description=usbmuxd service

[Service]
Type=simple
ExecStart=/usr/local/sbin/usbmuxd --user usbmux
Restart=always
CapabilityBoundingSet=CAP_SETGID CAP_SETUID CAP_CHOWN CAP_FOWNER CAP_NET_ADMIN CAP_NET_BIND_SERVICE
LimitNPROC=1
RestartSec=5
User=usbmux
Group=sudo


# Output to syslog
StandardOutput=syslog
StandardError=syslog
#Change this to find app logs in /var/log/syslog
SyslogIdentifier=usbmuxd

[Install]
WantedBy=multi-user.target

Any help would be appreciated, I've dug around as best I could trying to find a solution. Thanks!

autor3iv avatar Dec 03 '18 16:12 autor3iv

User usbmux cannot access the lockfile, remove these lines:

User=usbmux
Group=sudo

Lessica avatar Jan 06 '20 12:01 Lessica

This file is used as a template to create the usbmuxd.service. After you build, you should have the final usbmuxd.service file that you need.

You can copy the generated file to /lib/systemd/system/usbmuxd.service and restart the service:

sudo systemctl restart usbmuxd

In your version probably the --systemd flag was missing.

bagbyte avatar May 21 '20 10:05 bagbyte