disable_nvidia_nouveau

Disabling the NVIDIA Nouveau driver in Ubuntu

sometimes you might want to use the most current nvidia binary driver rather than the nouveau driver package.. or you want no driver at all for whatever reason, so you need to disable the pre-installed nouveau driver..

note all commands below should be executed with root privileges, either prepend sudo or become root first by running sudo su -

edit /etc/modprobe.d/blacklist-framebuffer.conf

make sure these two lines are in there:

blacklist nouveau
blacklist nvidiafb

now uninstall the driver

sudo apt-get --purge remove xserver-xorg-video-nouveau 

also recreate the initrd image as newer ubuntu releases load the nouveau module in there already.

update-initramfs -u

and reboot

after the reboot there should not be any nouveau related modules anymore. try

lsmod | grep nouveau

if it returns an empty result, you where successful :) if not, try adding these parameters in the file /etc/default/grub to the GRUB_CMDLINE_LINUX_DEFAULT parameter:

rdblacklist=nouveau nouveau.modeset=0

after that, you need to recreate the grub config by running

update-grub 

and reboot once more. check again and if you still see nouveau modules, start googling ;)

another problem i have recently encountered with ubuntu 17.04 on a computer booting ubuntu-gnome via uefi was, that after showing the grub menu the screen remained gray (would be purple with ubuntu i guess) and nothing worked, no ctrl+alt+key hotkeys or anything. i added this to the linux cmdline via grub to finally get my computer to boot again:

i915.modeset=0

so far these steps have always worked on all ubuntu systems i had touched since 10.04

if you want to install the nvidia driver instead of the nouveau driver, you can probably save the above steps if you are happy with the “proprietary drivers” provided through ubuntu. however, these drivers might be rather old. if you need newer drivers, you can use a repository which provides them. and if you need to auto-install the latest nvidia driver, you can use a python utility to detect which driver package you need. Here is how this is done:

# install python pip to get pyvidia
apt-get -y install python-pip
pip install --upgrade pip
pip install pyvidia
pip install six
add-apt-repository -y ppa:graphics-drivers/ppa
apt-get -y update
apt-get -y install nvidia-$(pyvidia)

if you have a system that contains both nvidia and non-nvidia graphics adapters (for example an onboard intel GPU), you might need to tell xorg which PCI device to use in combination with the nvidia driver. to do that, run

nvidia-smi

on the target system. it will display a Bus-Id for your card that looks similar to this:

0000:01:00.0

you will need this id for your xorg.conf file. However, the values displayed through nvidia-smi are hex values, for xorg.conf you need decimal numbers. if you don't know how to convert from hex to dec you can just google for “0x31 = ? decimal” and it will show you the decimal conversion as a suggested result :) we are only interested in the 01:00.0 section, you can ignore the 0000: at the begining. now edit your /etc/X11/xorg.conf file and find the Device Section. in this section add a BusID parameter so that the entire section looks something like this:

Section "Device"
    Identifier     "Device0"
    Driver         "nvidia"
    BusID          "PCI:1:0:0"
EndSection

there might be more stuff in there, that's fine, just add the BusID line and keep the rest as is. what's important is, that you add the BusID in the Device section where the Driver is set to “nvidia” :)

now restart your xorg and it should find your card at the given PCI id

in that case you should not need any xorg.conf file, as long as you only connect a screen to your onboard card. BUT, when you install your nvidia drivers, you should make sure that the nvidia glx extensions are not installed, otherwise you won't even have software accelerated glx support which means no more unity desktop and no mor glx applications. in order to do that, you need to pass an additional option to the nvidia installer:

./NVIDIA-Linux-x86_64-375.20.run --no-opengl-files

now your system will still use the standard xorg glx module and hence work with your onboard card.

suppose you can start lightdm and login and all you get after that is an empty desktop background, chances are, that your xorg has now started allright but unity did not. you can right click and launch a terminal and it will have no window decoration and there will be no close button etc. if this is the case, then you need to try several different possible solutions, beause what you are seing can result from many different problems.

i found a good article on askubuntu that describes all these possible solutions. i have copied it here just in case:

This bug depends on several factors, including Video card and custom config files. For example, some users have solved the issue by doing one or several of the following “solutions” (Not all work for everyone, some users even need a combination depending on how the session was configured and hardware used):

  sudo rm -fr ~/.cache/compizconfig-1
  sudo rm -fr ~/.compiz
  sudo rm -fr ~/.Xauthority
  sudo rm -fr ~/.config/autostart
sudo apt-get install --reinstall ubuntu-desktop unity compizconfig-settings-manager upstart
sudo add-apt-repository ppa:xorg-edgers/ppa -y
sudo apt-get update
sudo apt-get install nvidia-340
sudo reboot
dconf reset -f /org/compiz/
setsid unity
sudo rm -fr .cache/*

WARNING - This will clear the cache for all apps inside of the .cache folder.

For most of these cases, if the session opens and you still can not see the top panel or the launcher, try opening a terminal CTRL+ALT+T and typing ccsm (Assuming you already installed the compizconfig-settings-manager package) then enable the OpenGL plugin and the Unity Plugin. If the driver is working well, this should enable both panels in a couple of seconds. There are even some cases where the Unity plugin in the compiz config settings manager is simply not enabled.

  • disable_nvidia_nouveau.txt
  • Last modified: 30.09.2017 07:11
  • by Pascal Suter