Hi,
I’m new to snap and I’ve been trying to setup the shadowsocks-libev snap as a systemd service and I can’t make it work.
If I run it manually it works just fine, but starting it as systemd service gives me the following:
Apr 11 19:09:51 raspberrypi systemd[1]: Started Shadowsocks-libev Default Server Service.
Apr 11 19:09:55 raspberrypi shadowsocks-libev.ss-server[504]: cmd_run.go:918: WARNING: cannot create user data directory: cannot get the current user: user: unknown userid 64677
Apr 11 19:09:55 raspberrypi shadowsocks-libev.ss-server[504]: cmd_run.go:923: WARNING: cannot copy user Xauthority file: cannot get the current user: user: unknown userid 64677
Apr 11 19:09:55 raspberrypi shadowsocks-libev.ss-server[504]: cannot read mount namespace identifier of pid 1: Permission denied
Apr 11 19:09:55 raspberrypi systemd[1]: shadowsocks-libev.service: Main process exited, code=exited, status=1/FAILURE
Apr 11 19:09:55 raspberrypi systemd[1]: shadowsocks-libev.service: Failed with result 'exit-code'.
My home directory is /home/username.
snap 2.44.3+git1732.ff6ac87~ubuntu16.04.1
snapd 2.44.3+git1732.ff6ac87~ubuntu16.04.1
series 16
raspbian 10
kernel 4.19.97-v7l+
I read a lot about snap not being able to work with unconventional home paths but it seems that mine is setup correctly. Could you please help me with that?
Service config:
[Unit]
Description=Shadowsocks-libev Default Server Service
Documentation=man:shadowsocks-libev(8)
After=network-online.target
[Service]
Type=simple
CapabilityBoundingSet=CAP_NET_BIND_SERVICE
AmbientCapabilities=CAP_NET_BIND_SERVICE
DynamicUser=true
EnvironmentFile=/etc/default/shadowsocks-libev
LimitNOFILE=32768
ExecStart=/snap/bin/shadowsocks-libev.ss-server -c $CONFFILE $DAEMON_ARGS
[Install]
WantedBy=multi-user.target
Env. var config:
START=yes
# Configuration file
CONFFILE="/snap/bin/config.json"
# Extra command line arguments
DAEMON_ARGS="-u"
# User and group to run the server as
USER=nobody
GROUP=nogroup
# Number of maximum file descriptors
MAXFD=32768