Although Linux does not require frequently restarting as opposed to Windows, sometimes major system updates or serious system glitches may require a system restart. With the introduction of ‘kptach’ by RedHat, system administrators can easily patch critical security updates to the Linux kernel. There is no need to look for the processes to complete, log off the system, or crontab any reboot task. It also increases system uptime without losing productivity. ‘Livepatch’ by Ubuntu also works in the same way. With Livepatch, vulnerability fixes can be patched on the Ubuntu Linux Kernels.
Reboot process helps deadlocked programs exit, apply critical patches, remove temporary files, repair damaged file systems, and perform many system management tasks.
In this guide, we will see different ways of rebooting a Linux Ubuntu 20.04 machine from the command line and GUI. Let’s get started with this tutorial.
This command can be used to stop, power off or restart a machine. It uses a time argument to specify the time for execution. The time argument is ‘now’ for triggering immediate operation. For example, to immediately reboot a system use the ‘-r’ flag with the ‘now’ string:
In the same way, if you want to schedule a reboot after 5 minutes, use the below command:
The time format is “hh:mm” in 24-hr clock format. We can also use ‘+m’ to reboot after ‘m’ minutes from now.
It should be noticed that the ‘shutdown’ command itself also has the capability to shut down, reboot, stop and power off a system.
From the terminal perspective, the reboot command is the fastest and easiest way to reboot a system. Simply type the below command to reboot:
In fact, it is a shortcut for the ‘shutdown -r now’.
In linux, ‘/sbin/init’ is the first process that executes once the kernel is loaded. It means the process has PID 1.
In Linux systems that do not have ‘systemd’, the ‘init’ command stops all running processes, and the disks are then synchronized prior to switching the init states or run levels. The run level 5 is the default run level. The ‘init 6’ command halts the running system and restarts the system to a state listed in ‘/etc/inittab’. To restart, simply use:
In case we want to reboot the Linux Ubuntu to a multiuser state, use the command:
Similarly, to reboot to a Single-User State (Runlevel S), use the command:
To reboot to single user mode is to use the command:
To check your current run level, run the following command:
If the output is like ‘N 1’, this means we have no old runlevel as we have just booted the system:
Now let us boot to runlevel 1 (also called runlevel s) and check the runlevel status:
As you can see, the status has now changed to ‘5 1’. We can again switch back to runlevel 5 by running:
‘Systemd’ has replaced the init process, so the ‘/sbin/init’ has now become a symbolic link to systemd.
On systems having systemd ( as opposed to the init system), you may not find ‘/etc/inittab’. In such a case, use the below command to reboot a system:
Just like runlevels in the SysV init system, systemd uses the so-called “target” system. The above ‘systemctl’ command is the primary interface to systemd. The runlevel 6 of the SysV init system has its equivalent target in systemd as “reboot.target”. So you can also use the above reboot command as:
The simplest and quickest solution is, of course, the reboot button. When you click on the right top corner of your Ubuntu 20.04 system, you will find the ‘Power Off / log Out’ option.
Now when you click on this option, you will see the last option as ‘Power Off’. Press this label, and it will bring you the Power Off window. Hit on the ‘Restart’ button to reboot the system.
You can also find this window by typing ‘reboot’ in the Gnome search bar:
Another way is to use the physical power button; this will display the Power Off window. But beware, this may require first configuring the power button behavior from inside the system settings.
In this guide, we have learned about different ways of rebooting a Ubuntu machine. This guide can also be used for many other Linux distributions besides Ubuntu since all commands are generally the same for them. We have not provided many screenshots of the practicals because it’s not possible to snap a reboot process. But we are sure this guide will run smoothly for your system.
One of the most critical gaps in traditional Large Language Models (LLMs) is that they…
Canonical is continuously hiring new talent. Being a remote- first company, Canonical’s new joiners receive…
What is patching automation? With increasing numbers of vulnerabilities, there is a growing risk of…
Wouldn’t it be wonderful to wake up one day with a desire to explore AI…
Ubuntu and Ubuntu Pro supports Microsoft’s Azure Cobalt 100 Virtual Machines (VMs), powered by their…
Welcome to the Ubuntu Weekly Newsletter, Issue 870 for the week of December 8 –…