This article will show you step by step how to handle Ubuntu freezing during startup by installing NVIDIA proprietary drivers. This tutorial has only been validated on a newly installed Ubuntu system, but should be available in other situations as well.
I recently bought an Acer Predator laptop to test various Linux distributions. This big, clunky machine is a far cry from the small, lightweight laptops I like, like the Dell XPS.
The reason I chose this esports laptop even when I wasn’t playing games was because of the NVIDIA graphics card. The Acer Predator Helios 300 comes with an NVIDIA Geforce GTX 1050Ti graphics card.
NVIDIA is known for its poor Linux compatibility. Many It’s FOSS readers have asked me for help with NVIDIA laptops in the past, and I couldn’t help because I didn’t have a system that used NVIDIA graphics cards.
So when I decided to get a dedicated device to test Linux distributions, I chose a laptop with an NVIDIA graphics card.
The laptop’s original Windows 10 comes with a 120-GIGAByte solid-state drive, plus a 1-terabyte mechanical drive for data storage. On top of that, I configured Windows 10 and Ubuntu 18.04. The whole installation process is comfortable, convenient and fast.
Then I started Ubuntu. The familiar purple interface came out, and THEN I realized it was stuck. The mouse didn’t move, I couldn’t type anything, and there was nothing I could do except press the power button to forcibly shut it down.
Then try it again, and the results are exactly the same. The whole system was stuck on the purple screen, and the subsequent login screen couldn’t come out.
Sound familiar? Let me tell you how to solve the problem of Ubuntu freezing during startup.
If you’re not using Ubuntu
Please note that although operating on Ubuntu 18.04, this tutorial should also work with other Ubuntu-based distributions, such as Linux Mint, Elementary OS, and so on. I have confirmed this on Zorin OS.
Fixed Ubuntu boot freezes caused by NVIDIA drivers
The solution I describe is suitable for systems with NVIDIA graphics cards, because the system freeze problem you are facing is caused by the open source NVIDIA Nouveau driver.
Without further ado, let’s look at how to solve this problem.
Step 1: Edit Grub
While booting the system, stop on the Grub screen as shown below. If you don’t see this screen, hold down the Shift key when starting the computer.
On this screen, press E to enter edit mode.
You should see some code like the one shown below. At this point you should focus on the line that begins with “Linux.”
Step 2: Temporarily modify Linux kernel parameters in Grub
Recall that we had problems with the NVIDIA graphics driver, and it was a misfit of the open source NVIDIA driver that caused our problems. So all we can do here is disable these drivers.
At this point, you have several ways to disable these drives. My favorite way is to disable all video card drivers via Nomodeset.
Please add the following text to the end of the line that begins with “Linux”. You should be able to type normally here. Make sure you add this text to the end of the line.
nomodeset
Copy the code
Your screen should now look something like this:
Press Ctrl+X or F10 to save and exit. Next time you will boot with the modified kernel parameters.
An explanation of the above operations
So what did we do? What the hell is that nomodeset? Let me explain to you briefly.
Typically, graphics cards are enabled after X or some other display server starts executing, after you log in to the system and see the graphical interface.
But recently, the video mode has been moved into the kernel. One of the many advantages of doing this is that you get a nice, hd splash screen.
If you add the nomodeset parameter to the kernel, it instructs the kernel not to load the graphics driver until the display service is started.
In other words, you disable video-driven loading at this point, and the resulting conflict will disappear. When you log in to the system, you can still see everything as before because the graphics driver is loaded later on.
Step 3: Update your system and install NVIDIA proprietary drivers
Don’t get too excited just because you can log in now. What you did was a temporary measure, and the next time you boot up, your system will still try to load the Nouveau driver and freeze.
Does this mean you’ll have to constantly edit the kernel on Grub’s interface? Thankfully, the answer is no.
You can install additional drivers for NVIDIA graphics cards on Ubuntu. With a proprietary driver, Ubuntu will not freeze during startup.
I assume this is your first login to a newly installed system. This means you have to update Ubuntu before you can do anything else. Open a terminal using Ubuntu’s Ctrl+Alt+T system shortcut keys and type the following command:
sudo apt update && sudo apt upgrade -y
Copy the code
After the above commands are executed, you can try installing additional drivers. However, in my experience, you need to reboot your system before installing a new driver. When you reboot, you still need to modify the kernel parameters as we did before.
When your system has been updated and restarted, press the Windows key to open a menu bar and search for “Software & Updates”.
Then switch to the Additional Drivers TAB and wait a few seconds. Then you can see the proprietary drivers available to the system. You should be able to find NVIDIA on this list.
Select the proprietary driver and click Apply Changes.
The installation of the new drive takes some time. If your system has UEFI secure boot enabled, you will be asked to set a password. You can set it to any easy-to-remember password. Its usefulness will be explained in Step 4.
After the installation is complete, you will be asked to restart the system for the previous changes to take effect.
Step 4: Process MOK (only for devices with UEFI enabled for secure boot)
If you were asked to set a secure startup password, you’ll now see a blue screen that says “MOK Management.” It’s a complicated concept, so I’ll try to make it short.
The MOK (device owner password) requirement is due to the requirement that all kernel modules must be signed for secure startup. All kernel modules shipped with the ISO image in Ubuntu have been signed. Because you install a new module (that extra driver), or you make a change to the kernel module, your security system may view it as an unverified external change and refuse to boot.
So you can either sign the system module yourself (to tell the UEFI system not to be surprised that you made the changes), or you can simply disable secure boot.
Now that you know something about safe startup and MOK, let’s take a look at what to do when you come across this blue interface.
If you choose “Continue to boot”, your system will most likely start as usual and you won’t have to do anything. In this case, however, some features of the new driver may not work properly.
That’s why you should “choose to register for MOK”.
It asks you to click “Continue” on the next page and then asks you to enter a password. Enter the password you set when you installed the extra driver in the previous step.
Don’t worry!
If you miss the blue screen for MOK, or accidentally hit “Continue to launch” instead of “Register MOK,” don’t panic. Your main goal is to be able to successfully boot the system, and by disabling the Nouveau graphics driver, you have succeeded in doing just that.
The worst that can happen is that your system will switch to Intel integrated graphics instead of NVIDIA graphics. You can install the NVIDIA graphics driver any time after that. Your first task is to boot up the system.
Step 5: Enjoy Linux with a proprietary NVIDIA driver installed
When the new driver is installed, you need to restart the system again. Don’t worry! The current situation should be fine, and you should be able to boot Ubuntu without having to modify kernel parameters.
I hope this tutorial has helped you solve the problem of Ubuntu freezing up during startup and enabled you to successfully boot Ubuntu.
If you have any questions or suggestions, let me know in the comments section below.
Via: itsfoss.com/fix-ubuntu-…
By Abhishek Prakash (Lujun9972
This article is originally compiled by LCTT and released in Linux China