On Thu, May 28, 2015 at 2:11 PM, Canek Peláez Valdés <[email protected]> wrote: > > Actually, it does work (see attached screenshot). I set my root= kernel > command line parameter wrong on purpose, and systemd (inside dracut) dropped > me inside a rescue shell.
Interesting. Perhaps it just enables shell access. There is a separate option that configures whether dracut drops to a shell at all, or if it just hangs on failure. The latter might be desirable for security purposes in some cases. Are you sure that you don't get a shell if you don't pass emergency on the command line, but still have an invalid root=? > >> Usually when somebody >> wants a rescue shell, they want it in their root filesystem, and not >> in their initramfs before it has pivoted. That is why dracut has >> options like rd.break. > > But that doesn't help you at all when the problem is exactly that you cannot > mount your root filesystem. With the rescue shell of systemd (inside > dracut), you can analyze the problem, or perhaps even mount your root > filesystem and continue the boot process; the initramfs should have all the > necessary tools to do that. rd.break DOES give you a shell before root is mounted, if you tell it to. rd.shell tells dracut to give you a shell if something fails rd.break forces a shell at the specified point, whether something fails or not. The official docs do not list emergency as a valid dracut option. Obviously systemd uses it, but again the fact that you had to mangle your root= option sugests that systemd within dracut ignores it if it can mount your root. > >> If the problem were with systemd/services/etc in the actual root >> filesystem (once the actual distro has started booting), then putting >> emergency on the command line should get you a rescue shell. > > Again, what if the problem is before *that*? Then you tell dracut to drop to a shell. I wasn't aware that the emergency option actually made a difference, though I'm still not 100% sure that was what did it. > >> The same generally applies to openrc - if the initramfs isn't mounting >> your root filesystem, then passing instructions to openrc won't do >> anything since in that case openrc isn't even running. > > But in this case, systemd *is* inside the initramfs: > > # ls usr/lib/systemd/ > network systemd-cgroups-agent systemd-journald systemd-shutdown > systemd-vconsole-setup > system systemd-fsck systemd-modules-load systemd-sysctl > system-generators > systemd systemd-hibernate-resume systemd-reply-password systemd-udevd > > That's my initramfs. With dracut, systemd *is* the initramfs init system. Sure, and that is how mine works as well. But, obviously systemd in dracut is configured to ignore that parameter when root= is valid, otherwise you'd get a shell every time. I'd have to check the docs, but I suspect that the behavior is configurable, and systemd within the initramfs is configured differently. If nothing else they could just make the rescue target launch the default target/etc. -- Rich

