Solved sudo reboot does NOT trigger rc.shutdown!

🕷️ 🪲 🐞 🐛 💔

If I sudo poweroff, I can see rc.shutdown being run (saying that all services are stopping, etc).

If I sudo reboot, none of the rc.shutdown output is generated (and I don't see some things executed in rc.shutdown.local as a test).

💻💔
 

Turns out reboot bypasses orderly shutdown via rc.shutdown. 🥴
 
This is a bit of a nightmare for the avalanche of Linux users who are ditching Linux for FreeBSD as we speak.

reboot in Linux runs systemctl reboot and does the orderly shutdown. I think reboot on Linux is a wrapper for that.

This frivolity on the part of FreeBSD has wasted me time during the migration - running reboot and not knowing I'm not getting a proper shutdown.
 
Sorry, not sure I'd blame FreeBSD for your failure to read.

All the technical details aside, from the source code/rc.d/etc, the documentation seems to paint the picture that you should use `shutdown`. ...You (or others) could also just create an alias in your shellrc file pointing to `shutdown -r now`.

From handbook:
To power down a FreeBSD machine on architectures and systems that support power management, use shutdown -p now to turn the power off immediately. To reboot a FreeBSD system, use shutdown -r now. One must be root or a member of operator in order to run shutdown(8). One can also use halt(8) and reboot(8). Refer to their manual pages and to shutdown(8) for more information.

From reboot(8):
Normally, the shutdown(8) utility is used when the system needs to be halted or restarted, giving users advance warning of their impending doom and cleanly terminating specific programs.

From shutdown(8):
The shutdown utility provides an automated shutdown procedure for super-users to nicely notify users when the system is shutting down, saving them from system administrators, hackers, and gurus, who would otherwise not bother with such niceties. In order to use the shutdown command, the user must have root privileges or be a member of the operator group.
 
Why not? I think *BSD is very inviting.
1. Tons of documents.
2. Easy to setup.
3. Engineered.
...


EDIT: I think the majority of the problems are because most times [you] don't know where to look for the information. -e.g. if you've never "moved" a file, how would you know to do a "man mv"?
 
This is a bit of a nightmare for the avalanche of Linux users who are ditching Linux for FreeBSD as we speak.
As others said, making an assumption that FreeBSD is like Linux (or like Windows or like VMS) is unjustified. And the single most important thing about FreeBSD is that it has good documentation, because it is well engineered. As a consumer of FreeBSD, one has to read that documentation.

This frivolity on the part of FreeBSD has wasted me time during the migration - running reboot and not knowing I'm not getting a proper shutdown.
Underlying this is an important architectural observation, which is often forgotten by amateurs. An orderly shutdown is much less important than one thinks. Here's why: The system has to function correctly when it crashes hard, like someone pulls the power plug or the CPU just halts. So the things that are executed in an orderly shutdown have to be designed to be optional. They can make the system more efficient: for example, a restart becomes faster when the system was shutdown, while the restart can be slow, for example with fsck or log recovery when the system crashed. But the orderly shutdown can not affect correctness.

This distinction seems to be lost on people (such as the systemd designers) who try to make sure every shutdown is clean and organized. In your particular case of saving the screen brightness, you are proposing to do so only during an orderly shutdown, and that is (to be blunt) simply wrong. If the screen brightness is important, it needs to be saved any time it is changed. Conversely, if it is not important, it never needs to be changed, and can be set to a default value when restarting. One might argue that it is not all that important, but not completely irrelevant either, so saving it is a "best effort for comfort" thing; that is a weak argument.

Personally, I actually believe in the opposite: when developing and testing systems software, never perform a clean shutdown. Always intentionally crash the system when you want to turn it off. Like that, you get to exercise the recovery procedure a lot more, which makes it more likely that all bugs in it are found, and it will actually work when needed.
 
Back
Top