Fix a Reboot Issue After Installing Nvidia Drivers on Ubuntu
The Problem
After reinstalling my system, I followed a guide to install the Nvidia Driver. However, when I rebooted, the system got stuck on the logo screen with no spinning circle, instead of going to the login interface, like the following image.
This issue also occurred when I tried booting with Secure Boot enabled(How to Disable Secure Boot). The boot process got stuck at “Stuck in [OK] Started Gnome Manager”.
Solution
Since I hadn’t made any changes besides installing the GPU driver, I suspected a driver conflict. A helpful post confirmed that the new Nvidia Driver might conflict with Gnome. Here’s what I did to fix it:
- Access the Recovery Terminal:
When coming to GRUB when booting, choose the Advanced options for Ubuntu
Choose 2nd line: (recovery mode)
Click on clean, dpkg, network one by one !! (must click network to have network connection). Finally click on root
- On root terminal, remove Driver and Reinstall
gdm
sudo apt-get remove --purge nvidia-*
sudo apt purge gdm gdm3
sudo apt install gdm3 ubuntu-desktop
systemctl restart gdm
Finally, on root terminal, reboot your system by running reboot
. The issue should be resolved !!
Reinstall the NVIDIA GPU Driver (The Right Way)
Step 1: Find the Compatible Driver Version
- Don’t Rely on Official Website: While the Nvidia website offers drivers, they may not be compatible with your specific configuration.
Use Terminal to Find Compatible Version: Open a terminal and run
ubuntu-drivers devices
. This command will display compatible driver versions for your system.- For example, in my case, it list some NVIDIA GPU drivers compatible to the current system. Here I choose
nvidia-driver-535-open
.
linlin@linlin-monarch:~$ ubuntu-drivers devices == /sys/devices/pci0000:00/0000:00:06.0/0000:01:00.0 == modalias : pci:v000010DEd00002520sv00001462sd000012FAbc03sc00i00 vendor : NVIDIA Corporation manual_install: True driver : nvidia-driver-470-server - distro non-free driver : nvidia-driver-535 - distro non-free recommended driver : nvidia-driver-535-server - distro non-free driver : nvidia-driver-535-server-open - distro non-free driver : nvidia-driver-470 - distro non-free driver : nvidia-driver-535-open - distro non-free driver : xserver-xorg-video-nouveau - distro free builtin
- For example, in my case, it list some NVIDIA GPU drivers compatible to the current system. Here I choose
Step 2: Download the Compatible Driver Run File
Use the version information from step 1 to search the driver from the official Nvidia drivers search and download it.
Step 3: Disable Nouveau Driver
- Open a terminal and run
sudo gedit /etc/modprobe.d/blacklist.conf
- Add the following lines to the end of the file and save it:
blacklist nouveau options nouveau modeset=0
- Run the following command to apply the changes:
sudo update-initramfs -u
- Reboot your system.
- Verify that Nouveau is disabled by running
lsmod | grep nouveau
in the terminal.
- No output indicates successful disabling.
- Run the following command to apply the changes:
Step4: Install Nvidia Driver
Assuming the downloaded driver is in your Downloads folder:
cd Downloads
sudo chmod a+x ./<driver_file_name>.run # Replace `<driver_file_name>` with the actual file name
sudo ./<driver_file_name>.run
During installation, answer the following prompts:
- Prompt 1: Choose to install everything except the driver and kernel.
- Prompt 2: The distribution-provided pre-install script failed! Are you sure you want to continue? Yes.
- Prompt 3: Would you like to register the kernel module souces with DKMS? This will allow DKMS to automatically build a new module, if you install a different kernel later? No.
- Prompt 4: I forgot the questions, but the answer would be Install without Signing
- Prompt 5: Nvidia’s 32-bit compatibility libraries? No.
- Prompt 6: Would you like to run the nvidia-xconfigutility to automatically update your x configuration so that the NVIDIA x driver will be used when you restart x? Any pre-existing x confile will be backed up. Yes
Further
- Keep the downloaded .run file in a safe location. If you encounter reboot issues again, you can run the file with the
sudo ./<run file>--uninstall
option to remove the driver.
Additional Notes
- Avoid using sudo apt install or the Software & Updates GUI to install Nvidia drivers.
Hope this revised blog post provides a clear and comprehensive guide to fixing reboot issues after installing Nvidia drivers on Ubuntu!