[systemd-devel] systemd-218 - Requisite implies TriggeredByRestartOf
alban at endocode.com
Tue May 19 04:08:13 PDT 2015
On Tue, May 19, 2015 at 1:26 AM, Lennart Poettering
<lennart at poettering.net> wrote:
> On Tue, 19.05.15 00:55, Lennart Poettering (lennart at poettering.net) wrote:
>> On Thu, 14.05.15 21:23, Evert (evert.gentoo at planet.nl) wrote:
>> > Hi,
>> > According to the systemd documentation, Requisite disallows starting a
>> > unit unless the specified unit has been started. This seems to work
>> > fine, however, if the specified unit has been restarted, this unit will
>> > be started too!
>> > This is not what should happen and it doesn't happen with a stop and
>> > start of the specified unit, so clearly, restart behaves different than
>> > stop followed by start.
>> Hmm, I figure this is a bug in systemd.
>> Whenever you have a unit A declare a Requisite= on a unit B then this
>> will actually create two dependencies: the actual Requisite= one plus
>> one in the opposite direction, of type RequiredBy=. Dependencies of
>> type "RequiredBy=" are mostly internal to systemd, you cannot
>> configure them directly (though you can query them using "systemctl
>> show"). They are used to track down what to stop when we get
>> "systemctl stop" by the user. Now, as a special shortcut we currently map
>> "Requisite=" and "Required=" to a reverse dependency of
>> "RequiredBy=", which is problematichere, since we'll hence make no
>> distinction between the two when processing "systemctl stop".
>> I figure we need to split up the reverse dep here, and introduce a
>> seperate RequisiteBy= dependency so that we can avoid this problem...
> Fixed in git. Please verify.
The commit be7d9ff730cb88d7c6a869dd5c47754c78ceaef2 ("core: introduce
seperate reverse dependencies for Requires= and Requisite=")
introduced a regression in rkt: the container does not stop anymore
when the main service terminates. In my test, grep says we have one
unit using a Requisite* option (systemd-update-utmp-runlevel.service).
The main unit file uses one "Requires" option":
== sha512-0543bc3759cd76d21d8605cd55e19bea.service ==
Requires=prepare-app at -opt-stage2-sha512\x2d0543bc3759cd76d21d8605cd55e19bea-rootfs.service
After=prepare-app at -opt-stage2-sha512\x2d0543bc3759cd76d21d8605cd55e19bea-rootfs.service
"/rkt/env/sha512-0543bc3759cd76d21d8605cd55e19bea" "0" "0" "/inspect"
I am trying to understand the regression... it's possible that it is
rkt using systemd incorrectly.
More information about the systemd-devel