Gentoo Archives: gentoo-dev

From: Luca Barbato <lu_zero@g.o>
To: "Michał Górny" <mgorny@g.o>, gentoo-dev@l.g.o
Subject: Re: [gentoo-dev] eselect init
Date: Sun, 26 May 2013 11:40:17
Message-Id: 51A1F493.90101@gentoo.org
In Reply to: Re: [gentoo-dev] eselect init by "Michał Górny"
1 On 5/26/13 12:57 PM, Micha³ Górny wrote:
2 > On Sun, 26 May 2013 11:55:24 +0200
3 > Luca Barbato <lu_zero@g.o> wrote:
4 >
5 >> On 5/26/13 8:43 AM, Micha³ Górny wrote:
6 >>> On Sat, 25 May 2013 11:54:48 +0200
7 >>> Luca Barbato <lu_zero@g.o> wrote:
8 >>>
9 >>>> - /sbin/init (or whatever linux currently calls by default with top
10 >>>> priority) should be either a symlink to the actual implementation or a
11 >>>> wrapper such as our gcc one. I like better the latter since it is
12 >>>> overall safer. The former might or might work since linux has some
13 >>>> fallback capabilities but hadn't been tested.
14 >>>
15 >>> Increased complexity is never safer. And a wrapper means the additional
16 >>> complexity gets there every boot. And considering how the discussion
17 >>> goes, the wrapper will grow openrc-size in a few months...
18 >>
19 >> Openrc is small, but the wrapper really needs to know which is which and
20 >> worst case switch inittab.
21 >
22 > Switch inittab? Now you added really dangerous behavior to the wrapper
23 > code. I can hardly even express this in words.
24
25 I need it for my purpose, bb-init syntax isn't the same as sysv.
26
27 > You are telling me that a wrapper, a thing that gets executed *every*
28 > boot needs to do some random magic to know which init system was in use
29 > and which one is supposed to be in use, and then conditionally move
30 > around configuration files necessary for it to run. This is just
31 > *INSANE*.
32
33 I like to think it normal and the wrapper doesn't need to run every time
34 but only when a switch had been requested. And only if you prefer doing
35 the switch at boot time instead than at shutdown.
36
37 > Did anyone notice already that moving stuff around actually requires
38 > rootfs mounted R/W? Which means the wrapper needs to repeat a fair bit
39 > of init/RC work.
40
41 Noticed and known issue, I merely stated which are the options on the
42 plate, keep in mind that init addons people use and we distribute do
43 even more evil stuff.
44
45 > And what will happen if moving the files fail? What if half of
46 > configuration belongs to old init, and half to new? And it all happens
47 > automagically on boot, on an incomplete system without any console
48 > started, without Internet connection established and without any
49 > serious mean of help.
50
51 You can:
52
53 - consider rolling back
54 - drop to a shell
55
56 Nothing so terrible.
57
58 > And did you? You keep repeating this and jumping straight to developing
59 > work-arounds without even waiting for an answer. And I think William
60 > has already spoken that the code supports it.
61
62 I read the code up to do_exec, given for me it would require have a
63 roundtrip to the efi shell I was hoping those proposing that would do
64 that basic homework =)
65
66 > In any case, I've just tested it. Replaced /sbin/init with a dangling
67 > symlink, rebooted with init=/sbin/init and the kernel ran /bin/sh
68 > as a fallback.
69
70 That's all I wanted everybody knows, thanks for helping.
71
72 > OpenRC relies on a few layers of various tools plus a lot of init
73 > scripts written by different people. Those init scripts include tasks
74 > such as parsing configuration files (well, more of grepping them)
75 > and manipulating runtime files. The complexity of OpenRC is the sum
76 > of all that.
77
78 I read it as "as complex as the user wants".
79
80 > To make this point cleaner to you: what if the fallback ran systemd
81 > instead? As in, init gets broken somehow and kernel falls back to
82 > starting systemd on your unprepared OpenRC system. Is this a behavior
83 > you'd like?
84
85 I would expect any sane init would get me at least to their single mode.
86
87 > What I'm telling is: if user uses A as init system (and wanted to switch
88 > to B), last thing he'd expect is C being started. Configuration for
89 > OpenRC may be long unmaintained, may start services which are not
90 > supposed to be started anymore and so on.
91
92 The safest would be dropping to a shell in your scenario.
93
94 As I stated from start the "switch on boot" would work so the wrapper
95 checks a switch had been requested, it knows the current init, that must
96 work since worked the previous boot, the next init, that supposedly
97 should work, does the pivoting, shuffling and such and the next boot it
98 just hands over to the current init.
99
100 The wrapper could even install and uninstall itself.
101
102 Again, my object of interest is being able to use bb-init and runit.
103
104 > We're not talking about percentages here. A *single* fragile script is
105 > enough to cause trouble. Ten good ones won't revert it.
106
107 A single fragile script can be fixed I guess, which is the one you have
108 in mind that is concerning?
109
110 > What are you talking about now? I was just saying that *if* you
111 > link /sbin/init to systemd, and you're running sysvinit, 'init foo'
112 > will be passed through to telinit.
113 >
114 > But now I see that I was wrong and it actually happened when
115 > 'systemctl' was symlinked to 'init'. Nevermind then.
116 >
117 > In any case, keeping all the tools like 'telinit' should be *enough* to
118 > keep the current init running and rebooting.
119
120 You are focused on systemd, I'm focused on bb-init among the rest, it
121 uses a different syntax for the inittab, so if you want to switch from
122 one or another you either prepare a least-action script that switch the
123 inittab on reboot or a first-action script that does that on boot.
124
125 For your needs probably just pivoting a symlink should work almost fine,
126 as long your stay sysvinit compatible, yet doing that as early init or
127 as post kill-all should work better even in your case.
128
129 lu

Replies

Subject Author
Re: [gentoo-dev] eselect init "Michał Górny" <mgorny@g.o>
Re: [gentoo-dev] eselect init Ian Stakenvicius <axs@g.o>