1 |
On Thu, May 28, 2015 at 2:11 PM, Canek Peláez Valdés <caneko@×××××.com> wrote: |
2 |
> |
3 |
> Actually, it does work (see attached screenshot). I set my root= kernel |
4 |
> command line parameter wrong on purpose, and systemd (inside dracut) dropped |
5 |
> me inside a rescue shell. |
6 |
|
7 |
Interesting. Perhaps it just enables shell access. |
8 |
|
9 |
There is a separate option that configures whether dracut drops to a |
10 |
shell at all, or if it just hangs on failure. The latter might be |
11 |
desirable for security purposes in some cases. |
12 |
|
13 |
Are you sure that you don't get a shell if you don't pass emergency on |
14 |
the command line, but still have an invalid root=? |
15 |
|
16 |
> |
17 |
>> Usually when somebody |
18 |
>> wants a rescue shell, they want it in their root filesystem, and not |
19 |
>> in their initramfs before it has pivoted. That is why dracut has |
20 |
>> options like rd.break. |
21 |
> |
22 |
> But that doesn't help you at all when the problem is exactly that you cannot |
23 |
> mount your root filesystem. With the rescue shell of systemd (inside |
24 |
> dracut), you can analyze the problem, or perhaps even mount your root |
25 |
> filesystem and continue the boot process; the initramfs should have all the |
26 |
> necessary tools to do that. |
27 |
|
28 |
rd.break DOES give you a shell before root is mounted, if you tell it to. |
29 |
|
30 |
rd.shell tells dracut to give you a shell if something fails |
31 |
|
32 |
rd.break forces a shell at the specified point, whether something fails or not. |
33 |
|
34 |
The official docs do not list emergency as a valid dracut option. |
35 |
Obviously systemd uses it, but again the fact that you had to mangle |
36 |
your root= option sugests that systemd within dracut ignores it if it |
37 |
can mount your root. |
38 |
|
39 |
> |
40 |
>> If the problem were with systemd/services/etc in the actual root |
41 |
>> filesystem (once the actual distro has started booting), then putting |
42 |
>> emergency on the command line should get you a rescue shell. |
43 |
> |
44 |
> Again, what if the problem is before *that*? |
45 |
|
46 |
Then you tell dracut to drop to a shell. I wasn't aware that the |
47 |
emergency option actually made a difference, though I'm still not 100% |
48 |
sure that was what did it. |
49 |
|
50 |
> |
51 |
>> The same generally applies to openrc - if the initramfs isn't mounting |
52 |
>> your root filesystem, then passing instructions to openrc won't do |
53 |
>> anything since in that case openrc isn't even running. |
54 |
> |
55 |
> But in this case, systemd *is* inside the initramfs: |
56 |
> |
57 |
> # ls usr/lib/systemd/ |
58 |
> network systemd-cgroups-agent systemd-journald systemd-shutdown |
59 |
> systemd-vconsole-setup |
60 |
> system systemd-fsck systemd-modules-load systemd-sysctl |
61 |
> system-generators |
62 |
> systemd systemd-hibernate-resume systemd-reply-password systemd-udevd |
63 |
> |
64 |
> That's my initramfs. With dracut, systemd *is* the initramfs init system. |
65 |
|
66 |
Sure, and that is how mine works as well. But, obviously systemd in |
67 |
dracut is configured to ignore that parameter when root= is valid, |
68 |
otherwise you'd get a shell every time. I'd have to check the docs, |
69 |
but I suspect that the behavior is configurable, and systemd within |
70 |
the initramfs is configured differently. If nothing else they could |
71 |
just make the rescue target launch the default target/etc. |
72 |
|
73 |
-- |
74 |
Rich |