<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 - systemd thinks timesyncd has failed if /var/tmp doesn't exist"
   href="https://bugs.freedesktop.org/show_bug.cgi?id=89217">89217</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>systemd thinks timesyncd has failed if /var/tmp doesn't exist
          </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>Linux (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>jdub@perkypants.org
          </td>
        </tr>

        <tr>
          <th>QA Contact</th>
          <td>systemd-bugs@lists.freedesktop.org
          </td>
        </tr></table>
      <p>
        <div>
        <pre>Everything about the timesyncd service and binary seemed to be correct, but it
was hitting a restart limit, and I was seeing the following error in the
journal:

systemd-timesyncd.service failed to run 'start' task: No such file or directory


That usually indicates that there's something wrong with the ExecStart program,
but it existed, and worked fine.

Shawn Landden (scientes) suggested I strace PID 1 to see what systemd thought
was going on.

It turns out that because systemd fails to create a directory under /var/tmp,
it thinks that timesyncd itself is broken. If I create /var/tmp, timesyncd is
A-OK!

I don't know if the absence of /var/tmp is a problem with my science experiment
of a distro (it's OpenWrt + systemd), but systemd should definitely not blame
timesyncd for the failure to create a directory under /var/tmp, and... is it
necessary anyway?

I create a symlink from /var/tmp to /tmp, and now that timesyncd is running,
here's the contents of /var/tmp:

# find /var/tmp/
/var/tmp/
/var/tmp/systemd-private-496647d450244423afd7faaa2ac6420c-systemd-timesyncd.service-YJDsMU
/var/tmp/systemd-private-496647d450244423afd7faaa2ac6420c-systemd-timesyncd.service-YJDsMU/tmp
/var/tmp/systemd-private-496647d450244423afd7faaa2ac6420c-systemd-timesyncd.service-2vQ4v0
/var/tmp/systemd-private-496647d450244423afd7faaa2ac6420c-systemd-timesyncd.service-2vQ4v0/tmp


And here's the relevant PID 1 strace snippet showing the /var/tmp failure:

mkdir("/var/tmp/systemd-private-496647d450244423afd7faaa2ac6420c-systemd-timesyncd.service-OUeCeA",
0700) = -1 ENOENT (No such file or directory)
umask(0)                                = 077
rmdir("/tmp/systemd-private-496647d450244423afd7faaa2ac6420c-systemd-timesyncd.service-G5yGdf/tmp")
= 0
rmdir("/tmp/systemd-private-496647d450244423afd7faaa2ac6420c-systemd-timesyncd.service-G5yGdf")
= 0
sendmsg(28, {msg_name(0)=NULL,
msg_iov(4)=[{"PRIORITY=4\nSYSLOG_FACILITY=3\nCOD"..., 172}, {"MESSAGE=", 8},
{"systemd-timesyncd.service failed"..., 79}, {"\n", 1}], msg_controllen=0,
msg_flags=0}, MSG_NOSIGNAL) = 260</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>