<html>
    <head>
      <base href="https://bugs.freedesktop.org/" />
    </head>
    <body><table border="1" cellspacing="0" cellpadding="8">
        <tr>
          <th>Bug ID</th>
          <td><a class="bz_bug_link 
          bz_status_NEW "
   title="NEW - Executing a service with RuntimeDirectory= produces an error: Failed at step RUNTIME_DIRECTORY spawning /bin/bash: File exists"
   href="https://bugs.freedesktop.org/show_bug.cgi?id=89587">89587</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>Executing a service with RuntimeDirectory= produces an error: Failed at step RUNTIME_DIRECTORY spawning /bin/bash: File exists
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>systemd
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>unspecified
          </td>
        </tr>

        <tr>
          <th>Hardware</th>
          <td>Other
          </td>
        </tr>

        <tr>
          <th>OS</th>
          <td>All
          </td>
        </tr>

        <tr>
          <th>Status</th>
          <td>NEW
          </td>
        </tr>

        <tr>
          <th>Severity</th>
          <td>normal
          </td>
        </tr>

        <tr>
          <th>Priority</th>
          <td>medium
          </td>
        </tr>

        <tr>
          <th>Component</th>
          <td>general
          </td>
        </tr>

        <tr>
          <th>Assignee</th>
          <td>systemd-bugs@lists.freedesktop.org
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td>gsbox39stz@thurston.ru
          </td>
        </tr>

        <tr>
          <th>QA Contact</th>
          <td>systemd-bugs@lists.freedesktop.org
          </td>
        </tr></table>
      <p>
        <div>
        <pre>This is the unit I came up with called co2mon-log.service:

[Unit]
Description=Log Data From CO2Mon
PartOf=co2mon.service

[Service]
User=co2mon
Group=co2mon
RuntimeDirectory=co2mon
RuntimeDirectoryMode=0755
WorkingDirectory=/run/co2mon
StandardOutput=null
ExecStartPre=/usr/bin/rsync -a /var/lib/co2mon/ /run/co2mon
ExecStart=/bin/bash ./update_data.sh
ExecStopPost=-/bin/cp -p /run/co2mon/graph.rrd /var/lib/co2mon/

[Install]
WantedBy=multi-user.target

Starting it manually produces an error:

● co2mon-log.service - Log Data From CO2Mon
   Loaded: loaded (/usr/lib64/systemd/system/co2mon-log.service; disabled;
vendor preset: enabled)
   Active: failed (Result: exit-code) since 月 2015-03-16 11:36:02 MSK; 1s ago
  Process: 15105 ExecStopPost=/bin/cp -p /run/co2mon/graph.rrd /var/lib/co2mon/
(code=exited, status=233/RUNTIME_DIRECTORY)
  Process: 15104 ExecStart=/bin/bash ./update_data.sh (code=exited,
status=233/RUNTIME_DIRECTORY)
  Process: 15098 ExecStartPre=/usr/bin/rsync -a /var/lib/co2mon/ /run/co2mon
(code=exited, status=0/SUCCESS)
 Main PID: 15104 (code=exited, status=233/RUNTIME_DIRECTORY)

 3月 16 11:36:02 melforce systemd[1]: Starting Log Data From CO2Mon...
 3月 16 11:36:02 melforce systemd[1]: Started Log Data From CO2Mon.
 3月 16 11:36:02 melforce systemd[15104]: Failed at step RUNTIME_DIRECTORY
spawning /bin/bash: File exists
 3月 16 11:36:02 melforce systemd[1]: co2mon-log.service: main process exited,
code=exited, status=233/RUNTIME_DIRECTORY
 3月 16 11:36:02 melforce systemd[15105]: Failed at step RUNTIME_DIRECTORY
spawning /bin/cp: File exists
 3月 16 11:36:02 melforce systemd[1]: Unit co2mon-log.service entered failed
state.
 3月 16 11:36:02 melforce systemd[1]: co2mon-log.service failed.

If I commment out options RuntimeDirectory= and RuntimeDirectoryMode= and
create directory /run/co2mon by hand giving it co2mon:co2mon ownership and mode
755, my unit starts successfully.

systemd version is 219.

I've read the manual systemd.exec and I think there are no problems with the
unit itself.</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>