We are always used to it is that, when we press the computer button, the POST, or BIOS boot, is executed, and immediately afterwards our operating system begins to load . In a few seconds we will be at the login screen, after which we will see the desktop and we can start using the computer. However, neither Linux, nor any other operating system, is perfect. Therefore, it is very likely that we will find that our operating system does not start. In that case, what can we do? Well, learn how to solve Linux problems with these tips.
Linux does not usually give as many problems when starting as Windows, since, badly, even if we do not reach the desktop, at least we can load a basic TTY from which to repair the system. However, it can fail. And the most common failures that can cause this system to not boot are either boot loader (GRUB) or hard drive failures.
Next, we are going to see what these main problems are and how we can solve them.
Check that there are no problems with the PC hardware
First of all, it is very important to make sure that the problems are not related to the PC hardware . The most common is that the hard drive begins to fail (especially if it is mechanical), or we may have problems with the board, RAM or power supply.
If we get to GRUB, for example, we can launch Memtest to check the integrity of the RAM and the CPU. But if we want to know the status of the hard disk, for example, we will have to resort to other specialized programs that allow us to see the SMART of the disk. And for this, we can load an Ubuntu Live from RAM to avoid going through the hard disk.
Linux bootloader problems
When we install a Linux distribution, it usually installs a boot loader that will allow us to choose the version, or tool, that we want to load. The most common and used is GRUB. This bootloader allows us to load Linux, a different operating system (if we have, for example, Windows in Dual-Boot), run Memory Test (to see if the RAM is in good condition) or run other advanced tools and recovery tools. the distro in question.
If we only have one system installed, we probably won’t see GRUB, since it will start the main system automatically by default. However, there are many reasons why this boot can be corrupted, for example a kernel update, or setting an old kernel that we have removed to boot.
If our Linux stops booting, we can hold down the Shift key on the PC while loading to see this GRUB screen. Here we will see all the systems that we have installed, and we can navigate through them using the keyboard arrows.
We can try loading a different Kernel version to see if it works. And even if we use Dual Boot we will check that we can boot this operating system. However, if GRUB does not appear, then the fault will be with the partition manager.
Repair GRUB with Boot-Repair
If we can’t boot Linux, how can we repair the boot? The answer is very simple: using a Live system, for example Ubuntu. Live systems are loaded into RAM so they can run without installing anything on the hard drive. Once loaded, it will have access to all the disks and all the resources of the PC, so we can use specific tools, such as Boot-Repair, to repair problems.
We will open a terminal and install this tool to repair GRUB by executing the following command:
sudo apt-add-repository ppa:yannubuntu/boot-repair && sudo apt update && sudo apt install -y boot-repair
Once the tool is ready, we execute it with the ” boot-repair ” command and let it analyze our system. The program will be able to detect all the operating systems that we have installed on our computer and will give us the option of applying a recommended repair. We choose it, we wait a second and that’s it.
We apply the changes, restart the PC and that’s it. Now we can see our GRUB again, and all the systems installed on the PC. We select the one we want to start and voila, everything should work normally again.
Troubleshoot Linux Boot
If we can see GRUB, choose the operating system, and where the problem is is in the boot process, then we must resort to other tools to help us solve it. This can happen, for example, when a package is incorrectly installed, or a file on the system is corrupted.
Among the entries that we can find in GRUB we will find a call ” Advanced options “. In it we can find different entries, depending on the kernel that we have installed, and a “Recovery” mode for all kernels. We can try to start an older version of the kernel to see if it works, but what we are going to explain is how to solve the problems of the latest version.
Within these advanced options, we will choose the Recovery Mode of the latest version of the Kernel. After a few seconds of loading, we can see a screen like the following one with a series of options.
The ones that interest us are:
- fsck – Scans the hard drive and fixes any errors it finds. It is the Windows equivalent of chkdsk.
- clean: frees up unnecessarily used space on the PC.
- dpkg – fixes broken, blocked or improperly installed packages.
- grub: allows us to update the bootloader.
We execute all these options to check, release, repair and update our Linux and its boot loader, and that’s it. When we finish, we can restart the PC and check if it starts up again.
Reinstall Linux (and keep the data)
If we continue to have problems, it may be time to reinstall our operating system . Many of the distros, like Ubuntu, have the option of reinstalling only the operating system, keeping all personal data (documents, music, photos, videos, etc.) intact, and even the applications that we already have installed.
In the installation wizard we must choose the option to keep our data so that it is not deleted from the PC . However, if we have a backup, we can also do a complete installation, from scratch, to make sure that all problems are solved.
In addition to reinstalling the entire operating system, the GRUB bootloader will automatically rebuild and reinstall.