1

On the machine I'm currently at, sudo reboot will only give me a warm reboot.

Is sudo reboot -f a safe way to do a cold reboot (through BIOS)?

I'm booting through MBR, not EFI and I'm using upstart (Linux Mint 17.3 (base off of Ubuntu 14.04)).

It seems a little too quick, so I'm a little worried if it won't corrupt my filesystem.

  • (Short answer: don't use reboot -f). There seem to be two halves of this question - safety, and cold v.s. warm. You say you've tried it. Can you please say what makes you think it did something different, w.r.t cold v.s. warm? Or if not, what are you actually trying to achieve that needs to know whether it is a cold or warm boot? – sourcejedi Jul 27 '18 at 18:03
  • @sourcejedi I get my BIOS logo with reboot -f and I can choose a different boot device with reboot -f. Without the -f I can't. I can get the same effect with poweroff followed by my pressing the power key, but it'd be nicer if I could just run a command. – PSkocik Jul 27 '18 at 18:06
  • 1
    (It is good to edit the question if it seemed to need clarification. So far it seems there are two people who weren't sure what it meant :). reboot command can be provided by many different packages. Please specify if you are using systemd, sysvinit, upstart, or something else. Also, e.g. there is a specific option under EFI, to boot into some sort of EFI interactive thing instead. And you already mentioned the BIOS. It would be good to specify whether you are using EFI boot or MBR boot. – sourcejedi Jul 27 '18 at 18:16
  • (Some people would say "through BIOS", even when they use EFI boot, so I can't tell based on that phrase). – sourcejedi Jul 27 '18 at 18:18
  • @sourcejedi MBR, upstart. Added to the question. – PSkocik Jul 27 '18 at 19:03
1

The point of reboot -f is to bypass all the shutdown steps performed by your init system in situations where those steps are failing or expected to fail :-). I strongly recommend against using it outside of that case.

You would be correct to assume that unmounting filesystems in an orderly manner is one such step on upstart.

(systemd would be a whole different ball of wax, and the effects may vary... Which is another reason you should be wary of poking reboot -f. It is a rather obscure detail, and clearly you did not find any documented connection between it, and the effect you observed).


AFAICT, the comment in man 2 reboot which refers to kernel 2.1.122 and the old i386 architecture remains true. At least as of kernel v4.17, and the new unified x86 architecture for both 32- and 64-bit.

Whether the kernel aims for a warm or cold reboot is determined by reboot_mode. And the only place this is set, is by the reboot= kernel option e.g. reboot=cold.

Given that you care about it and the default does not seem to be documented, the naive first step would be to try specifying that. This looks like a pure boot option, that cannot be changed on a running system.

https://elixir.bootlin.com/linux/v4.17/source/Documentation/admin-guide/kernel-parameters.txt#L3732

https://elixir.bootlin.com/linux/v4.17/source/kernel/reboot.c#L518

https://elixir.bootlin.com/linux/v4.17/source/arch/x86/kernel/reboot.c#L545


If you look at the last link, one theoretical possibility is that one of the reboot types in the fallback chain didn't work, after all the other upstart init scripts have been stopped (or vice versa??). So that invoking reboot -f manually uses a different reboot type, and it varied in how it respected reboot_mode. (On your specific system?).

If you are able to report a difference between Linux and Windows reboot behaviour, the kernel developers might well be interested. Though they would be most interested if Linux was completely failing to reboot :). I would want to confirm the above wild guess by recompiling with some printk() and sleep calls and find out what actual reboot types are being used...

There is also the possibility to flail around passing the different reboot types in the boot option. It feels like you'd be making a rather indirect guess... but it seems like passing a specific reboot option is the best hope unless this hairy piece of kernel code can gain some clever fix for your system.

0

AFAIK reboot -f is a command that was used on older systems. I would not use it.
A safer method would be sudo shutdown -r now. The alternative to power off the machine is sudo shutdown -P now. In both instances, now can be replaced with a numeric value to define the time when the shutdown will commence.

See shutdown(8) full documentation.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.