[systemd-devel] Systemd port on custom embedded linux

Andrey Borzenkov arvidjaar at mail.ru
Mon Sep 27 09:03:09 PDT 2010


Mon, 27 Sep 2010 02:24:01 +0200 письмо от Lennart Poettering <lennart at poettering.net>:

> 1;2591;0cOn Thu, 23.09.10 16:26, Andrey Borzenkov (arvidjaar at mail.ru) wrote:
> > It could be related to the fact that this is not enough. Standard halt
> command
> > from sysvinit behaves differently depending whether it is called by user
> or
> > by /sbin/init. When called by user it simply pokes init via initctl which
> then
> > re-executes halt once more and this time it really preforms halt. The
> check is
> > 
> > 	/*
> > 	 *	First see if we were started directly from init.
> > 	 */
> > 	if (getenv("INIT_VERSION") && (r =
> getenv("RUNLEVEL")) != NULL)
> > 
> > So on Mandriva I had to add INIT_VERSION to reboot/halt/poweroff units to
> make
> > systemd coexist with sysvinit utilities.
> Hmm, I don't really follow here. And I wonder why this worked fine on
> Fedora and Suse...

Most likely because they use "halt -f" which bypasses above check to actually
shutdown system.

> Should we set INIT_VERSION in the upstream systemd version somewhere? If
> so, care to prep a patch?

I do not think so. Shutdown sequence is distro-specific; apparently all distros
supported by upstream do not need. I had to add it because Mandriva is using plain
/sbin/halt (without -f) and at this early stage I did not want to request any
changes in standard initscripts. If it comes to adding Mandriva as own distro - we'll see.

> Could you elaborate on the rationale for this?

Using standard initscripts/sysvinit-tools shutdown sequence looks like

1. User calls halt/reboot/poweroff
2. Halt tells init to change runlevel via /dev/initctl
3. init starts shutdown sequence for requested runlevel (0/6)
4. As final initscript /etc/init.d/halt is executed that runs /sbin/halt to actually
perform system shutdown.

Check in /sbin/halt is needed to distinguish between 1 and 4 unless -f is given.


More information about the systemd-devel mailing list