Introduction
If you don’t know what Linux is to this day, your life has been a lie (no, seriously). If your closest friend came about to tell you it’s an Operating System, slap him (or maybe don’t, you might regret it). Linux originally has been a kernel, but what about in Google search itself where it clearly says it’s an operating system? As it appears to be, so many people have referred to Linux as an OS, that it actually became an OS. Wait, but doesn’t that contradict the first statement I made? Partly.
In order to erase confusion, Linux is now rather called a ‘Family of Operating Systems‘ instead of just a kernel. So wherever you search out for it, they’ll directly call it an Operating System. Nevertheless, it should be made clear that an Operating system is the composition of a kernel along with other pieces of software the user can run. Without the software, a kernel is basically pointless. So When Mr. Linus Torvalds made Linux, he intended it to be a building block for ‘other people to implement their own Operating Systems based around the Linux Kernel‘. Getting the hang of it yet?
Whether or not you’ve understood anything above, what I’m really here for today is to help folks erase the following error message they encounter when trying to boot into their systems, right after a system update:
$ Failed to start Load Kernel Modules
So if you’re one of these folks worried about your system not booting, it’s time to end it (the error message)!
Why do I see this error message?
The reason why I dug so deep about the kernel thing is because I’d like you to understand what it actually is before you dive into the fix itself, as it may help along the way. If you have a good grasp of what a kernel is, then a kernel module should not be much to be understood either. If you look at the error closely. you’d find “Load Kernel Modules”, which means that there is some module that is loadable when your kernel runs, and it has failed to start. This module can range anywhere from the simplest of system calls all the way to video card drivers. And in fact, this is the exact error report many people have referred to, who have an Nvidia Graphics Card on their machine with its required drivers installed.
The problem is not with the graphics card itself, to be exact, and neither is it the fault of the driver. What happens is that when you try to update your system to a newer kernel, but it does not yet support the version of the specified graphics card drivers, it’ll end up showing the error message you might be getting.
But it’d be plainly wrong to think that such driver-kernel mismatches are the only cause for such issues. Alongside these, If there’s a program your OS directly depends on, and you now update your kernel only without updating the those packages, it may end up causing the error as well.
In the following section, we’ll discuss the different stages of fix you can apply in order to successfully surpass the error message, even if you might be unable to use your keyboard for anything at all.
How do I fix it?
The problems reported are mostly from Ubuntu users, as it is the primary source for the error. Therefore, the steps shown and the commands used here will be based on Ubuntu.
Enter the Recovery Menu
Before you can do anything else, you first need to successfully enter the Recovery Menu, or at least, a recovery shell where you can type in commands. If you are able to see the GRUB Menu before your system launches the error message, you can hit the arrow keys on your keyboard and navigate to the Advanced Options for Ubuntu, and press Enter. Inside of here, press your Down Arrow key once to select the line that has (recovery mode) stated, and press Enter once again. This will open up a Terminal Dialog where you’ll see a list of several different commands. Refer to the image below:
Now it’ll be easy to simply select one of the options, which you think should help, and get your job done. But keep in mind that they may not work as expected, so it is better to run the commands manually by yourself. To achieve this, you’ll enter the Root Shell, by selecting the option right before the last one that says root.
However, if you don’t see the GRUB Menu and are unable to access it, there’s another way to enter a different shell where you can, to the very least, type in commands. Once you are encountered by the error message, press the Ctrl + Alt + F1 (or the F2) keys together on your keyboard to enter a different shell.
Connect to the Internet (if you’re unable to)
Before you can run any other commands that require an internet connection, you first need to get the internet connection itself. You could easily do it beforehand by selecting the network option from the Recovery Menu, or you can also try running the following commands in order from inside the root shell you entered (Thanks to apos from StackOverflow for sharing this command):
$ ifconfig ethx <ip> netmask <mask> up
$ echo "nameserver 8.8.8.8" > /etc/resolv.conf
Reconfigure packages with dpkg
The next command may or may not work, but it wouldn’t hurt being given a try. What this fix does is reconfigure your existing programs, fixing broken symlinks and installing dependencies that may have been removed somehow. This might actually install the missing modules too, so try running the following commands in your terminal already:
$ dpkg --configure -a
$ apt-get dist-upgrade
$ apt-get -f install
$ apt-get update
As the original source for the fix states, you might need to run the commands in randomized orders, to see which one works for you.
Boot into a Different kernel version
You’d be lucky if your system has already installed a previous kernel version before you attempted the system update and got it running down. The good news is that Ubuntu keeps at least two kernel versions (or even more) all the time in case you want to revert back, due to situations like these.
You can revert back to a previous kernel version by first rebooting your system, and when you see the GRUB Menu, quickly enter the Advanced Options for Ubuntu once again (like we previously did for entering recovery mode).
Here, at least 2 options below the first one, you should see a kernel version lower than your currently selected kernel version, which should look similar to the image below:
Navigate to that and select it, to see if your system starts successfully. If it did, you can later choose to make this previous kernel to be booted by default instead of the one causing the error message.
Try removing nvidia drivers
This fix is only specific for users with nvidia drivers installed. If no other fixes work for you, consider removing the nvidia drivers from inside the root shell, and then reboot your system to see if it helps:
$ sudo apt-get remove nvidia-*
$ sudo apt-get autoremove
Remove the modules for specific programs
This one is quite rare, but in case you have some program that requires a kernel module, for example the Anbox program in Linux, it is possible that the modules were not properly sourced for your system to trace at startup, so you should consider removing the program itself. If it fixes the issue, try finding alternatives for the program, as your system does not seem to like it…