Skip to main content
Topic: How to Shutdown/reboot right? (Read 2636 times) previous topic - next topic
0 Members and 2 Guests are viewing this topic.

How to Shutdown/reboot right?

Hey Guys,

im running Artix with OpenRC. I dont use any Desktop or something. Only Openbox :-)

I dont know if this Category here is right, but i observed following:

If i shutdown with "shutdown" or reboot with "reboot", its happens to fast for me :-)

With the same configuration on Arch (Arch with Openbox), the Shutdown/Reboot process is maybe 5x slower.

I can see how systemd stops every daemon, unmounts mounts, sync filesystems etc until it shutdown or reboots.

But on Artix/Openrc? from "shutdown"/"reboot" until its done, its faster as i can look. Maybe less as a secound.

Found on Gentoos OpenRC wiki, that there is loginctl poweroff is used for example. I tried (elogind is installed), but its to fast too.

Is this a problem? Im serious. I really like that. But if that occurs to a filesystem corruption or other problems, than i dont want that :-)

With chromium for example i can see, that after a restart for example, chromium notifies me that chromiun didnt was closed properly. On Arch i didnt had this problem.  But i dont care. Because i know how to save word documents for example :-)

Sry for my bad english.


Re: How to Shutdown/reboot right?

Reply #2
I've never used vanilla Arch, is it really so much slower than Artix during boot and shutdown? Debian, f.e., is on par or even slightly faster, especially when compared with OpenRC.

Runit and s6 are even faster than OpenRC though.

But if you are worrying that there would be some dangerous messages which you miss because of the speed with which these disappear, don't worry. In OpenRC, all messages printed on the screen during boot and shutdown are stored into the /var/log/rc.log file, you can always access it and read what's within.

Re: How to Shutdown/reboot right?

Reply #3

No, why? Its a serious question/concern i have.

I've never used vanilla Arch, is it really so much slower than Artix during boot and shutdown? Debian, f.e., is on par or even slightly faster, especially when compared with OpenRC.

Runit and s6 are even faster than OpenRC though.

But if you are worrying that there would be some dangerous messages which you miss because of the speed with which these disappear, don't worry. In OpenRC, all messages printed on the screen during boot and shutdown are stored into the /var/log/rc.log file, you can always access it and read what's within.

No. boot is "normal" speed. My only question is about shutdown.

I never saw a OS based on Linux, wich shutdowns so fast. And the reason why i ask, is because this must have a reason why on Artix/openrc its so fast, that it behave like if somebody had plug out the cable from the wall, and on "normal" Arch with Systemd, you see first how the Desktop/X gets closed, then all the daemon gets shutdown, how everything gets unmounted and so on.

the /cvar/log/rc.log i already have checked. But there are only messages about boot. not shutdown.

Edit:

checked rc.log again. indeed there are lines about shutdown, they only so less that i overlooked them.

Code: [Select]
rc shutdown logging started at Sat Jan 22 23:24:53 2022

 * Caching service dependencies ...
 [ ok ]
 * Stopping local ...
 [ ok ]
 * Saving random seed ...
 [ ok ]
 * Unmounting network filesystems ...
 [ ok ]
 * Stopping elogind ...
 [ ok ]
 * Stopping connmand ...
 [ ok ]
 * Stopping dbus ...
 [ ok ]
 * Unmounting loop devices
 * Unmounting filesystems
 *   Unmounting /boot ...
 [ ok ]
 * Deactivating swap devices ...
 [ ok ]
 * Stopping udev ...
 [ ok ]
 * Setting hardware clock using the system clock [UTC] ...
 [ ok ]

rc shutdown logging stopped at Sat Jan 22 23:24:55 2022

Here is a example. Like you can see, from submitting the command to mainboard shutoff, only 2 secounds.

On Systemd (thats what i think is the reason), that is definitely longer as 10 secounds.

The boot process is normal with 9 Secounds (what the log says).


Re: How to Shutdown/reboot right?

Reply #4
Is this a problem? Im serious. I really like that. But if that occurs to a filesystem corruption or other problems, than i dont want that :-)
If you thought OpenRC is fast, you know nothing, Jon Snow. All our other inits are even faster. Testing new installations, I routinely get to the lightdm screen in less than 2 seconds and shutdown in 1.

With chromium for example i can see, that after a restart for example, chromium notifies me that chromiun didnt was closed properly. On Arch i didnt had this problem.  But i dont care. Because i know how to save word documents for example :-)
That's nothing to do with the shutdown/reboot sequence. Just save your docs and close your browser before powering off. Note: browsers tend to keep writing to disk for quite some time after you close them. You should allow a few seconds after close before you shutdown.

Re: How to Shutdown/reboot right?

Reply #5
https://refspecs.linuxbase.org/LSB_3.0.0/LSB-PDA/LSB-PDA/shutdown.html
Quote
The shutdown command shall shut the system down in a secure way (first synopsis), or cancel a pending shutdown (second synopsis). When the shutdown is initiated, all logged-in users shall be notified immediately that the system is going down, and users shall be prevented from logging in to the system. The time specifies when the actual shutdown shall commence. See below for details. At the specified time all processes are first notified that the system is going down by the signal SIGTERM. After an interval (see -t) all processes shall be sent the signal SIGKILL. If neither the -h or the -r argument is specified, then the default behavior shall be to take the system to a runlevel where administrative tasks can be run. See also Run Levels.

or other problems, than i dont want that :-)
Then close your programs properly before shutdown/reboot. Having 100+ tabs of soyscript web pages open in a browser prolongs the time between initiating the exit from it and its process(es) actually terminating. This is not specific to Artix, nor GNU/Linux in general.

Re: How to Shutdown/reboot right?

Reply #6
That's nothing to do with the shutdown/reboot sequence. Just save your docs and close your browser before powering off. Note: browsers tend to keep writing to disk for quite some time after you close them. You should allow a few seconds after close before you shutdown.

Ok? But why didnt this occured on Arch never? For example if you are so crazy, and install M$ Office with wine, open a word document, and shutdown the computer, you can see in the shutdown process something like: "Stopping XYZ (i think it was X?)... (0.20 / 1.30 min) for example. I think maybe openrc handles this different? He didnt "ask" the processes to quit, he simply kill -9 them?

Like said, dont have a problem with it.

If you thought OpenRC is fast, you know nothing, Jon Snow. All our other inits are even faster. Testing new installations, I routinely get to the lightdm screen in less than 2 seconds and shutdown in 1.

Really? I really dont care so much about boot/shutdown speed, because if i start my machine, im afk, and if i shutdown, im afk :-)
I use openrc only, because i know it from gentoo. Wich one is the fastest? runit?

https://refspecs.linuxbase.org/LSB_3.0.0/LSB-PDA/LSB-PDA/shutdown.htmlThen close your programs properly before shutdown/reboot. Having 100+ tabs of soyscript web pages open in a browser prolongs the time between initiating the exit from it and its process(es) actually terminating. This is not specific to Artix, nor GNU/Linux in general.

Like said, i never had this "problem" with Arch/systemd. On there, every step have a 1.5min timelimit out of the box.

If anytime soon the "chromium nagging" thing becomes something that annoys me, i would simply create 2 alias'es wich first closes chromium gracefully and then do a shutdown/reboot.

Re: How to Shutdown/reboot right?

Reply #7
Interesting.

Found now one way more to shutdown/reboot (what the heck, how many exists?  :D )
(based on the posted link here https://refspecs.linuxbase.org/LSB_3.0.0/LSB-PDA/LSB-PDA/shutdown.html)

But didnt seem to work:

Code: [Select]
[user@terra ~]$ shutdown
/usr/bin/openrc-shutdown --single
 * openrc-shutdown: you must be root

[user@terra ~]$ sudo shutdown
/usr/bin/openrc-shutdown --single
 * openrc-shutdown: No shutdown time specified
Usage: openrc-shutdown -c | --cancel
   or: openrc-shutdown -R | --reexec
   or: openrc-shutdown -w | --write-only
   or: openrc-shutdown -H | --halt time
   or: openrc-shutdown -K | --kexec time
   or: openrc-shutdown -p | --poweroff time
   or: openrc-shutdown -r | --reboot time
   or: openrc-shutdown -s | --single time

Options: [ cdDfFHKpRrswChqVv ]
  -c, --cancel                      cancel a pending shutdown
  -d, --no-write                    do not write wtmp record
  -D, --dry-run                     print actions instead of executing them
  -H, --halt                        halt the system
  -K, --kexec                       reboot the system using kexec
  -p, --poweroff                    power off the system
  -R, --reexec                      re-execute init (use after upgrading)
  -r, --reboot                      reboot the system
  -s, --single                      single user mode
  -w, --write-only                  write wtmp boot record and exit
  -h, --help                        Display this help output
  -C, --nocolor                     Disable color output
  -V, --version                     Display software version
  -v, --verbose                     Run verbosely
  -q, --quiet                       Run quietly (repeat to suppress errors)
[user@terra ~]$ sudo shutdown --version
shutdown: invalid command line option
[user@terra ~]$ sudo shutdown -V
shutdown: invalid command line option
[user@terra ~]$ sudo shutdown -v
shutdown: invalid command line option
[user@terra ~]$ sudo shutdown --verbose
shutdown: invalid command line option
[user@terra ~]$

Re: How to Shutdown/reboot right?

Reply #8
There's no fundamental reason for shutdown to take long. Basically all inits do is send SIGTERM to every process (99% of programs respect this and will quit very soon). There will be a wait period to let programs exit gracefully and then it'll send SIGKILL to everything to those few douche programs that refuse to shutdown. After that it's just some cleanups and unmounting filesystems. I think systemd by default has a really long timer on waiting for a program to shutdown hence why people can see the "a stop job is running" message for quite some time.

Re: How to Shutdown/reboot right?

Reply #9
When it unmounts the drives, mount also sync's. Try starting a really big slow file op, writing GB's to a USB for example, then run sync as root, which is perfectly safe to do. It won't return the cursor for a while. This should happen on shutdown and it ought to pause until umount completes. The problems mainly are from some (not all) usually older spinning drives that cache electronically on sync and report they are done for performance, but haven't really written it to the magnetic disks, so need power a while longer. You can probably write in some extra sync and sleep delays before shutdown somehow. COW filesytems like BTRFS ensure the FS is always consistent so also help.

Re: How to Shutdown/reboot right?

Reply #10
Interesting.

Found now one way more to shutdown/reboot (what the heck, how many exists?  :D )
(based on the posted link here https://refspecs.linuxbase.org/LSB_3.0.0/LSB-PDA/LSB-PDA/shutdown.html)

But didnt seem to work:
Read that whole page. It is a well known GNU/Linux command.
Quote
time       
specify when to shut down.

The time argument shall have the following format: [now | [ +]mins | hh:mm] If the format is hh:mm, hh shall specify the hour (1 or 2 digits) and mm is the minute of the hour (exactly two digits), and the shutdown shall commence at the next occurence of the specified time. If the format is mins (or +mins), where mins is a decimal number, shutdown shall commence in the specified number of minutes. The word now is an alias for +0.

Re: How to Shutdown/reboot right?

Reply #11
If i shutdown with "shutdown" or reboot with "reboot", its happens to fast for me :-)
With the same configuration on Arch (Arch with Openbox), the Shutdown/Reboot process is maybe 5x slower.
:o   :'(
Quote
I can see how systemd stops every daemon, unmounts mounts, sync filesystems etc until it shutdown or reboots.
The output of openrc / runit is pretty and quite practical for setting up the system.
As a normal user, I want to see either nothing or as little of it as possible. (Plymouth is not a solution)
As an admin, I don't necessarily need confirmation that I've done my job well.
Instead, I just expect to see a message on the screen when errors occur.

During "shutdown" and "reboot" I don't want to see anything at all.
Because both as a normal user and as an admin I know what I am doing and why I am doing it.

I only wrote that because I have never read that computers are too fast and software from a team from a world-renowned garage is not a benchmark for anything.
"Wer alles kann, macht nichts richtig"

Artix USE="runit openrc slim openbox lxde gtk2 qt4 qt5 qt6 conky
-gtk3 -gtk4 -adwaita{cursors,themes,icons} -gnome3 -kde -plasma -wayland "

 

Re: How to Shutdown/reboot right?

Reply #12
Depends on your init system, reboot/shutdown may call different binaries to perform the task. But like many have stated in the thread, the steps are similar, tell all running processes to exit, cleanup, and then either boot or poweroff. You should feel confident to run Artix 'cause all init systems are well tested, especially OpenRC as the oldest one.

Systemd does everything slow 'cause it's bloated and makes things un-necessarily complicated. That's the main reason why you're here. :)