Bug 89217 - MSG: improve error message when PrivateTmp= is used for a service but /var/tmp or /tmp don't exist.
Summary: MSG: improve error message when PrivateTmp= is used for a service but /var/tm...
Status: NEW
Alias: None
Product: systemd
Classification: Unclassified
Component: general (show other bugs)
Version: unspecified
Hardware: Other Linux (All)
: medium normal
Assignee: systemd-bugs
QA Contact: systemd-bugs
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2015-02-19 03:28 UTC by Jeff Waugh
Modified: 2015-05-15 14:28 UTC (History)
0 users

See Also:
i915 platform:
i915 features:


Attachments

Description Jeff Waugh 2015-02-19 03:28:34 UTC
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
Comment 1 Lennart Poettering 2015-05-15 14:28:45 UTC
Well, PrivateTmp= sets up private /tmp and /var/tmp instances for services. And for that we need /tmp and /var/tmp to be around...

But yeah, we should certainly improve the error message in this case...


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.