Gentoo Archives: gentoo-dev

From: "Michał Górny" <mgorny@g.o>
To: gentoo-dev@l.g.o
Cc: lu_zero@g.o
Subject: Re: [gentoo-dev] eselect init
Date: Sun, 26 May 2013 12:08:08
Message-Id: 20130526140834.0e19ede5@gentoo.org
In Reply to: Re: [gentoo-dev] eselect init by Luca Barbato
1 On Sun, 26 May 2013 13:40:03 +0200
2 Luca Barbato <lu_zero@g.o> wrote:
3
4 > On 5/26/13 12:57 PM, Michał Górny wrote:
5 > > Switch inittab? Now you added really dangerous behavior to the wrapper
6 > > code. I can hardly even express this in words.
7 >
8 > I need it for my purpose, bb-init syntax isn't the same as sysv.
9
10 Then you need to use a different file. Feel free to rename either
11 inittab but don't even think of switching files like this.
12
13 > > You are telling me that a wrapper, a thing that gets executed *every*
14 > > boot needs to do some random magic to know which init system was in use
15 > > and which one is supposed to be in use, and then conditionally move
16 > > around configuration files necessary for it to run. This is just
17 > > *INSANE*.
18 >
19 > I like to think it normal and the wrapper doesn't need to run every time
20 > but only when a switch had been requested. And only if you prefer doing
21 > the switch at boot time instead than at shutdown.
22
23 Well, that makes it a bit less destructive. Though I still don't like
24 the idea.
25
26 > > And what will happen if moving the files fail? What if half of
27 > > configuration belongs to old init, and half to new? And it all happens
28 > > automagically on boot, on an incomplete system without any console
29 > > started, without Internet connection established and without any
30 > > serious mean of help.
31 >
32 > You can:
33 >
34 > - consider rolling back
35 > - drop to a shell
36 >
37 > Nothing so terrible.
38
39 Sounds like an initramfs...
40
41 > > What I'm telling is: if user uses A as init system (and wanted to switch
42 > > to B), last thing he'd expect is C being started. Configuration for
43 > > OpenRC may be long unmaintained, may start services which are not
44 > > supposed to be started anymore and so on.
45 >
46 > The safest would be dropping to a shell in your scenario.
47 >
48 > As I stated from start the "switch on boot" would work so the wrapper
49 > checks a switch had been requested, it knows the current init, that must
50 > work since worked the previous boot, the next init, that supposedly
51 > should work, does the pivoting, shuffling and such and the next boot it
52 > just hands over to the current init.
53
54 It all depends on how it is implemented. If we decide not to
55 touch /sbin/init, then sysvinit will be the effective fallback at some
56 earlier or later point, depending on what will fail. This is what I
57 really dislike.
58
59 > > We're not talking about percentages here. A *single* fragile script is
60 > > enough to cause trouble. Ten good ones won't revert it.
61 >
62 > A single fragile script can be fixed I guess, which is the one you have
63 > in mind that is concerning?
64
65 You could've asked me that when I was still using OpenRC. I don't
66 really want to grep the 40 scripts right now, and I don't think I have
67 the worse cases installed here.
68
69 > > What are you talking about now? I was just saying that *if* you
70 > > link /sbin/init to systemd, and you're running sysvinit, 'init foo'
71 > > will be passed through to telinit.
72 > >
73 > > But now I see that I was wrong and it actually happened when
74 > > 'systemctl' was symlinked to 'init'. Nevermind then.
75 > >
76 > > In any case, keeping all the tools like 'telinit' should be *enough* to
77 > > keep the current init running and rebooting.
78 >
79 > You are focused on systemd, I'm focused on bb-init among the rest, it
80 > uses a different syntax for the inittab, so if you want to switch from
81 > one or another you either prepare a least-action script that switch the
82 > inittab on reboot or a first-action script that does that on boot.
83 >
84 > For your needs probably just pivoting a symlink should work almost fine,
85 > as long your stay sysvinit compatible, yet doing that as early init or
86 > as post kill-all should work better even in your case.
87
88 Well, you're transforming a simple idea with potentially relatively
89 wide audience into a horror story with a single user.
90
91 --
92 Best regards,
93 Michał Górny

Attachments

File name MIME type
signature.asc application/pgp-signature

Replies

Subject Author
Re: [gentoo-dev] eselect init Luca Barbato <lu_zero@g.o>