Summary: | PID file /var/run/program.pid not readable (yet?) after start. PIDFile + User&Group | ||
---|---|---|---|
Product: | systemd | Reporter: | Alexey Ivanov <alexey.ivanes> |
Component: | general | Assignee: | systemd-bugs |
Status: | RESOLVED NOTABUG | QA Contact: | systemd-bugs |
Severity: | normal | ||
Priority: | medium | ||
Version: | unspecified | ||
Hardware: | All | ||
OS: | Linux (All) | ||
Whiteboard: | |||
i915 platform: | i915 features: |
If running a program as unprivileged user, you need to make sure that it has access to all the resources it needs. Try sticking: d /run/programd2 0755 programd2 programd2 - - in /etc/tmpfiles.d/programd2.conf and changing the unit file to have: PIDFile=/run/programd2/programd2.pid and updating the configuration for the program to actually write there. (In reply to comment #0) > I believe that this is a problem systemd. Systemd should create pid as > "root" and do it chown before Exec. Also note, that systemd is not creating any PID file, it is just your daemon that does that. In general, we recommend getting rid of the need of all PID files, as they are an outdated and pretty broken concept; they are not needed at all with systemd, just minimally supported by it, as legacy, for stuff that still needs it. |
Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.
Example service file [Unit] Description=Daemon After=syslog.target network.target [Service] Type=forking User=programd2 Group=programd2 PIDFile=/var/run/programd2.pid ExecStart=/usr/sbin/programd2 -D [Install] WantedBy=multi-user.target I need to start service from the user. Also must have a pid file. But if i use User= Group= not able to create pid file in /var/run (No permission). In logs: PID file /var/run/programd2.pid not readable (yet?) after start. I believe that this is a problem systemd. Systemd should create pid as "root" and do it chown before Exec. This is a very bad decision: >> ExecPre=touch /var/run/program.pid >> ExecPre=chown programd2:programd2/var/run/program.pid >> Exec=/bin/su -s /bin/sh -c '/usr/sbin/programd2 -D' programd2