30

I'm trying to set up watchman as a user service.

I've followed their documentation as closely as possible. This is what I have:

The socket file:

[Unit]
Description=Watchman socket for user %i

[Socket]
ListenStream=/usr/local/var/run/watchman/%i-state/sock
Accept=false
SocketMode=0664
SocketUser=%i
SocketGroup=%i

[Install]
WantedBy=sockets.target

The service file:

[Unit]
Description=Watchman for user %i
After=remote-fs.target
Conflicts=shutdown.target

[Service]
ExecStart=/usr/local/bin/watchman --foreground --inetd --log-level=2
ExecStop=/usr/bin/pkill -u %i -x watchman
Restart=on-failure
User=%i
Group=%i
StandardInput=socket
StandardOutput=syslog
SyslogIdentifier=watchman-%i

[Install]
WantedBy=multi-user.target

Systemd attempts to run watchman but is stuck in a restart loop.
These are the errors I get:

Apr 16 05:41:00 debian systemd[20894]: [email protected]: Failed to determine supplementary groups: Operation not permitted
Apr 16 05:41:00 debian systemd[20894]: [email protected]: Failed at step GROUP spawning /usr/local/bin/watchman: Operation not permitted

I'm 100% sure the group and user I'm enabling this service & socket exists. What am I doing wrong?

2
  • are the user and group in /etc files or coming from some (perhaps not yet loaded or otherwise flakey) network source?
    – thrig
    Commented Apr 16, 2018 at 13:57
  • this issue is odd, this link might offer some insight on the root cause github.com/systemd/systemd/issues/15659 I do not know if this is a bug
    – Thom
    Commented Aug 16 at 15:50

2 Answers 2

62

I was running into the same issue. Googling I found this thread: https://bbs.archlinux.org/viewtopic.php?id=233035

The problem is with how the service is being started. If you specify the user/group in the unit file then you should start the service as a system service.

If you want to start the service as a user service then the User/Group is not needed and can be removed from the unit config. You simply start the service when logged in as the current user passing the --user flag to systemctl.

4
  • 7
    This works. Seems like the error message for this should be much more descriptive of the actual problem because that is not really intuitive from the message Commented Dec 26, 2019 at 22:37
  • @theferrit32 That's true of a lot of these error messages. Could always submit a patch?
    – Ken Sharp
    Commented Nov 7, 2021 at 21:19
  • 3 years on, and this saved me a lot of headache. Thank you
    – KhoPhi
    Commented Dec 8, 2021 at 9:11
  • 2
    Be careful of the difference between User= and --user. see unix.stackexchange.com/a/548526/150125 Commented Apr 5, 2022 at 15:44
7

I haven't found a solution to my problem but placing the unit files in ~/.config/systemd/user and removing the user parameterization fixed the issue for me.

This site is temporarily in read-only mode and not accepting new answers.

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