Should reboot(8) be modified so that it can become the recommended way to reboot a system?
- Reply: Poul-Henning Kamp: "Re: Should reboot(8) be modified so that it can become the recommended way to reboot a system?"
- Reply: Gleb Popov : "Re: Should reboot(8) be modified so that it can become the recommended way to reboot a system?"
- Reply: Vadim Goncharov : "Re: Should reboot(8) be modified so that it can become the recommended way to reboot a system?"
- Reply: Tomoaki AOKI : "Re: Should reboot(8) be modified so that it can become the recommended way to reboot a system?"
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Sun, 09 Feb 2025 16:18:11 UTC
(Warner suggested I should move the discussion to this mailing list.) Right now reboot(8) and halt(8) don't execute rc.shutdown scripts. Thus, both generally shouldn't be used to initiate a reboot/halt and, instead, one usually wants to use the shutdown command. The problem is that people regularly still use reboot and are then surprised that their scripts aren't executed. Part of the problem is that reboot indeed reboots the system, so it is hard to discover that you are using the wrong command. This is also not a documentation issue: official guides all use shutdown and the reboot man page is quite explicit that you probably want to use shutdown instead. People just see the name "reboot" and use it without consulting the docs. To be honest, I find that the current behaviour is a POLA violation, but it has historical reasons. Last year somebody encountered this behaviour and submitted a bug asking for a change in reboot(8) and halt(8) so that they can become the recommended commands (https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=280941). Part of the argument is that fastboot and fasthalt are currently alias to reboot and halt, so anybody who wants the old behaviour can just switch to those commands. Another wrinkle is that the poweroff command is implemented through shutdown and is therefore completely safe to use. While in the bug report there where some voices in favour of the change, there also was a dissenting opinion that wants to keep the current behavior. Overall the discussion had low participation, so the first step should be to figure out what we want to do. Do we want to make reboot and halt safer or do we want to keep the current behaviour? So it would be good if you express your opinion, if you have any, so that we can reach a well-founded decision. Regarding a potential implementation: the easiest solution would be to piggyback on the poweroff implementation. I attached a patch to show how something like that could potentially look like. However, should we decide to actually change reboot and halt, there are further decisions that we need to agree upon. In particular: - do we want to add a flag to reboot/halt/poweroff for a fast shutdown? (maybe -f) In the bug report there was a slight preference to do this. - include/paths.h contains _PATH_REBOOT and _PATH_HALT as definitions for reboot and halt. Those can be defined as fastboot and fasthalt without problem, but should the variables be renamed? In src the only consumer is shutdown, but do we care about other users? - The permissions of reboot and halt are currently "-r-xr-xr-x root wheel" but shutdown and poweroff are "-r-sr-xr-- root operator". Do we want to change this if reboot/halt become safer? - The folder with reboot/halt etc is currently sbin/reboot. Do we want to rename it? Best regards, Daniel