0
votes

I'm trying to set up usbmuxd to run as a daemon, 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
Documentation=man:usbmuxd(8)

[Service]
Type=simple
ExecStart=/usr/local/sbin/usbmuxd --user usbmux --systemd
PIDFile=/var/run/usbmuxd.pid
Restart=always
CapabilityBoundingSet=CAP_NET_ADMIN CAP_NET_BIND_SERVICE
LimitNPROC=1

StandardOutput=syslog
StandardError=syslog
SyslogIdentifier=asciusbmuxd

[Install]
WantedBy=multi-user.target

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

UPDATE

Using the unit file shipped with usbmuxd does not function, and get the same error mentioned above I get when trying to pass the command parameters in ExecStart.

Bundled unit file :

[Unit]
Description=Socket daemon for the usbmux protocol used by Apple devices
Documentation=man:usbmuxd(8)

[Service]
ExecStart=@sbindir@/usbmuxd --user usbmux --systemd
PIDFile=@localstatedir@/run/usbmuxd.pid

When compiled, @sbindir@ maps to /usr/local/sbin/usbmuxd and @localstatedir@ to /usr/local/var/run/usbmuxd.pid which does not exist. I corrected it to /var/run/usbmuxd.pid.

Whether it's my unit file, or the bundled one removing, --user usbmux --systemd allows it to run correctly.

Trying to set usbmux via the unit file rather than via ExecStart also fails.

Syslog tells me the following :

Oct  4 10:52:19 potato asciusbmuxd[17327]: [10:52:19.635][0] Failed to drop privileges (cannot set supplementary groups)

When I remove User reference, the service starts correctly but I get, and I cannot execute ideviceinfo or use anything related to lockdownd :

usbmuxd[17462]: [2] chmod(/var/lib/lockdown, 02775) failed: Operation not permitted

I should note that I am forced to compile it, as I have OS restrictions and must use 16.04, I require a usbmuxd version that is more recent than available in the repos.

My systemd version is 229.

1

1 Answers

0
votes

The last error message:

Dec  3 10:29:24 asci-kubu-NUC7i3BNH usbmuxd[29950]: [0] Could not open lockfile

seems to indicate the service has an issue opening the lockfile. The lockfile is located at /var/run/usbmuxd.pid. Does your service have permissions to edit that file?

You seem to be rolling your own systemd service file. Why don't you use the one that ships with usbmuxd?