В Thu, 10 Apr 2014 09:46:56 -0400 Vivek Goyal <vgo...@redhat.com> пишет:
> On Thu, Apr 10, 2014 at 06:38:59AM +0400, Andrey Borzenkov wrote: > > [..] > > > So with nofail opion for rootfs we should have following situation. > > > > > > - sysroot.mount > > > Before=initrd-root-fs.target > > > - initrd-root-fs.target > > > Requires=sysroot.mount > > > OnFailure=emergency.target > > > - initrd.target > > > Wants=initrd-root-fs.target > > > OnFailure=emergency.target > > > - dracut-pre-pivot.service > > > After=initrd.target sysroot.mount > > > > > > Now let us say sysroot.mount failed activation because root device did not > > > show up. We waited for certain time interval, then time out. Now what will > > > happen to initrd-root-fs.target and initrd.target states. > > > > > > > Assuming initrd-root-fs.target Requires sysroot.mounts it enters Failed > > state and systemd effectively executes analog of "systemctl start > > emergency.target". What happens after that is defined entirely by what > > emergency.target pulls in. > > > > initrd.target in your example does not depend on sysroot.mount in any > > way so unless there are further indirect dependencies it actually > > should be reached at this point. > > initrd.target Wants initrd-root-fs.target which inturn depends on > sysroot.mount. Wants does not imply any sort of mandatory dependency. Unit A wants unit B means that when systemd gets request to start A it will additionally attempt to start B. Whether it will actually be able to start B is irrelevant. > systemd automatically generates a Requires=sysroot.mount > in initrd-root-fs.target. > > So if sysroot.mount fails, that should start emergency.target as > initrd-root-fs.target will fail. > > As initrd.target has Wants=initrd-root-fs.target, and > initrd-root-fs.target activation has failed. So does that mean that > initrd.target will reach the failed state too and we will try to > launch emergency.target. > No, unless it has some other mandatory dependency (Requires, BindsTo). As already explained, Wants does not imply any sort of dependency between unit states; it is simply convenient shortcut to start multiple units at once. After start job is submitted, units run independently on each other. > What will happen to dracut-pre-pivot.service. It is supposed to run > after intird.target has reached. Now initrd.target has failed activation. > Will dracut-pre-pivot.service be activated? > Yes. Again, After does not imply any mandatory dependency. A After B only says that when two units are started together, A should wait until B startup is complete. If B fails to start, its startup obviously is complete :) so systemd will just continue. One thing I'm not sure about - what "are started together" actually means. I.e. common sense suggests that "systemctl start A B" causes them both be started together. But what if I do "systemctl start A" and later "systemctl start B" while job for A is still running and B has After=A. Will it wait for A startup to complete? _______________________________________________ systemd-devel mailing list systemd-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/systemd-devel