Nvidia driver installs but does not load on ubuntu 18.04
Solution 1:
Finally it installed! :D
The main cause was the driver installed by cuda toolkit. It never uninstalled properly. So to fix it I performed these operations:
- Uninstall all nvidia related packages and remove all blacklist.
sudo update-initramfs -u
- Reboot
- Went to console mode (Ctrl + Alt + F3), installed Nvidia driver from Nvidia's website (.run file)
sudo update-initramfs -u
- Reboot
- Went to recovery mode,
nvidia-uninstall
# update-initramfs -u
- Reboot
- Installed
nvidia-driver-396
package from graphics-drivers ppa
Everything working fine now
Update: It broke after an update that rebuilt kernel and all dkms modules. Problem is with compiling nvidia-drm module. If anyone has a permanent solution, please post it and I will update accepted answer
Solution 2:
Thanks @sziraqui - I finally have Nvidia drivers installed on Ubuntu 18.04 with your advice along with a few others. Here's what I had to do.
-
Uninstall / purge all Nvidia drivers
sudo apt-get remove --purge nvidia* && sudo apt autoremove
Download Nvidia driver from Nvidia's website (.run file)
Disable / Blacklist Noveau driver https://linuxconfig.org/how-to-disable-nouveau-nvidia-driver-on-ubuntu-18-04-bionic-beaver-linux
Reboot in text mode Entering Grub Boot Parameters - This can be done by going to the grub menu at boot (press Esc or Shit at boot) here press e. Enabling Text Mode Booting - Here add a 3 after quiet splash and press F10 to reboot using the new parameters.
-
Identified gcc used for my kernal and set environment variable CC when running Nvidia installer downloaded in step 2.
sudo CC=gcc-7 ./[Nvidia installer .run file]
The installer is set to tell you the preinstall fails - ignore and keep going. I allowed NVidia to configure X11 and installed the 32-bit libraries. Rebooted and my dual monitors are working as well as back to 1920x1080 resolution.
Seems like the primary culprit is the gcc compiler used with Ubuntu vs. Nvidia drivers was different so the auto-installers would never work. I hope this helps someone else get their Nvidia drivers installed on Ubuntu!
Solution 3:
In my case installing the modules 'linux-modules-nvidia390-XXXXXX' (where XXXXXX is the Kernel version) on Synaptic fixed it.