1 |
On Mon, May 27, 2013 at 10:36:41AM +0000, Duncan wrote |
2 |
|
3 |
> Here's an idea I've not seen proposed yet. |
4 |
> |
5 |
> Make the wrapper function something like a cross between a simple |
6 |
> bootloader and traditional single-user-mode. |
7 |
> |
8 |
> Normal mode, like the bootloader for many users, would be a default |
9 |
> choice with (configurable) either a timeout of a couple seconds, or (say |
10 |
> shift) key-held-down detection, thus no boot delay as if the key isn't |
11 |
> down at the moment of detection, boot proceeds using the existing config. |
12 |
> |
13 |
> In the event of an init switchup, the user either sets an option before |
14 |
> shutdown (much like the run-once defaults of grub, etc, set pre- |
15 |
> shutdown), or selects switchup mode with the appropriate boot-time |
16 |
> trigger (using the above mentioned timeout or key-down sensing). |
17 |
|
18 |
That is still adding unnecessary complexity to the systems, and an |
19 |
additional possible point of failure. |
20 |
|
21 |
> The special switchup mode would then operate much like single-user in |
22 |
> terms of available functionality and the fact that it's a special mode |
23 |
> used for system maintenance, but would (normally, with a drop-to-shell |
24 |
> option as well) be rather more guided, presumably using a menu, again |
25 |
> much like a bootloader, except that it's PID-1 instead of pre-kernel. |
26 |
|
27 |
What does this accomplish that could not be accomplished by... |
28 |
* placing a switcher script in /sbin |
29 |
* booting to single-user mode, and running the switcher script |
30 |
|
31 |
> Critical point #1 is that much like single-user mode, switchup mode |
32 |
> would NOT run normally, but would be specifically selected, with |
33 |
> either a reboot or simply starting the new init system at switchup |
34 |
> mode exit. |
35 |
|
36 |
It waddles like single-user mode |
37 |
It quacks like single-user mode |
38 |
It flies like single-user mode |
39 |
It *IS* single-user mode |
40 |
|
41 |
Why bother re-inventing the wheel. Use single-user mode, already. |
42 |
|
43 |
> Critical point #2 is that the actual normal-mode wrapper would be very |
44 |
> small both in terms of boot-time and code, thus both easy to debug, and |
45 |
> not increasing boot time by much at all, particularly in key-down- |
46 |
> detection mode where there'd be no timeout delay to tick down. A small |
47 |
> binary that simply either runs the timout or detects key-down, before |
48 |
> execing the normal init, is all that would run in a normal bootup. The |
49 |
> complex functionality would only be invoked if switchup mode is chosen, |
50 |
> as entirely separate functionality execed place of the normal init it |
51 |
> would have otherwise execed. |
52 |
> |
53 |
> Meanwhile, switchup mode (again, a separate binary execed only if chosen |
54 |
> from the tiny one designed to run inline at each boot) would have a menu |
55 |
> with options to invoke scripts for each of the init-system choices |
56 |
> offered, and a further fall-back to shell option. |
57 |
> |
58 |
> Each init-system package would then depend (perhaps conditionally based |
59 |
> on an init-switcher USE flag) on the init-switcher package, and would |
60 |
> ship one gentoo specific file, the switcher script, thus putting each |
61 |
> switcher script under the control of the gentoo maintainers for that init- |
62 |
> system package, who could set it up to be as simple or as complex as |
63 |
> necessary for their init system. Those who needed a rw root to switch |
64 |
> out various files could arrange for their switcher script to handle that, |
65 |
> while those who could do without, possibly handling things later with |
66 |
> their own native init-service, could do without the rw root bit. |
67 |
> Similarly, switchup mode exit-time behavior, presumably either simply |
68 |
> triggering a reboot, or starting the selected init-system directly, would |
69 |
> be entirely under the control of the individual init-system package |
70 |
> maintainers, via the switch-script they maintain. |
71 |
|
72 |
I repeat, all this can be handled in single-user mode right now. |
73 |
|
74 |
> As a first bonus, even people who aren't interested in more than one init- |
75 |
> system might find setting the init-switcher USE flag useful, especially |
76 |
> on EFI systems, since it would give them the advantages of switchup mode, |
77 |
> namely a drop to shell option as yet another alternative to single user |
78 |
> mode, |
79 |
|
80 |
Oh boy... a second single-user mode. |
81 |
|
82 |
> AND perhaps even MORE importantly, access to a more or less automated |
83 |
> init-system restore option, triggered via selection of the same |
84 |
> switcher script that would otherwise be run to switch between init- |
85 |
> systems. Again, the contents of that init-system-specific switcher- |
86 |
> script would be entirely under the control of the gentoo maintainers |
87 |
> for that package, so they could do whatever fancy working-condition |
88 |
> checks and restores from backup that they wanted. |
89 |
|
90 |
What you're talking about is rescue-CD functionality. I don't know if |
91 |
it's possible, but it would be very nice as a standalone rescue CD |
92 |
(actually USB stick nowadays). If so, I would much rather prefer it on |
93 |
as rescue CD/USB-stick than as a boot option. If a system is really |
94 |
screwed up, you can't even assume that it'll boot to single-mode from |
95 |
the hard drive. |
96 |
|
97 |
> As a second bonus, switchup mode would be extremely flexible and |
98 |
> extensible via these scripts, and I'd envision people writing extension |
99 |
> scripts for all sorts of additional functionality. Backups while the |
100 |
> system is quiesced? Hook for boot-chart and similar modes? A fast-boot |
101 |
> special media-player mode? Something else exotic in mind? No problem! |
102 |
> Hack up a special purpose switchup-mode script for it, and "the world's |
103 |
> your oyster!" |
104 |
|
105 |
I think you've just re-invented the bootloader (lilo/grub). It can |
106 |
boot Gentoo, Fedora, BSD, any special-purpose kernel you wish, and even |
107 |
Windows 7 for that matter. |
108 |
|
109 |
-- |
110 |
Walter Dnes <waltdnes@××××××××.org> |
111 |
I don't run "desktop environments"; I run useful applications |