Reboot into failsafe direct from running system

Is there a way of triggering an automatic reboot into failsafe from a running system?
I mean such that I don't need to press any hardware buttons or other triggers.
Similar to a "reboot to bios" function on some computers.

I don't know for what use case yet, just wanted to know if it is possible (even if not implemented today)?

/lib/preinit/30_failsafe_wait

failsafe_wait() {
grep -q 'failsafe=' /proc/cmdline && FAILSAFE=true && export FAILSAFE
  • grub based systems pretty easy ( sed default )
  • uboot systems with access to bootopts likely need recompile to support them from cmdline ( fw_setenv )

in other words, preinit has hooks but you'd need a custom method to modify cmdline from the running system ( and revert back ). not sure if a flagfile routine would work as due to rom being read only...

1 Like