Moreover, the systemctl reboot command allows different options to control rebooting systems on Linux, such as specifying wall messages, time, and boot arguments.
In this guide, I will provide an in-depth explanation of the systemctl reboot command and demonstrate its utilization to effectively restart the system.
How to Reboot using systemctl Command
The systemctl reboot command essentially shuts down the system and restarts it.
To set a message for the logged users before executing the restart, use the –message option.
To reboot without notifying the wall message to all logged users, use the –no-wall option.
To perform a hard reboot or immediate restart, use the –force option.
To schedule the reboot, the –when= option is used with time. For example, to schedule a restart after 30 minutes, the following command will be used.
To learn more about time formats for scheduling reboot, run man system.time command.
Note that the –when= option is added in the systemd version 254; if your version is lower than 254, you may get an unrecognized option error. To check the systemd version, use systemd –version command.
How to Soft-Reboot using systemctl Command
The soft reboot reboots the user space without restarting the kernel. It typically restarts the applications, and other services in the user space without going to the phase of shutdown. The soft-reboot option is introduced in systemd version 254 and may not work in the older versions of systemctl.
Like the standard reboot command, this command also takes –force and –when= options.
Other Options for systemctl reboot Command
The systemctl reboot supports various other options as well:
–boot-loader-entry=ID | Used to load the system to the specified boot entry after reboot. Use help to list available entries. |
–boot-loader-menu=timeout | Used to enable the boot menu after the reboot using a time as parameter. Use 0 to disable the timeout. |
What is the Difference between systemctl reboot and Standard reboot Commands
The systemctl reboot command reboots the system using systemd and has to follow a series of steps to restart the system. It transitions through phases like:
- Terminating all the processes
- Stopping all the services
- Unmounting the file system
- Shutdown the kernel (Not in soft-reboot)
- Initializing the reboot process involves the loading of the firmware, kernel, initrd (initial ramdisk), and mounting file system
On the other hand, the reboot command does not depend on the init system and directly starts the reboot process without undergoing additional steps.
Both commands essentially perform the same operation, however, they differ in providing features, and underlying mechanisms.
Conclusion
The systemctl tool can be used to reboot the system in an organized manner. The reboot option is used with the systemctl command, allowing the setting of a wall message. The systemctl reboot is different from the regular reboot command, as it restarts the system in a series of steps. This guide covers the systemctl reboot command with all options like –message=, –no-wall, –force, and –when=.