<html>
<head>
<base href="https://bugs.freedesktop.org/" />
</head>
<body><table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Priority</th>
<td>medium
</td>
</tr>
<tr>
<th>Bug ID</th>
<td><a class="bz_bug_link
bz_status_NEW "
title="NEW --- - PID file /var/run/program.pid not readable (yet?) after start. PIDFile + User&Group"
href="https://bugs.freedesktop.org/show_bug.cgi?id=66641">66641</a>
</td>
</tr>
<tr>
<th>Assignee</th>
<td>systemd-bugs@lists.freedesktop.org
</td>
</tr>
<tr>
<th>Summary</th>
<td>PID file /var/run/program.pid not readable (yet?) after start. PIDFile + User&Group
</td>
</tr>
<tr>
<th>QA Contact</th>
<td>systemd-bugs@lists.freedesktop.org
</td>
</tr>
<tr>
<th>Severity</th>
<td>normal
</td>
</tr>
<tr>
<th>Classification</th>
<td>Unclassified
</td>
</tr>
<tr>
<th>OS</th>
<td>Linux (All)
</td>
</tr>
<tr>
<th>Reporter</th>
<td>alexey.ivanes@gmail.com
</td>
</tr>
<tr>
<th>Hardware</th>
<td>All
</td>
</tr>
<tr>
<th>Status</th>
<td>NEW
</td>
</tr>
<tr>
<th>Version</th>
<td>unspecified
</td>
</tr>
<tr>
<th>Component</th>
<td>general
</td>
</tr>
<tr>
<th>Product</th>
<td>systemd
</td>
</tr></table>
<p>
<div>
<pre>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:
<span class="quote">>> 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</span ></pre>
</div>
</p>
<hr>
<span>You are receiving this mail because:</span>
<ul>
<li>You are the QA Contact for the bug.</li>
<li>You are the assignee for the bug.</li>
</ul>
</body>
</html>