Gentoo Archives: gentoo-dev

From: Markos Chandras <hwoarang@g.o>
To: gentoo-dev <gentoo-dev@l.g.o>
Cc: williamh@g.o
Subject: Re: [gentoo-dev] eselect init
Date: Fri, 21 Jun 2013 16:14:19
Message-Id: CAG2jQ8hpPb6Wr2=3xVjmRGTi_qOCFeDQeTKzsUi+rwgSp7xdaA@mail.gmail.com
In Reply to: Re: [gentoo-dev] eselect init by "Michał Górny"
1 On 21 June 2013 16:29, Michał Górny <mgorny@g.o> wrote:
2 > Dnia 2013-06-21, o godz. 10:16:10
3 > William Hubbs <williamh@g.o> napisał(a):
4 >
5 >> On Fri, Jun 21, 2013 at 12:23:28PM +0200, Michał Górny wrote:
6 >> > > If eselect-init installs the wrapper as /sbin/einit, we don't have to
7 >> > > touch /sbin/init at all, then, the only thing someone would have to do
8 >> > > is to add an entry to their boot loader with init=/sbin/einit on the kcl
9 >> > > to use it.
10 >> >
11 >> > But *if* the wrapper fails to run somehow, e.g. becomes broken,
12 >> > the kernel will fallback to the standard location.
13 >>
14 >> Yes, but if the wrapper replaces /sbin/init, like it does now, and the
15 >> wrapper gets broken, I think you are left with an unbootable system.
16 >
17 > Then kernel falls back to safe /bin/sh which is a minimal safe fallback.
18 >
19 > --
20 > Best regards,
21 > Michał Górny
22
23 Correct. Even if your init end up being broken you end up with a shell
24 so you can fix things yourself.
25
26 (from init/main.c)
27
28 /*
29 * We try each of these until one succeeds.
30 *
31 * The Bourne shell can be used instead of init if we are
32 * trying to recover a really broken machine.
33 */
34 if (execute_command) {
35 if (!run_init_process(execute_command))
36 return 0;
37 pr_err("Failed to execute %s. Attempting defaults...\n",
38 execute_command);
39 }
40 if (!run_init_process("/sbin/init") ||
41 !run_init_process("/etc/init") ||
42 !run_init_process("/bin/init") ||
43 !run_init_process("/bin/sh"))
44 return 0;
45
46
47 But this is not pretty. Not everyone knows how to recover from a
48 broken init. The eselect module aims to offer an elegant way to
49 switch init systems but if that fails then you need some advanced
50 knowledge to fix your system. So my opinion is that before such
51 thing is introduce to the wild, we need to be confident that it will
52 never fail but even if it does, you need to provide a documented way
53 on how to recover. Maybe a bold warning with post-mortem instructions
54 when you first invoke the eselect module is one way to do it.
55
56 --
57 Regards,
58 Markos Chandras - Gentoo Linux Developer
59 http://dev.gentoo.org/~hwoarang

Replies

Subject Author
Re: [gentoo-dev] eselect init William Hubbs <williamh@g.o>