Linux nvidia driver freeze

Fixing Ubuntu Freezing at Boot Time

This step-by-step tutorial shows you how to deal with Ubuntu freezing at the boot by installing proprietary NVIDIA drivers. The tutorial was performed on a newly installed Ubuntu system but it should be applicable otherwise as well.

The other day I bought an Acer Predator laptop (affiliate link) to test various Linux distribution. It’s a bulky, heavy built laptop which is in contrast to my liking of smaller, lightweight laptops like the awesome Dell XPS.

The reason why I opted for this gaming laptop even though I don’t game on PC is NVIDIA Graphics. Acer Predator Helios 300 comes with NVIDIA Geforce GTX 1050Ti.

NVIDIA is known for its poor compatibility with Linux. A number of It’s FOSS readers asked for my help with their NVIDIA laptops and I could do nothing because I didn’t have a system with NVIDIA graphics card.

So, when I decided to get a new dedicated device for testing Linux distributions, I opted for a laptop with NVIDIA graphics.

This laptop comes with Windows 10 installed on the 120 GB SSD and 1 TB of HDD for storing data. I dual booted Windows 10 with Ubuntu 18.04. The installation was quick, easy and painless.

I booted into Ubuntu. It was showing the familiar purple screen and then I noticed that it froze there. The mouse won’t move, I couldn’t type anything and nothing else could be done except turning off the device by holding the power button.

And it was the same story at the next login try. Ubuntu just gets stuck at the purple screen even before reaching the login screen.

Ubuntu Stuck At Boot

Sounds familiar? Let me show you how you can fix this problem of Ubuntu freezing at login.

Please note that while this tutorial was performed with Ubuntu 18.04, this would also work on other Ubuntu-based distributions such as Linux Mint, elementary OS etc. I have confirmed it with Zorin OS.

Fix Ubuntu freezing at boot time because of graphics drivers

You can watch how to fix this issue in the following video.

Edit Grub Menu to fix Ubuntu freezing at login

You should see some sort of code like the one below. You should focus on the line that starts with Linux.

Editing grub to fix frozen boot issue with Ubuntu Linux

Step 2: Temporarily Modifying Linux kernel parameters in Grub

Remember, our problem is with the NVIDIA Graphics drivers. This incompatibility with open source version of NVIDIA drivers caused the issue so what we can do here is to disable these drivers.

Now, there are several ways you can try to disable these drivers. My favorite way is to disable all video/graphics card using nomodeset.

Читайте также:  Linux show ram info

Just add the following text at the end of the line starting with Linux. You should be able to type normally. Just make sure that you are adding it at the end of the line.

Now your screen should look like this:

Disabling NVIDIA Open Source graphics drivers

Press Ctrl+X or F10 to save and exit. Now you’ll boot with the newly modified kernel parameters here.

So, what did we just do here? What’s that nomodeset thing? Let me explain it to you briefly.

Normally, the video/graphics card were used after the X or any other display server was started. In other words, when you logged in to your system and see graphical user interface.

But lately, the video mode settings were moved to the kernel. Among other benefits, it enables you to have a beautiful, high resolution boot splash screens.

If you add the nomodeset parameter to the kernel, it instructs the kernel to load the video/graphics drivers after the display server is started.

In other words, you disabled loading the graphics driver at this time and the conflict it was causing goes away. After you login to the system and see everything because the graphics card is loaded again.

Troubleshoot: Cannot boot even after using nomodeset?

If using nomodeset in the grub didn’t work and you can still not boot, try some other parameters instead of nomodeset.

Follow the same steps as mentioned above. While editing grub, add nouveau.noaccel=1 in place of nomodeset. Save and exit grub and see if you could boot now.

If even that doesn’t work, try adding noapic noacpi nosplash irqpoll instead of quiet splash in the grub.

Step 3: Make permanent changes in Grub (if you can boot and there is no issue with graphics)

In some cases, not using the graphics driver at all or switching to the open source driver may result in poor looking resolution. If that’s the case with you, try switching to proprietary driver as explained in alternate step 3 (next section).

Don’t be too happy yet just because you are able to login to your system now. What you did was temporary and the next time you boot into your system, your system will still freeze because it will still try to load the graphics drivers.

Does this mean you’ll always have to edit Kernel from the grub screen? Thankfully, the answer is no.

What you can do here to change the grub configuration so that the Linux kernel will not try to load the graphics driver before the display server.

To do that, open the terminal (use Ctrl+Alt+T shortcut) and then use the following command to open the grub configuration file in Gedit editor:

sudo gedit /etc/default/grub 

You’ll have to use your password to open this file. Once you have the text file opened, look for the line that contains: GRUB_CMDLINE_LINUX_DEFAULT=»quiet splash» .

Change this line to: GRUB_CMDLINE_LINUX_DEFAULT=»quiet splash nomodeset»

It should look something like this:

Edit Grub To Fix Ubuntu Boot Freeze

Save the file and update grub so that changes are taken into effect. Use this command:

Once it is complete, reboot your system and it should not freeze anymore.

Читайте также:  Linux настройка двух сетевых интерфейсов

Alternate Step 3: You can boot but graphics look weird? Update your system and install proprietary graphics drivers

If you don’t want to change the Grub config as mentioned in the previous step, alternatively, you can install additional drivers in Ubuntu for NVIDIA and AMD. Ubuntu won’t freeze at boot time while using these proprietary drivers.

In Ubuntu and many other distributions, you have an easy way to install proprietary drivers. Search for “Additional Drivers” in Ubuntu menu. In here, you may find additional graphics drivers for your system.

Install Nvidia Driver in Ubuntu

Click to expand the next section to see the detailed steps to install the additional drivers.

I am assuming that it’s your first login to a freshly installed system. This means you must update Ubuntu before you do anything else. Open a terminal using Ctrl+Alt+T keyboard shortcut in Ubuntu and use the following command:

sudo apt update && sudo apt upgrade -y

You may try installing additional drivers in Ubuntu right after the completion of the above command but in my experience, you’ll have to restart your system before you could successfully install the new drivers. And when you restart, you’ll have to change the kernel parameter again the same way we did earlier.

After your system is updated and restarted, press Windows key to go to the menu and search for Software & Updates.

Search Software & Updates in GNOME Activity

Now go to the Additional Drivers tab and wait for a few seconds. Here you’ll see proprietary drivers available for your system. You should see NVIDIA in the list here.

Select the proprietary driver and click on Apply Changes.

Install Nvidia Driver in Ubuntu

It will take some time in the installation of the new drivers. If you have UEFI secure boot enabled on your system, you’ll be also asked to set a password. You can set it to anything that is easy to remember. I’ll show you its implications later in step 4.

Enable secure boot with Nvidia

Once the installation finishes, you’ll be asked to restart the system to take changes into effect.

Nvidia drivers installed successfully

Dealing with MOK (only for UEFI Secure Boot enabled devices)

If you were asked to setup a secure boot password, you’ll see a blue screen that says something about “MOK management”. It’s a complicated topic and I’ll try to explain it in simpler terms.

MOK (Machine Owner Key) is needed due to the secure boot feature that requires all kernel modules to be signed. Ubuntu does that for all the kernel modules that it ships in the ISO. Because you installed a new module (the additional driver) or made a change in the kernel modules, your secure system may treat it as an unwarranted/foreign change in your system and may refuse to boot.

Hence, you can either sign the kernel module on your own (telling your UEFI system not to panic because you made these changes) or you simply disable the secure boot.

Now that you know a little about secure boot and MOK, let’s see what to do at the next boot when you see the blue screen at the next boot.

If you select “Continue boot”, chances are that your system will boot like normal and you won’t have to do anything at all. But it’s possible that not all features of the new driver work correctly.

Читайте также:  Linux послать udp пакет

This is why, you should choose Enroll MOK.

MOK and UEFI secure boot in Linux

It will ask you to Continue in the next screen followed by asking a password. Use the password you had set while installing the additional drivers in the previous step. You’ll be asked to reboot now.

If you miss this blue screen of MOK or accidentally clicked Continue boot instead of Enroll MOK, don’t panic. Your main aim is to be able to boot into your system and you have successfully done that part by disabling the Nouveau graphics driver.

The worst case would be that your system switched to the integrated Intel graphics instead of the NVIDIA graphics. You can install the NVIDIA graphics drivers later at any point of time. Your priority is to boot into the system.

Once the new driver is installed, you’ll have to restart your system again. Don’t worry! Things should be better now and you won’t need to edit the kernel parameters anymore. You’ll be booting into Ubuntu straightaway.

Step 4: Enjoy Ubuntu Linux

Donate Itsfoss

I hope this tutorial helped you to fix the problem of Ubuntu freezing at the boot time and you were able to boot into your Ubuntu system.

If you have any questions or suggestions, please let me know in the comment section below.

Источник

Can’t set Nvidia as default GPU, Ubuntu freeze on boot after installing Nvidia driver

I am using Ubuntu 22.04 LTS, everything was fine until today I decided to change my NVIDIA driver, I changed it, I do not remember which one I was using.
Then I restarted my laptop and everything was almost ok. I opened the NVIDIA X Server settings and set the PRIME profile to NVIDIA (performance mode). Then I restarted my laptop. It freezes on startup, on the ASUS — Ubuntu screen, I use ctrl + alt + f3 keys and open the terminal, remove the NVIDIA drivers and restart. Now it works with Intel GPU, I installed nvidia-driver-510 and tried again to set my NVIDIA as default GPU, but the problem is still there. I cannot set my NVIDIA as the default GPU. Also, many options in NVIDIA X server settings are gone.
Please help me! What did I do wrong?

My GPU is: nVidia GP108M [GeForce MX250]
And My CPU is: Intel(R) Core(TM) i7-10510U CPU @ 1.80GHz This is lspci -k | grep -EA3 ‘VGA|3D|Display’ command output:

─$ lspci -k | grep -EA3 'VGA|3D|Display' 00:02.0 VGA compatible controller: Intel Corporation CometLake-U GT2 [UHD Graphics] (rev 02) DeviceName: VGA Subsystem: ASUSTeK Computer Inc. CometLake-U GT2 [UHD Graphics] Kernel driver in use: i915 Kernel modules: i915 -- 02:00.0 3D controller: NVIDIA Corporation GP108M [GeForce MX250] (rev a1) DeviceName: Second VGA Subsystem: ASUSTeK Computer Inc. GP108M [GeForce MX250] Kernel modules: nvidiafb, nouveau, nvidia_drm, nvidia 03:00.0 Network controller: Qualcomm Atheros QCA9377 802.11ac Wireless Network Adapter (rev 31) 
update-initramfs: Generating /boot/initrd.img-5.15.0-30-generic I: The initramfs will attempt to resume from /dev/nvme0n1p5 I: (UUID=f56ee4ed-58ac-49d4-a438-3ca75f08397a) I: Set the RESUME variable to override this. 

Источник

Оцените статью
Adblock
detector