Computer

Linux problems? So you can restart the PC or server

There are many reasons why we may have to restart Linux. The first of them, and the most common, is because the system has downloaded new software updates (for example, new kernel, or a new full version of the distro). But there are also other reasons, such as, for example, in the event that an error occurs, or we make a very large change in the system that we cannot solve by stopping and starting services by hand.

What is reboot

Restarting an operating system, no matter whether it is Windows, macOS or Linux, is a process by which we close all the programs that are running, destroy all the information stored in the RAM memory and, automatically, we restart the computer.

During the boot process, all the elements necessary for the operating system to function are reloaded. Therefore, if a process or service was malfunctioning, restarting it should no longer give us problems.

Depending on the operating system, shutting down and restarting may or may not be the same. For example, in the case of Windows, when turning off and on we are saving the Kernel part of memory on hard disk so that when you turn it on, it takes much less time. On Linux, this is usually not available, and the load times are usually the same on power off and on as on reboot. The difference is either that the computer turns on automatically after shutting down, or we have to turn it on by hand from the button.

Do it from the desktop

Gone are the days when Linux was an operating system where only commands could be executed, and anyone who used it could be considered a “hacker.” Today, Linux distros feature very simple and intuitive desktop environments to use, both inspired by Windows and their own that seek to improve the usability of users or bring features from old systems that have been lost (such as the two task bars).

Let’s use the desktop we use, we will have the option to restart the computer from it, using only the mouse. Of course, the location of the button may vary.

For example, on the desktop MATE (used in Linux Mint), we can find the option within the start menu that we will find in the lower left part of the screen. In the case of GNOME (used in Ubuntu), for example, we will find the option to “Shut down” in the menu at the top right, and within it the option to restart.

Restart Ubuntu

Thanks to these complete graphical environments we will not need to learn any type of special command to carry out a task as basic as this. Of course, there are times when we cannot use the desktop, or we are connected to the terminal remotely. And, in those cases, we must resort, yes or yes, to these commands that we are going to see now.

Use a terminal

If we do not want to use the desktop, or we are remotely connected to the computer, it is possible to restart it very easily with a simple command of terminal. Of course, we will need to have superuser permissions to be able to execute it. The command that we must execute to restart Linux is:

sudo reboot

But we can also restart the computer or server using the shutdown command (shutdown) with the corresponding parameters. That is, we would have to execute the following in the terminal so that it does the same as the previous command:

sudo shutdown -r

The window of “shutdown” versus “reboot” is that the latter offers us more parameters and options with which to control the reboot task. For example, we can indicate the time we want the computer to restart in the following way:

sudo shutdown -r 00:00

We must change 00:00 (midnight) for the time we want to restart the PC. For example, at 3:30 in the afternoon it would be the command: “sudo shutdown -r 15:30”.

Also, if we do not want to indicate a time and what we want is to indicate a specific time (5 minutes, for example), the command that we must execute in the console is as follows:

sudo shutdown -r +5

And, in addition, we can show a reminder message when our Linux is going to restart. What we must do is enter the comment after the minutes, or the hour, between quotes, such as:

sudo shutdown -r +10 "¡Atención! Reinicio de mantenimiento en 10 minutos"

Finally, if we regret it and want to cancel the reboot process, we can do it using the -c parameter of shutdown as follows:

sudo shutdown -c

Power off and on, or reboot?

As we have already explained, there is not much difference between turning off and on the Linux computer, or restart it. The objective is the same, and it is to finish everything that is open and running and to start again from scratch.

Now, do the two techniques work for all situations? Well no. Depending on what we are going to do with the computer, we will have to choose one or the other. For example, if we are finishing our day, and we are not going to continue using the computer, we better turn it off, to save energy, and we will turn it on the next day, when we are going to use it. But if what we want is to install an update, for example, the restart is much faster and allows us, in a few moments, to use the computer again without having to move.

Also, if we are remotely connected to our PC or our server, and we do not have physical access to it, turning it off would be a mistake, since we would not be able to turn it on again. So rebooting is a solution so that, as in the previous examples, the server or PC is back up and running in seconds.

Of course, if it is a server, it is better not to restart in production moments, and to do it at night or when there are no people working.

Related Articles