Page MenuHomeFreeBSD

reboot: Default to a clean shutdown
ClosedPublic

Authored by des on Sun, Dec 7, 11:56 PM.
Tags
None
Referenced Files
F139388255: D54117.diff
Thu, Dec 11, 2:20 PM
Unknown Object (File)
Wed, Dec 10, 8:04 AM
Unknown Object (File)
Tue, Dec 9, 11:04 PM
Unknown Object (File)
Tue, Dec 9, 5:59 PM
Unknown Object (File)
Tue, Dec 9, 5:08 PM

Details

Summary

reboot: Default to a clean shutdown

  • If invoked as fasthalt or fastboot, behavior is unchanged.
  • If not invoked as fasthalt or fastboot, we simply signal init(8), just like shutdown(8) does, instead of taking the system down ourselves.
  • Since only init can handle the RB_REROOT case, the -r flag is not supported in fast mode.
  • Update the usage string to correctly reflect the program being run (fast or normal; halt, boot, or nextboot) and the options available in each case.
  • Update the manual page to make the distinction between normal and fast mode clear, better explain what shutdown(8) still does that reboot(8) does not, and add a historical note explaining what the difference between the two used to be.

MFC after: 1 month
Relnotes: yes

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

des requested review of this revision.Sun, Dec 7, 11:56 PM

This is what I've wanted to do for some time now. I didn't look closely enough, but so long as fastboot gives us the current behavior, (aka the -f behavior), I'm good with all this.

Thanks for jumping on this. You may want to take a peek i the arch@ mailing list because there was a discussion of this there that I don't recall all the details to. While I think this is what we want, you might want to check there to see the result to at least anticipate maybe some of the pushback.

This revision is now accepted and ready to land.Mon, Dec 8, 12:12 AM
In D54117#1236374, @imp wrote:

This is what I've wanted to do for some time now. I didn't look closely enough, but so long as fastboot gives us the current behavior, (aka the -f behavior), I'm good with all this.

That is not currently the case, but that's fixable.

In D54117#1236396, @des wrote:
In D54117#1236374, @imp wrote:

This is what I've wanted to do for some time now. I didn't look closely enough, but so long as fastboot gives us the current behavior, (aka the -f behavior), I'm good with all this.

That is not currently the case, but that's fixable.

Great! While not super relevant today, fastboot was the way to do this in VAX 4BSD installations as well as for SunOS though at least 4.x. It would make things a little more consistent and be a story to tell those that want the old behavior. Thanks again for taking this on.

A request: for clarity, can reboot(8) explicitly say something to the effect of "reboot is equivalent to shutdown -r now"?

Use “fast” prefix, not -f flag, to choose modes.

This revision now requires review to proceed.Mon, Dec 8, 1:52 AM
@adamw wrote:

A request: for clarity, can reboot(8) explicitly say something to the effect of "reboot is equivalent to shutdown -r now"?

I concur. When submitting FreeBSD support patches to OS-agnostic projects (example), people often wonder why our poweroff means shutdown -p now, yet reboot is not equivalent to shutdown -r now. Having a definitive short sentence on that matter would be quite helpful.

The manual page already has two entire paragraphs about the past and present differences between shutdown and reboot, and they are not equivalent.

From a historical perspective, I'd prefer fastboot == reboot -f. However, that ship has sailed and we're stuck with either preserving a lot of the current behavior with reboot -f checking or also overloading it with fastboot. Or moving the force to -F. I hate myself that I added -f, but it can't be helped. So fastboot is the least bad choice, imho.

This revision is now accepted and ready to land.Wed, Dec 10, 3:10 AM
In D54117#1236469, @des wrote:

The manual page already has two entire paragraphs about the past and present differences between shutdown and reboot, and they are not equivalent.

I should have written this sooner but, from my perspective, the new wording makes the difference clear and provides the missing information. I'm really excited for this. @des and @imp, thanks for making this happen so quickly!

This revision was automatically updated to reflect the committed changes.