So the flow that causes the fall through into the emergency shell is:

* Reboot is issued by the user, all molly-guard checks are passed, and the 
system pivots into the initramfs for the shutdown process
* The shutdown steps reach the end (everything is stopped, all disks are 
unmounted, machine is ready for poweroff) and so the last step calls `reboot -f 
-n` to actually issue the hardware reboot command.
* /usr/sbin/reboot is symlinked to /usr/lib/molly-guard, even in the initramfs.
* Molly-guard then looks for `reboot.no-molly-guard` (line 19 checks for the 
existence of `"$CMD.no-molly-guard"`and echos the `"E: not a regular file: 
$EXEC"` and exits 4 when it can't find them)
* Reboot fails and emergency shell is generated.

which is why installing the symlinks fixes it - molly-guard finds them
and calls them. I *suspect* the better fix is to install the .no-molly-
guard versions as `/usr/sbin/shutdown,reboot,poweroff,...}` in the
initramfs, I just don't know enough about dracut to know how to install
one file with another name - I think we'd need to create a module, but I
don't know how that would conflict with
/usr/lib/dracut/modules.d/86shutdown trying (which currently installs
shutdown and reboot)

If we do keep it simple and just insert the .no-molly-guard files into
the initramfs, we *don't* need the config files, the actual Molly-guard
check happened when the user issued the reboot command, long before we
pivoted into the initramfs for the shutdown. All molly-guard should be
doing now is passing us through to the `*.no-molly-guard` version of the
command. In fact, I suspect we actively *Do Not Want* the config
included - I suspect very few users will be writing their run.d scripts
expecting them to run inside an initramfs environment, and the odds
they'll call a program or look for a file that isn't there is high,
which will terminate the reboot and cause a drop into an emergency
shell.

-- 
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.
https://bugs.launchpad.net/bugs/2167868

Title:
  Molly-guard breaks sutdown/reboot on Ubuntu Resolute

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/molly-guard/+bug/2167868/+subscriptions


-- 
ubuntu-bugs mailing list
[email protected]
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs

Reply via email to