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

Reindl Harald h.reindl at thelounge.net
Thu Aug 6 01:57:40 PDT 2015



Am 06.08.2015 um 10:46 schrieb Lennart Poettering:
> On Sat, 01.08.15 11:54, Reindl Harald (h.reindl at thelounge.net) wrote:
>
>>
>> Am 27.07.2015 um 21:39 schrieb Lennart Poettering:
>>> On Wed, 15.07.15 16:24, Reindl Harald (h.reindl at thelounge.net) wrote:
>>>
>>>> why does systemd *randomly* try to create "RuntimeDirectory"
>>>> for "ExecStartPost" and so terminates a perfectly up and running service
>>>> because the "file exists" error?
>>>>
>>>> Fedora 21 as well as Fedora 22
>>>> https://bugzilla.redhat.com/show_bug.cgi?id=1226509#c3
>>>>
>>>> Jul 15 16:19:43 rawhide systemd: Stopping Test Unit...
>>>> Jul 15 16:19:43 rawhide systemd: Stopped Test Unit.
>>>> Jul 15 16:19:43 rawhide systemd: Starting Test Unit...
>>>> Jul 15 16:19:43 rawhide systemd: Failed at step RUNTIME_DIRECTORY spawning
>>>> /usr/bin/true: File exists
>>>> Jul 15 16:19:43 rawhide systemd: test2.service: control process exited,
>>>> code=exited status=233
>>>> Jul 15 16:19:43 rawhide systemd: Failed to start Test Unit.
>>>> Jul 15 16:19:43 rawhide systemd: Unit test2.service entered failed state.
>>>> Jul 15 16:19:43 rawhide systemd: test2.service failed.
>>>
>>> Can you file an issue about this on github with a reproducer for v221
>>> or v222? Thanks!
>>
>> the reproducer is in https://bugzilla.redhat.com/show_bug.cgi?id=1226509#c3
>> just a few lines of a systemd-unit
>>
>> dunno if this affects v221 and v222 too - Fedora user
>> but it is very likely since it exists from v216 to v219
>>
>> why not just dig in the code and remove that completly useless "file exists"
>> check instead be happy that the folder is already there?
>
> So, you'll get this EEXIST error only if there's already something at
> the place of the runtime dir that is either:

NOBODY but systemd creates that directory
it don't exist at all before the service is started

the problem is that SOMETIMES at stop is
seems not to be removed and so the next start
fails

the second problem is that SOMETIMES systemd creates
RuntimeDirectory for ExecStart *and* ExecStartPost
and if that happens ExecStartPost fails and so the
service too which is killed hence while the main
process is already running fine

you *really* should look at 
https://bugzilla.redhat.com/show_bug.cgi?id=1226509#c3

"systemctl stop test2; systemctl start test2; sleep 1; cat messages" is 
fine repeatly and *randomly* some systemd-racecondition with the above
problems happens when a service with RuntimeDirectory is stopped and
started often enough *and* that happens regulary on machines where
a cronjob stops a service every hour to backup data and start it
again

> a) not a directory
>
> or
>
> b) a directory, but not owned by the user and group set for the
>     service
>
> or
>
> c) a directory, but with a more loose access mode than specified in
>     RuntimeDirectoryMode=.
>
> systemd is completely fine with the directory pre-existing, as long as
> it really is a directory, is owned by the right user and group and has
> an access mode that is at least as strict as the configured one.
>
> It would be good if you could verify that file data of the runtime dir
> when this fails for you. Thanks.



-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 181 bytes
Desc: OpenPGP digital signature
URL: <http://lists.freedesktop.org/archives/systemd-devel/attachments/20150806/cf8303cb/attachment.sig>


More information about the systemd-devel mailing list