[systemd-devel] Failed at step RUNTIME_DIRECTORY spawning /usr/bin/true: File exists

Ivan Shapovalov intelfx100 at gmail.com
Thu Aug 13 17:28:50 PDT 2015


On 2015-08-10 at 15:46 +0200, Reindl Harald wrote:
> 
> Am 10.08.2015 um 15:28 schrieb Ivan Shapovalov:
> > On 2015-08-10 at 15:14 +0200, Reindl Harald wrote:
> > > 
> > > Am 10.08.2015 um 15:05 schrieb Ivan Shapovalov:
> > > > On 2015-08-10 at 11:16 +0200, Reindl Harald wrote:
> > > > Moreover,
> > > > 
> > > > > 
> > > > > * "RuntimeDirectory" is a service configuration
> > > > > * the daemon is started as unprivileged user
> > > > > * "RuntimeDirectory" should be created long before
> > > > >      ExecStart / ExecStartPost
> > > > 
> > > > This is wrong. The runtime directory "will be created <...>
> > > > when
> > > > the unit is started, and removed when the unit is stopped".
> > > 
> > > what is wrong?
> > 
> > The runtime directory should be created right before the unit is
> > started, not "long before ExecStart / ExecStartPost".
> 
> so why trying to create it before "ExecStart" *and* "ExecStartPost"

Because there may be no ExecStart= but ExecStartPost=.

> > > "unit is started" is for me pretty clear the whole systemd-unit
> > > 
> > > > As can be seen from the code, the runtime directory creation is
> > > > attempted on execution of each configured process, be it
> > > > ExecStart=
> > > > or
> > > > ExecStartPost= (or whatever else)
> > > 
> > > and why in the world is the code written that way?
> > 
> > This is pointless rhetoric.
> 
> no it is not pointless rhetoric
> it's a serious question

See above.

Doing explicit checks against existence of certain entries or
implementing an ad-hoc FSM is way more fragile than just writing
idempotent code.


> 
> > > there is no logical reason that "RuntimeDirectory" created once
> > > would
> > > disappear while starting the other processes as well as
> > > tempfiles.d
> > > which get replaced by "RuntimeDirectory" isn't fired all the time
> > 
> > Why do you think that it would disappear between starting two
> > processes
> > belonging to the same unit?
> 
> why do the developers think that?

See above.

> if they don't think so why attempt creation for *each configured 
> process* of the same systemd-unit?
> 
> > The runtime directory is destroyed when a
> > unit enters inactive state. systemd always attempts to create it
> > when
> > it forks off a control process, just (I guess) because it's more
> > robust
> > to do it that way rather than to implement a separate state machine
> > just for that purpose. Now, there was a TOCTOU-style race
> > condition,
> > and it got fixed indeed as far as I can see
> 
> yes, the race condition seems now to be fixed
> 
> but it would have been impossible to happen if *really* "The runtime 
> directory should be created right before the unit is started" would
> be 
> the implementation because there would be no second (needless) attemt 
> to create it

See above.

-- 
Ivan Shapovalov / intelfx /

> but a single point of early code which creates it with the 
> correct permissions and any following ExecStart* could rely that it 
> exists
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 213 bytes
Desc: This is a digitally signed message part
URL: <http://lists.freedesktop.org/archives/systemd-devel/attachments/20150814/11dccf5a/attachment.sig>


More information about the systemd-devel mailing list