Bug 243094 - reboot problem
Summary: reboot problem
Status: New
Alias: None
Product: Base System
Classification: Unclassified
Component: bin (show other bugs)
Version: CURRENT
Hardware: Any Any
: --- Affects Some People
Assignee: freebsd-bugs (Nobody)
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2020-01-04 18:44 UTC by Bernhard Berger
Modified: 2020-01-07 09:48 UTC (History)
2 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Bernhard Berger 2020-01-04 18:44:06 UTC
I discovered a problem with "reboot" today that affects everyone who uses reboot.
I assumed that reboot would exit the system cleanly, but this is not the case. I discovered this after writing a script for the rc-system and wondering why the script did not run when using reboot.  However, when using "shutdown -r now" the stop function is executed. 
Basically you assume that "reboot" does the same as "shutdown -r now". 
therefore my suggestion to replace reboot with a shell script which does nothing else but "shutdown -r now".

With kind regards
Comment 1 Conrad Meyer freebsd_committer 2020-01-05 06:54:02 UTC
I agree it's a confusing distinction, but I think it's pretty baked in at this point.  The documentation for reboot(8) could be better about pointing at shutdown.
Comment 2 Bernhard Berger 2020-01-05 08:04:59 UTC
"reboot" does the same thing in name as "shutdown -p -now"!

No, it doesn't, it doesn't call "/etc/rc.shutdown" and that's a big mistake in my eyes because the programmers of rc.d/scripts assume that their services which start with "# KEYWORD shutdown" are executed on shutdown (reboot is also a kind of shutdown).

Please make sure that "reboot" executes the script "/etc/rc.shutdown". Many people will "not" read the manual for reboot because the name already says what it does. For me, the inexperienced use of "reboot" has led to some serious errors and I was very surprised about that. 

I will not use reboot any more until I am informed that it is running /etc/rc.shutdown because rebooting two different programs on the same system is unnecessary. Therefore I prefer to add the missing options in "shutdown".


With kind regards

translated from German to English with deepL
Comment 3 Mark Johnston freebsd_committer 2020-01-05 18:19:36 UTC
(In reply to Bernhard Berger from comment #2)
The point is that "reboot" has worked this way for a long time, and changing it will likely break existing workflows.  So while it is unfortunate that "reboot" and "shutdown -r now" do not do the same thing, I don't think we can realistically change it.
Comment 4 Bernhard Berger 2020-01-05 18:46:04 UTC
(In reply to Mark Johnston from comment #3)

Yes, there are four alternatives:
1. replace reboot with a script that executes "shutdown -r now
2. reboot to make sure that it restarts the system in accordance with the system
3. abandon reboot! What I'm going to do now!
4. switch to linux in the furture 


bye bye FreeBDS
Comment 5 Conrad Meyer freebsd_committer 2020-01-05 19:03:13 UTC
So AFAICT, this command isn't specified by POSIX; we're not constrained by a standard, just history.  What Linux has done is make reboot more like 'shutdown', unless you specify "--force" (and maybe there is some weird semantics for --force --force, I didn't read the manual closely), it does a clean shutdown.

I don't know if people would object strongly to 'reboot' => 'shutdown -r' like behavior, with 'reboot -f' or 'reboot --force' providing the old behavior.  Probably.  It's the kind of thing old FreeBSDers love to bikeshed about. :-(
Comment 6 Bernhard Berger 2020-01-05 19:37:54 UTC
(In reply to Conrad Meyer from comment #5)

I am a user and use FreeBSD as a server system for a home server. 
What I really liked about FreeBSD was the ports system. Of course, between ports that are not part of the FreeBSD system, you have to evaluate differently than programs that are part of the system.
A program that says what it does by name must also do exactly what it says by name.

reboot >>>> System reboot
shutdown -r now >>> System reboot 

reboot <<< do the same >>> shutdown -r now

at least by all appearances.

I found out by accident that reboot does not execute the script /etc/rc.shutdown(logs). And therefore not the service vm!  VM's take a long time to shut down and are then simply shot down and I have always wondered about VM's being shot AFTER using reboot. Then I always manually stopped all VM#s before a reboot. Often the system got stuck and had to be rebooted by me via power off/on with anxious in my heart if everything will start well again. 
And as it looks it is reboot that caused all the trouble.  I never expected such an error.

But this is a big mistake, because basically "MUST" reboot does the same as shutdown -r now and this is because that's what the name "reboot" says.

You should not ignore this problem. 

I am very disappointed  

ps: i am now thinking about switching to linux or windows.
Comment 7 Conrad Meyer freebsd_committer 2020-01-05 20:39:38 UTC
(In reply to Bernhard Berger from comment #4)
> 4. switch to linux in the furture 
> bye bye FreeBDS

(In reply to Bernhard Berger from comment #6)
> ps: i am now thinking about switching to linux or windows.

These are not useful ultimatums and in case you are under the mistaken impression otherwise, they are not magic incantations to give more credence to your proposal.  If anything, it hurts the credibility of your otherwise good suggestion.

If Linux or Windows would meet your needs better, solely because there is hesitation to change 40 years of historical behavior of the 'reboot(8)' command, that's totally fine.  Use the right tool for the job; if it isn't FreeBSD for you, that's ok!  The world is better with a diversity of operating systems and FreeBSD isn't and shouldn't always be the best option for all cases.

Your theory on how naming programs governs their behavior and how similar programs MUST behave identically is certainly novel, but ultimately incorrect.  Your best case for this change was already made in the bug description.
Comment 8 Bernhard Berger 2020-01-05 21:31:29 UTC
(In reply to Conrad Meyer from comment #7)

I'll give you an example:
If it says "bread" on the package, then any reasonable person would assume that there is bread inside.
This is also the case with the "reboot" program, so even if called without parameters, the "reboot" function should be executed in a system-compliant manner, and that includes executing /etc/rc.shutdown.
But it's not the error that upsets me, it's that you don't even try to fix it. I am very outraged by this. 
Maybe it wasn't so serious "before" and therefore not noticeable. But with the arrival of bhyve, it takes on a whole new meaning. Therefore, the program reboot should definitely be revised and adapted to the new requirements (this has obviously been missed). 
Since it is not part of the Posix standard, you can also move it into the ports and remove it from the ports with notice.    
 
There are solutions, you just have to want it.
Comment 9 Bernhard Berger 2020-01-05 21:38:05 UTC
like this, and that's it. No more discussion. I'm very upset.  
Overwork reboot or don't. No more bug reports from me, that upsets me too much.
Comment 10 Jack 2020-01-07 02:40:48 UTC
I think the correct solution would be to update how reboot works on the next major version of FreeBSD and put it in the RELEASE notes. That way people can know what to expect if they were still using the reboot command and not have any surprises.
Comment 11 Bernhard Berger 2020-01-07 09:48:58 UTC
(In reply to Jack from comment #10)
It makes little sense to have two different programs for rebooting FreeBSD. 
Reasons: Double the effort! And one (shutdown) is developed further and the other (reboot) is forgotten.  
So I think the best thing to do is to move the reboot program into the ports with the new release 13 and the missing features could be included in shutdown. If you still want to use it, you can install it with a warning message and from release 14 on you can remove it from the ports collection, so that there is only one program to start/stop/reboot the system.

PS: 
after a lot of excitement, I have calmed down and am now staying with FreeBSD after all. 

translated with DeepL from german to english