[systemd-devel] emergency vs. rescue

Lennart Poettering lennart at poettering.net
Tue Sep 7 09:25:49 PDT 2010


On Tue, 07.09.10 12:09, Bill Nottingham (notting at redhat.com) wrote:

> 
> Lennart Poettering (lennart at poettering.net) said: 
> > In systemd, "emergency" is little more than an equivalent to
> > init=/bin/sh on the kernel command like. i.e. you get a shell
> 
> Not as it's currently configured. sysinit.service has
> 'Before' on it. Is that not intentional?

It is intentional. This i added to make sure that the emergency shell is
gone before sysinit is started, in case the user boots into the
emergency shell and then types "systemctl default" or "systemctl
rescue" to bring up a bigger part of the system.

Note that After/Before not only control the startup order but also the
shutdown order.

The rules go like this:

1. If between a unit A and B neither After nor Before is defined their
   start or stop may be fully parallized in all thinkable ways.

2. If A has a Before dep on B, and two jobs are scheduled for the two
   units, being either "start" or "stop", then the following ordering
   table is followed:

           | A/start                      | A/stop
   --------+------------------------------|-----------------------------
   B/start | A/start first, B/start second| A/stop first, B/start second
   --------+------------------------------+-----------------------------
   B/stop  | B/stop first, A/start second | B/stop first, A/stop second

   Where "A/start" means "A shall be started". The inner fields of the
   table will tell you the execution order of the jobs, and the headers
   tell you the jobs that are scheduled.

3. If A has an After dep on B, then because After is the inverse of
   Before, B will have a Before dep on A, and the inverse of the table
   from #2 applies.

Note the assymmetry: if two units have an ordering dep between them,
and one shall be stopped and the other started, then the stopping
happens first the start second, regardless wheher After or Before is
used!

And I hope this is not too confusing...

Lennart

-- 
Lennart Poettering - Red Hat, Inc.


More information about the systemd-devel mailing list