Install Nvidia proprietary drivers in LinuxMint UPDATED 2014

Screen resolution, 3D Acceleration, nVidia, ATI
Forum rules
Before you post please read this
User avatar
roblm
Level 13
Level 13
Posts: 4541
Joined: Sun Feb 24, 2013 2:41 pm

Re: Install Nvidia proprietary drivers in LinuxMint UPDATED

Post by roblm »

In my first post in this topic, I stated how I've been unable to install Nvidia drivers downloaded from the Nvidia website in Mint 16.
I checked that site recently to see if newer drivers were available for my video card, which is a GeForce 210. The 331.67 driver
was available, which supports video cards in the GeForce 8 series and newer. This driver would not install at first but after some
more investigation and testing I was able to get it installed. I first had to open the Synaptic Package Manager and install the
package → libc6-dev. This also installs the package → libc-dev-bin. Both were needed. These packages are both already installed in Mint 14 and 15 Cinnamon, but not in Mint 16. During the installation there was a different message with this driver. It stated that the nvidia-installer would also install the libvdpau and libvdpau_trace libraries.

nvidia install-2.jpg

Libvdpau1 is already installed in Mint 14 but not in 15 or 16. It contains those two packages. So I uninstalled the Nvidia driver and
and installed the packages libvdpau1 and libvdpau-dev in Synaptic and then tried to reinstall the 331.67 driver and older Nvidia
drivers, the 319.17 and 325.15, but they would not install. Evidently the libvdpau package that comes with the Nvidia 331.67 driver is not exactly the same as the package in Synaptic, or there's some other reason. I couldn't find any newer versions either.

EDITED: The following instructions has a step that is not needed in Mint 16 and 17. Go down to the
UPDATED INSTALLATION INSTRUCTIONS below.

I didn't use the method of installation suggested in this topic, but used the method I've always used in Mint 14 and 15. The nouveau driver has to be disabled first so it doesn't load in the initial ramdisk image that is created early during startup and later in the kernel. I manually disable that driver by creating a file named “disable-nouveau.conf” by opening the Terminal and typing:
gksudo gedit /etc/modprobe.d/disable-nouveau.conf

Then add these two lines to the opened file:
blacklist nouveau
options nouveau modeset=0

Save the file. To disable nouveau in the ramdisk, open the Terminal and type:
gksudo gedit /etc/default/grub

Look for the line: GRUB_CMDLINE_LINUX_DEFAULT="quiet splash"
Change it to : GRUB_CMDLINE_LINUX_DEFAULT="quiet splash rdblacklist=nouveau"

Some use this command: GRUB_CMDLINE_LINUX_DEFAULT="quiet splash nouveau.blacklist=1"

The first step in disabling nouveau can be done automatically by the nvidia-installer but the second cannot. Save the file and open the Terminal and type these two commands:
sudo update-grub
sudo update-initramfs -u

Move the downloaded Nvidia driver to your "/home/user-name" directory. Rename the file "N.run" so you don't have to type that long name later. Reboot and then enter the virtual terminal tty1 by pressing Ctrl+Alt+F1. Then type these commands:
sudo service mdm stop
sudo sh N.run
Answer "yes" at all the screens. After installation type: sudo service mdm start

Grokling,
If you have hybrid graphics, with an integrated intel graphics and a separate Nvidia graphics card, then you can't use the method of
installation in this topic. You need to install Bumblebee first.
http://forums.linuxmint.com/viewtopic.php?f=49&t=135283


UPDATED INSTALLATION INSTRUCTIONS: 4-20-14

Download the Nvidia driver and move it to your “/home/user-name” directory. For example, we will use the driver package
NVIDIA-Linux-x86-331.67.run. Rename it “N-331.67.run”, so you don't have to type that long name later.

Install the package “libc6-dev” by using this command in the Terminal:

Code: Select all

sudo apt-get install libc6-dev

Then use this command to create a file named “disable-nouveau.conf”:

Code: Select all

gksudo gedit /etc/modprobe.d/disable-nouveau.conf
For Mint 18.xx, use the command: gksudo xed /etc/modprobe.d/disable-nouveau.conf

For Mint 19.xx, use this command to create the file: sudo touch /etc/modprobe.d/disable-nouveau.conf
Then use this command to open the file for editing: xed admin:////etc/modprobe.d/disable-nouveau.conf

Add these two lines to the opened file:

Code: Select all

blacklist nouveau
options nouveau modeset=0
Save the file. Use this command to update the initial ramdisk and reboot:

Code: Select all

sudo update-initramfs -u; reboot
Enter the virtual console tty1 by pressing Ctrl+Alt+F1. Log in and use this command to stop the display manager:

Code: Select all

sudo service mdm stop
For Mint 18.2, 18.3 and 19.xx, use this command: sudo service lightdm stop

Sometimes you may now see a different screen. Just press Ctrl+Alt+F1 again.
Then use this command to start the installation:

Code: Select all

sudo sh N-331.67.run
Ignore the message about the "pre-install script failed!" Always choose “yes” during the installation, and when it's finished, use this command:

Code: Select all

sudo service mdm start
For Mint 18.2, 18.3 and 19.xx, use this command: sudo service lightdm start

If you have a laptop or notebook with Optimus Technology, which has hybrid graphics (Integrated Intel and separate Nvidia card), then your distro's package manager should be used to install the Nvidia driver, so that OpenGL is configured correctly.

EDITED: I recently added this section at the bottom of this post:
How to install the Nvidia driver on an Optimus laptop (integrated Intel + Nvidia card) - Added Dec. 2018


UNINSTALL THE NVIDIA DRIVER:

If there is a reason you need to uninstall the Nvidia driver and restore the nouveau driver, then do these steps, using the driver
installed above as an example. Enter the virtual console tty1 by pressing Ctrl+Alt+F1. Log in and use this command:

Code: Select all

sudo sh N-331.67.run --uninstall
After the uninstall process is finished, remove the "disable-nouveau.conf" file by using this command:

Code: Select all

sudo rm /etc/modprobe.d/disable-nouveau.conf
Then use this command:

Code: Select all

sudo update-initramfs -u
Then use this command to restore the nouveau driver and reboot:

Code: Select all

sudo apt-get install --reinstall xserver-xorg-video-nouveau libdrm-nouveau2; reboot

Update for Mint 19:

An alternate way to uninstall the driver is to open the Terminal and use this command to remove the disable-nouveau.conf file:
sudo rm /etc/modprobe.d/disable-nouveau.conf

Update the initial ramdisk: sudo update-initramfs -u

Then remove the Nvidia driver and reboot: sudo nvidia-installer --uninstall

If you get a black screen, then press and hold the Alt key and then press, one at a time, the keys SysRq, R, E, I, S, U, B.


UPDATING NVIDIA DRIVERS:

In the future, if there is a newer driver available from Nvidia's website, then installation of it is very easy. I tested this with the
Nvidia 334.21 driver in the package “NVIDIA-Linux-x86_64-334.21.run”. Download the driver and move it to your “/home/user-name” directory and rename it “N-334.21.run”. Enter the virtual console tty1, log in and use this command:

Code: Select all

sudo service mdm stop
Then use this command:

Code: Select all

sudo sh N-334.21.run
After the installation, use this command:

Code: Select all

sudo service mdm start

NVIDIA DRIVER ALREADY INSTALLED:

If you have already installed an Nvidia driver using Driver Manager, the Synaptic Package Manager, or apt in the Terminal,
then it should be removed before attempting to install the downloaded Nvidia driver. Open Driver Manager and select →
xserver-xorg-video-nouveau. Also the package libc6-dev will have already been installed.

Click → Apply Changes. Reboot and follow the installation steps above.


Mint 17 Update for restoring the nouveau driver. Use this command:

Code: Select all

sudo apt install --reinstall xserver-xorg-video-nouveau-lts-vivid libdrm-nouveau2 libdrm-nouveau2:i386

Mint 18 & 18.1 Update for restoring the nouveau driver. Use this command:

Code: Select all

sudo apt install --reinstall xserver-xorg-video-nouveau libdrm-nouveau2

Mint 18.2 Cinnamon, MATE and Xfce Update:

The display manager has been changed from MDM to LightDM. These two commands will no longer work to stop and start the display manager:

Code: Select all

sudo service mdm stop
sudo service mdm start
These are the new commands:

Code: Select all

sudo service lightdm stop
sudo service lightdm start
Mint 18.2 has simplified the installation or removal of the Nvidia driver.
The package libc6-dev does not have to be installed for the Nvidia driver installation.
No packages need to be installed to restore the nouveau driver.

If you have a laptop or notebook with Optimus Technology, which has hybrid graphics (Integrated Intel and separate Nvidia card), then your distro's package manager should be used to install the Nvidia driver, so that OpenGL is configured correctly.

EDITED: I recently added this section at the bottom of this post:
How to install the Nvidia driver on an Optimus laptop (integrated Intel + Nvidia card) - Added Dec. 2018


Mint 18.3 Cinnamon Update:

Works the same as version 18.2

EDITED: This was true for the nvidia 384.111 driver, used for newer video cards. However, this was not true for the nvidia 340.106 driver, used for older video cards. The package libc6-dev still had to be installed, and this command was required to reinstall the nouveau driver:

Code: Select all

sudo apt install --reinstall xserver-xorg-video-nouveau libdrm-nouveau2

Mint 19 Nvidia Driver Installation Update:

You will need to decide if the 32-bit compatibility libraries are needed, to run Steam and other 32 bit programs or those running in Wine. If you need them, then the --compat32-libdir option needs to be added to the installation .run file; for example:
sudo sh Nvidia-390.87.run --compat32-libdir=lib32

The libraries will be installed in /usr/lib32. If you use that option, then this message will be seen:
Install NVIDIA'S 32-bit compatibility libraries?
If you don't use that option, then this message will be seen:
“WARNING: Unable to find a suitable destination to install 32-bit compatibility libraries. Your system may not be set up for 32-bit compatibility. 32-bit compatibility files will not be installed; if you wish to install them, re-run the installation and set a valid directory with the --compat32-libdir option.”
If the initial Nvidia driver installation is done using the distro's package manager and then that driver is uninstalled, and then you begin installing a driver downloaded from Nvidia's website, then you will not need to add the --compat32-libdir option.

Then this message will be seen for newer drivers that use the libglvnd libraries:
“An incomplete installation of libglvnd was found. Do you want to install a full copy of libglvnd?
This will overwrite any existing libglvnd libraries.”

Code: Select all

The choices are: 	Don’t install    	Install and overwrite     	Abort installation
Select “Install and overwrite”. There are actually no libglvnd files installed on your system, so nothing will be overwritten.


Mint 20 Nvidia Driver Installation Update:

Remove any Nvidia driver that is already installed from using the distro's package manager. In Mint 20, as in previous versions, Driver Manager cannot remove an installed Nvidia driver completely. Also the command apt purge nvidia* will not work as it did in previous versions. Use the command sudo apt-get purge *nvidia*, or apt remove nvidia-driver-450 (substitute 450 for the correct driver version) and then apt autoremove. Reboot.

Download the Nvidia driver and move it to your Home directory (/home/your-user-name).

Rename the NVIDIA-Linux-x86-450.57.run package to N-450.57.run, so you don't have to type that long name later.

Use this command to create a disable-nouveau.conf file:
sudo touch /etc/modprobe.d/disable-nouveau.conf

Open the file for editing: xed admin:///etc/modprobe.d/disable-nouveau.conf

Add this line: blacklist nouveau

Update the initial ramdisk and reboot: sudo update-initramfs -u; reboot

Press Ctrl+Alt+F1 to enter tty1. If that doesn't work, then press Ctrl+Alt+F2 to enter tty2.
Stop the display manager: sudo service lightdm stop
Sometimes you may now see a different screen. If that happens, just press Ctrl+Alt+F1 again.

Use one of these two commands to install the Nvidia driver: sudo sh N-450.57.run

Or if you also want to install the 32-bit libraries to run Steam and other 32-bit programs:
sudo sh N-450.57.run --compat32-libdir=lib32

Select Continue installation at this screen:
An alternate method of installing the Nvidia driver was detected...(for Nvidia-450.57 driver)

The distribution-provided pre-install script failed! (for Nvidia-440 and older drivers)
Select Yes at this screen:
Would you like to register the kernel module sources with DKMS?
Click OK at the next 2 screens (for Nvidia-450 driver - if you are installing 32 bit libraries, then select Yes for the first screen)

For Nvidia-440 and older drivers, select Install and overwrite at this screen:
An incomplete installation of libglvnd was found…..Do you want to install a full copy of libglvnd? This will overwrite any existing libglvnd libraries.
Select No at this screen:
Would you like to run the nvidia-xconfig utility to automatically update your X configuration file…..
After the installation, restart the display manager: sudo service lightdm start


To uninstall the driver, use this command in the Terminal to remove the file disable-nouveau.conf:
sudo rm /etc/modprobe.d/disable-nouveau.conf

Update the initial ramdisk: sudo update-initramfs -u

Uninstall the driver: sudo nvidia-installer --uninstall

At this next screen, select NO:
If you plan to no longer use the NVIDIA driver, you should make sure that no X screens are configured to use the NVIDIA X driver in your configuration file…..
If you get a black screen, press and hold the Alt key and then press the letters SysRq (Print Screen) r, e, i, s, u, b.

Reboot.


Additional info for special installations:
If you select No at the screen Would you like to register the kernel module sources with DKMS?, then this message is seen:
ERROR: You do not appear to have libc header files installed on your system. Please install your distribution's libc development packages.

Use this command to install libc6-dev: apt install libc6-dev


Installation of the NVIDIA driver with SECURE BOOT enabled - Sept 2018:

Many distributions require modules to be signed with a trusted key when loaded into kernels running on UEFI systems with Secure Boot enabled. The nvidia-installer that comes with the Nvidia driver downloaded from Nvidia’s website can generate keys during the driver installation that can be used for module signing. The nvidia-installer will present a series of interactive screens to guide users through the module signing process.

This is discussed in the NVIDIA Installation Guide, under the section Signing the NVIDIA Kernel Module, at this link: http://us.download.nvidia.com/XFree86/L ... ulesigning

At the screen with this message, answer NO:
Would you like to register the kernel module sources with DKMS. This will allow DKMS to automatically build a new module, if you install a different kernel later.
If you answer YES, then the installation will fail with this message:
Error: Unable to load the ‘nvidia-drm’ kernel module.

The next screen message:
The target kernel has CONFIG_MODULE-SIG set, which means that it supports cryptographic signatures on kernel modules. On some systems, the kernel may refuse to load modules without a valid signature from a trusted key. This system also has UEFI Secure Boot enabled; many distributions enforce module signature verification on UEFI systems when Secure Boot is enabled. Would you like to sign the NVIDIA kernel module?
Answer: Sign the kernel module.

The next screen message:
Would you like to sign the NVIDIA kernel module with an existing key pair, or would you like to generate a new one?
Answer: Generate a new key pair.

The next screen message:
The NVIDIA kernel module was successfully signed with a newly generated key pair. Would you like to delete the private signing key?
Answer: YES.

The next screen message:
An X.509 certificate containing the public signing key will be installed to /usr/share/nvidia/nvidia-modsign-crt-XXXXXXXX.der The SHA1 fingerprint of this certificate is, for example:
8B :06 :FA :E6 :06 :07 :F4 :CA : 82 :1A :12 :04 :7C :36 :15 :CC :09 :53 :C8 :B6

This certificate must be added to a key database which is trusted by your kernel in order for the kernel to be able to verify the module signature.
Next message:
The signed kernel module failed to load, because the kernel does not trust any key which is capable of verifying the module signature. Would you like to install the signed kernel module anyway?

Note that you will not be able to load the installed module until after a key that can verify the module signature is added to a key database that is trusted by the kernel. This will likely require rebooting your computer.
Answer: Install signed kernel module.


After the installation, the desktop will be in Fallback mode. Open the file manager and go to /usr/share. Right click on the folder nvidia and select Open as Root. Copy the nvidia-modsign-crt-XXXXXXXX.der file name, by right clicking on it, selecting Properties and copying the Name.

Right click in the empty space and select Open in Terminal. Use this command to enroll the Public signing key into the Shim bootloader: mokutil --import nvidia-modsign-crt-XXXXXXXX.der

You will be asked to input a password twice. I used my user password, which is only 6 letters. This password will be used later.

Reboot. The Shim UEFI key management screen appears. Press any key.
The Perform MOK management screen appears, with this menu:

Continue boot
Enroll MOK
Enroll key from disk
Enroll hash from disk


MOK screen2.JPG

Select Enroll MOK. At the next screen, select Continue.

The next screen asks: Enroll the key (s)? Answer YES. Type the password you previously typed. Your system will reboot.

If you update the driver or the kernel, then the previous steps will need to be repeated.


How to install the Nvidia driver with Secure Boot enabled; for drivers installed using Driver Manager, apt or Synaptic:

Open the Terminal and use this command to generate a new Private signing key (MOK.priv) and an X.509 certificate (MOK.der), which contains the Public signing key, which are used for signing the Nvidia kernel module(s). They will be added to Home and stored in the MOK (Machine Owner Key) database.

Code: Select all

openssl req -new -x509 -newkey rsa:2048 -days 7300 -nodes -subj "/CN=nvidia module signing key/" -keyout MOK.priv -outform DER -out MOK.der -sha512
If you desire, the certificate name (commonName) after CN= can be changed.

Use this command to list the installed Nvidia kernel modules: ls /lib/modules/`uname -r`/kernel/drivers/char/drm

In this example there are 4 modules, but older drivers will have less:
nvidia.ko nvidia-drm.ko nvidia-modeset.ko nvidia-uvm.ko

Use these commands to sign the 4 kernel modules:

Code: Select all

sudo /lib/modules/`uname -r`/build/scripts/sign-file sha512 MOK.priv MOK.der /lib/modules/`uname -r`/kernel/drivers/char/drm/nvidia.ko
sudo /lib/modules/`uname -r`/build/scripts/sign-file sha512 MOK.priv MOK.der /lib/modules/`uname -r`/kernel/drivers/char/drm/nvidia-drm.ko
sudo /lib/modules/`uname -r`/build/scripts/sign-file sha512 MOK.priv MOK.der /lib/modules/`uname -r`/kernel/drivers/char/drm/nvidia-modeset.ko
sudo /lib/modules/`uname -r`/build/scripts/sign-file sha512 MOK.priv MOK.der /lib/modules/`uname -r`/kernel/drivers/char/drm/nvidia-uvm.ko

Use this command to enroll the Public signing key into the Shim bootloader: sudo mokutil --import MOK.der

You will be asked to type a password twice. I used my user password, which is only 6 letters. This password will be used later.

Reboot. The blue Shim UEFI key management screen appears. Press any key.
The Perform MOK management screen appears, with this menu:

Continue boot
Enroll MOK
Enroll key from disk
Enroll hash from disk


Select Enroll MOK. At the next screen, select Continue.
The next screen asks: Enroll the key (s)? Answer YES. Type the password you previously used. Your system will reboot.

If you desire, you can use this command to verify if the kernel module is signed. The output should include the string
~Module signature appended~’:

hexdump -Cv /lib/modules/`uname -r`/kernel/drivers/char/drm/nvidia.ko | tail -n 5

Code: Select all

hexdump -Cv nvidia.ko | tail -n 5
00000180  8d c6 e3 43 1c 63 a1 9d  26 fe 46 77 60 4a ea 00  |...C.c..&.Fw`J..|
00000190  00 02 00 00 00 00 00 00  00 01 8f 7e 4d 6f 64 75  |...........~Modu|
000001a0  6c 65 20 73 69 67 6e 61  74 75 72 65 20 61 70 70  |le signature app|
000001b0  65 6e 64 65 64 7e 0a                              |ended~.|
000001b7

If you update the driver or kernel, then the previous steps will need to be repeated. You may want to change the certificate name used in the openssl command. For example, use the name nvidia-390.77-key. After the MOK.priv and MOK.der keys are generated, they can be renamed to MOK-nvidia-390.77.priv and MOK-nvidia-390.77.der. After the keys are enrolled, they can be moved to a new MOK-keys folder.

If you update the kernel, the certificate name can be, for example, 4.15.0-36-kernel-nvidia-390.77-key


How to install the Nvidia driver on an Optimus laptop (integrated Intel + Nvidia card) - Added Dec. 2018

This info is especially useful if you need to use an older more compatible driver that is no longer available through the distro's package manager but can still be downloaded from Nvidia's website.

This testing was done in Mint 19 Cinnamon using the Nvidia 390.87 driver downloaded from Nvidia's website.

This method does not work in Mint.18xx

Use this command to install nvidia-prime and libc6-dev: apt install nvidia-prime libc6-dev
If you have previously installed and removed a Nvidia driver using the distro's package manager, then libc6-dev does not need to be installed. Use the command: apt install nvidia-prime

Remove any Nvidia driver that is already installed from using the distro's package manager and then reboot:
apt remove nvidia-driver-390.87 --autoremove (use the correct version)

Download the Nvidia driver and move it to your Home directory (/home/your-user-name). For example, we will use the driver package NVIDIA-Linux-x86-390.87.run. I suggest renaming it “N-390.87.run”, so you don't have to type that long name later.

Use this command to create a disable-nouveau.conf file: sudo touch /etc/modprobe.d/disable-nouveau.conf

Use this command to open the file for editing: xed admin:///etc/modprobe.d/disable-nouveau.conf
Add these lines:

Code: Select all

blacklist nouveau
options nouveau modeset=0
Update the initial ramdisk and reboot: sudo update initramfs -u; reboot


Instructions for the Nvidia 390.87, 390.129, and 390.132 drivers. Instructions for other drivers are in sections below.

Use these commands to copy libglx.so and libglamoregl.so to the /opt folder (which is usually empty), because they will be removed by the nvidia-installer:

Code: Select all

sudo cp /usr/lib/xorg/modules/libglamoregl.so /opt
sudo cp /usr/lib/xorg/modules/extensions/libglx.so /opt
Use this command to rename libglx.so to libglx.so.old
sudo mv /opt/libglx.so /opt/libglx.so.old

Press Ctrl+Alt+F1 to enter tty1. Stop the display manager: sudo service lightdm stop
Install the Nvidia driver: sudo sh N-390.87.run

If you also want to install the 32 bit libraries: sudo sh N-390.87.run --compat32-libdir=lib32

This message will be seen:
“An incomplete installation of libglvnd was found. Do you want to install a full copy of libglvnd?
This will overwrite any existing libglvnd libraries.”
Select “Install and overwrite”.

After the installation, restart the display manager: sudo service lightdm start

Use these commands to copy libglamoregl.so to /usr/lib/xorg/modules and libglx.so.old to /usr/lib/xorg/modules/extensions

Code: Select all

sudo cp /opt/libglamoregl.so /usr/lib/xorg/modules
sudo cp /opt/libglx.so.old /usr/lib/xorg/modules/extensions
Create a desktop script to switch GPUs. Right click on the desktop and select Create New Document > Empty Document. The name can be “Switch GPU”. Open the file and add these lines:

Code: Select all

#!/bin/sh

if [ $(prime-select query) = "intel" ]; then
    sudo mv /usr/lib/xorg/modules/extensions/libglx.so /usr/lib/xorg/modules/extensions/libglx.so.old
    sudo ln -s /usr/lib/xorg/modules/extensions/libglx.so.390.87 /usr/lib/xorg/modules/extensions/libglx.so
    sudo prime-select nvidia; reboot

elif [ $(prime-select query) = "nvidia" ]; then
    sudo rm /usr/lib/xorg/modules/extensions/libglx.so                      
    sudo mv /usr/lib/xorg/modules/extensions/libglx.so.old /usr/lib/xorg/modules/extensions/libglx.so
    sudo prime-select intel; reboot
fi 
For a newer driver, simply change the version number in line 5 of the script.

Click “Save” and close the file. Right click on it and select Properties > Permissions. Mark the checkbox next to “Allow executing file as program”. When you click on the desktop script, choose the option “Run in Terminal”.

I created a custom icon for this situation, if you want to use it, download it from here:
https://imgur.com/sb0LSOy

Switch  GPU.png
Switch GPU.png (1.97 KiB) Viewed 5986 times

The desktop script must be used to switch GPUs. After you click on it and type your password, the GPU that is currently selected will be switched, followed by a reboot. No PRIME Profiles page will be added in the Nvidia Settings utility but the nvidia-prime applet's icon shows the correct GPU being used. If the icon is clicked, this message will be seen: You do not appear to be using the NVIDIA X driver. Don't follow the instructions.


Instructions for the Nvidia 410.78, 415.18, 415.22, 410.93, 418.113, 430.40, 430.50, and 430.64 drivers:

The driver installation will remove libglamoregl.so, so it needs to be copied to another location such as the /opt folder:
sudo cp /usr/lib/xorg/modules/libglamoregl.so /opt

Press Ctrl+Alt+F1 to enter tty1. Stop the display manager: sudo service lightdm stop
Install the Nvidia driver: sudo sh N-410.78.run (the driver version may be different)

If you also want to install the 32 bit libraries: sudo sh N-390.87.run --compat32-libdir=lib32

This message will be seen:
“An incomplete installation of libglvnd was found. Do you want to install a full copy of libglvnd?
This will overwrite any existing libglvnd libraries.”
Select “Install and overwrite”.

After the installation, restart the display manager: sudo service lightdm start

Copy libglamoregl.so back to /usr/lib/xorg/modules:
sudo cp /opt/libglamoregl.so /usr/lib/xorg/modules

The GPUs can't be switched using Nvidia Settings because there is no PRIME Profiles page. Use the commands
sudo prime-select intel and sudo prime-select nvidia

For faster switching, create a desktop script with these lines:

Code: Select all

#!/bin/sh

if [ $(prime-select query) = "intel" ]; then
    sudo prime-select nvidia; reboot

elif [ $(prime-select query) = "nvidia" ]; then
    sudo prime-select intel; reboot
fi 
I created a custom icon for this situation, if you want to use it, download it from here:
https://imgur.com/sb0LSOy


Instructions for the Nvidia 435.21, 440.31, 440.36, and 440.44 drivers:
No files are removed by the installation.

Press Ctrl+Alt+F1 to enter tty1. Stop the display manager: sudo service lightdm stop
Install the Nvidia driver: sudo sh N-435.21.run (the driver version may be different)

If you also want to install the 32 bit libraries: sudo sh N-390.87.run --compat32-libdir=lib32

This message will be seen:
“An incomplete installation of libglvnd was found. Do you want to install a full copy of libglvnd?
This will overwrite any existing libglvnd libraries.”
Select “Install and overwrite”.

After the installation, restart the display manager: sudo service lightdm start

The GPUs can't be switched using Nvidia Settings because there is no PRIME Profiles page. Use the commands
sudo prime-select intel and sudo prime-select nvidia

For faster switching, create a desktop script with these lines:

Code: Select all

#!/bin/sh

if [ $(prime-select query) = "intel" ]; then
    sudo prime-select nvidia; reboot

elif [ $(prime-select query) = "nvidia" ]; then
    sudo prime-select intel; reboot
fi 
I created a custom icon for this situation, if you want to use it, download it from here:
https://imgur.com/sb0LSOy


Uninstalling the Nvidia driver:

Nvidia 390 drivers:
Use the desktop script to switch to the Intel GPU.
In the Terminal, use this command: sudo nvidia-installer --uninstall. Ignore any error message. If you get a black screen, press and hold the Alt key and then press the keys SysRq (Print Screen), R, E, I, S, U, B

All other newer drivers:
In the Terminal, use this command: sudo nvidia-installer --uninstall. Ignore any error message. If you get a black screen, press and hold the Alt key and then press the keys SysRq (Print Screen), R, E, I, S, U, B


Reinstalling the same or newer Nvidia driver:

Use this command in the Terminal to switch to the Nvidia GPU: sudo prime-select nvidia, but don't reboot.
Install the Nvidia driver using the correct instruction section.


Please do not add a new post to this topic. Since the topic is old, a forum moderator would then probably lock it. Then I would be unable to add any more updates. If you have a question, then contact me with a Private Message.
Last edited by roblm on Wed Aug 19, 2020 7:28 pm, edited 65 times in total.
ridobe
Level 1
Level 1
Posts: 18
Joined: Fri May 31, 2013 7:09 pm

Post by ridobe »

@roblm - This is very good information. Thanks for posting.

Sent from my Nexus 5 using Tapatalk
AndrewXP
Level 1
Level 1
Posts: 26
Joined: Tue Mar 18, 2014 8:57 am

Re: Install Nvidia proprietary drivers in LinuxMint UPDATED

Post by AndrewXP »

kk5000 wrote:DISCLAIMER B. This is for current Nvidia graphics card support only, this will not work for legacy cards. If you have a legacy card use the "Addition Drivers" tool included in LinuxMint.
I have a GeForce4 MX 420, which NVIDIA regard as a "legacy" card. However, there is an x86 download provided for it, called "NVIDIA-Linux-x86-96.43.23-pkg1.run". Can I not expect this to install OK? Admittedly, I am having problems disabling Nouveau at the moment, without which the install won't work. I'm trying to get the computer to boot straight into a bash shell as a possible workaround, but this isn't straightforward either (see this topic: http://forums.linuxmint.com/viewtopic.p ... 81#p847781 - note that since I started that topic I've found the more specific NVIDIA download mentioned earlier in this paragraph).

Where is the "Addition Drivers" tool? I'm using Mint 16 Xfce 32-bit (new installation).
Mint 13 Xfce 32-bit
jooke
Level 1
Level 1
Posts: 4
Joined: Tue Apr 15, 2014 4:02 am

Re: Install Nvidia proprietary drivers in LinuxMint UPDATED

Post by jooke »

But what can I do if I have nvidia drivers "96". Because of as of today, the latest "96" driver only supports X.org 1.9.
AndrewXP
Level 1
Level 1
Posts: 26
Joined: Tue Mar 18, 2014 8:57 am

Re: Install Nvidia proprietary drivers in LinuxMint UPDATED

Post by AndrewXP »

AndrewXP wrote:
kk5000 wrote:DISCLAIMER B. This is for current Nvidia graphics card support only, this will not work for legacy cards. If you have a legacy card use the "Addition Drivers" tool included in LinuxMint.
I have a GeForce4 MX 420, which NVIDIA regard as a "legacy" card. However, there is an x86 download provided for it, called "NVIDIA-Linux-x86-96.43.23-pkg1.run". Can I not expect this to install OK? Admittedly, I am having problems disabling Nouveau at the moment, without which the install won't work. I'm trying to get the computer to boot straight into a bash shell as a possible workaround, but this isn't straightforward either (see this topic: http://forums.linuxmint.com/viewtopic.p ... 81#p847781 - note that since I started that topic I've found the more specific NVIDIA download mentioned earlier in this paragraph).

Where is the "Addition Drivers" tool? I'm using Mint 16 Xfce 32-bit (new installation).
Further to my previous post, I've now managed to disable Nouveau. Next time I tried the NVIDIA install I got a message about libc headers missing, so I fixed that. Now I get this error from the NVIDIA install:

ERROR: The kernel header file
'/lib/modules/3.11.0-12-generic/build/include/linux/version.h' does not
exist. The most likely reason for this is that the kernel source files
in '/lib/modules/3.11.0-12-generic/build' have not been configured.


Now I'm well and truly stumped. At least the bog standard 1024X768 display I'm left with is an improvement on Nouveau...
Mint 13 Xfce 32-bit
jooke
Level 1
Level 1
Posts: 4
Joined: Tue Apr 15, 2014 4:02 am

Re: Install Nvidia proprietary drivers in LinuxMint UPDATED

Post by jooke »

That is the same problem which I have. You can't build it when you have xorg version > 1.9.
AndrewXP
Level 1
Level 1
Posts: 26
Joined: Tue Mar 18, 2014 8:57 am

Re: Install Nvidia proprietary drivers in LinuxMint UPDATED

Post by AndrewXP »

jooke wrote:That is the same problem which I have. You can't build it when you have xorg version > 1.9.
How do I tell which version of xorg I have? I'm beginning to wonder whether I might be better off replacing Mint 16 with Mint 13 (supported until April 2017). Comments, anyone?
Mint 13 Xfce 32-bit
User avatar
roblm
Level 13
Level 13
Posts: 4541
Joined: Sun Feb 24, 2013 2:41 pm

Re: Install Nvidia proprietary drivers in LinuxMint UPDATED

Post by roblm »

AndrewXP wrote:How do I tell which version of xorg I have? I'm beginning to wonder whether I might be better off replacing Mint 16 with Mint 13.
Open the Terminal and type this command to open the “Xorg.0.log” file:
gedit /var/log/Xorg.0.log

Look at the second line, which looks like this: X.Org X Server 1.11.3
This is the version for Xfce 13. Xfce 16 has version 1.14.3.

One of my older computers also has the GeForce4 MX 420, with an Athlon XP 2500 CPU. I didn't expect any success in
installing the Nvidia-96 driver from Nvidia's website with Xfce 16 but I did some testing anyway. I got the same result you got.
Same result with Xfce 15. With Xfce 14 and 13, the installation stopped part way into the process. I gave up after many attempts,
trying every option I could think of.

I have another old computer that has an even older GeForce2 MX 200 and an Intel Pentium 4 CPU. On this system I could install
both Xfce 13 and 14. The Nvidia-96 driver installation went smoothly and appeared to be successful on both. After rebooting the
Xfce 14 installation, the Nvidia driver was not enabled, even though it appeared to be by looking at the “xorg.conf” file. On the
Xfce 13 installation, after rebooting I got a black screen. Testing several kernel boot parameters failed.

These results really surprised me. On Nvidia's Driver Downloads screen for this driver, after selecting “Release Highlights”, the
information says: Added support for X.Org xserver versions 1.11 and 1.12.
Maybe you will have more success with your system.
User avatar
roblm
Level 13
Level 13
Posts: 4541
Joined: Sun Feb 24, 2013 2:41 pm

Re: Install Nvidia proprietary drivers in LinuxMint UPDATED

Post by roblm »

AndrewXP,

Here is an update of my last post. I removed the GeForce 4 MX 420 video card from the computer with the Athlon XP 2500 CPU,
which would not install Xfce 13, and swapped it with the GeForce2 MX 200 video card on the computer with the Intel Pentium 4 CPU,
which was able to install Xfce 13 but had the black screen after installing the Nvidia-96 driver. I then installed the downloaded
Nvidia-96.43.23 driver and it worked perfectly this time. The only problem was with the refresh rate. This system still has a CRT
monitor and the highest refresh rate that could be set in Settings → Display was 62 Hz, where 75 Hz is desirable. I corrected that by
opening the Nvidia Settings Utility with the command "sudo nvidia-settings" and changed the refresh rate to 75 Hz there.
AndrewXP
Level 1
Level 1
Posts: 26
Joined: Tue Mar 18, 2014 8:57 am

Re: Install Nvidia proprietary drivers in LinuxMint UPDATED

Post by AndrewXP »

roblm wrote:AndrewXP,

Here is an update of my last post. I removed the GeForce 4 MX 420 video card from the computer with the Athlon XP 2500 CPU,
which would not install Xfce 13, and swapped it with the GeForce2 MX 200 video card on the computer with the Intel Pentium 4 CPU,
which was able to install Xfce 13 but had the black screen after installing the Nvidia-96 driver. I then installed the downloaded
Nvidia-96.43.23 driver and it worked perfectly this time. The only problem was with the refresh rate. This system still has a CRT
monitor and the highest refresh rate that could be set in Settings → Display was 62 Hz, where 75 Hz is desirable. I corrected that by
opening the Nvidia Settings Utility with the command "sudo nvidia-settings" and changed the refresh rate to 75 Hz there.
Thanks, roblm. I've now downgraded to Mint 13 and managed to activate the NVIDIA v96 driver via the Additional Drivers facility. My only problem then was, like you, the refresh rate, which, according to Menu | Settings | Display can be either 50 or 51 Hz, where my monitor would support 75 Hz. If I run nvidia-settings as you suggest (it's also available via Menu | System | NVIDIA X Server Settings) I get the following message when I click on X Server Display Configuration:

Unable to load X Server Display Configuration page:

The NVIDIA X driver on DELL-PC-LM13:0.0 is not new
enough to support the nvidia-settings Display Configuration page.


The display I'm left with is not quite as good as the adapter-specific driver I was using under Windows XP, but is a considerable improvement on the Nouveau driver provided under Mint 16. When Mint 13 support ends in April 2017 it may be the end of the road for my NVIDIA GeForce4 MX 420 adapter, and therefore probably for my DELL Dimension 4550, in which the adapter was fitted at purchase, and which will by then have performed over 14 years of service!

Thanks again for your help,
Andrew.
Mint 13 Xfce 32-bit
User avatar
roblm
Level 13
Level 13
Posts: 4541
Joined: Sun Feb 24, 2013 2:41 pm

Re: Install Nvidia proprietary drivers in LinuxMint UPDATED

Post by roblm »

AndrewXP,

Are you using a CRT or flat panel monitor? I would try to install the Nvidia-96 driver you previously had downloaded from the Nvidia
website, like I did. It probably is a newer version than the one in Additional Drivers. It is supposed to have support for X.Org xserver
versions 1.11 and 1.12, and Xfce 13 has version 1.11. Remove the Nvidia driver in Additional Drivers first and then install the
downloaded Nvidia-96 driver.

The Nvidia Settings Utility should by opened in the Terminal, not in the menu, with the command "sudo nvidia-settings", or the changes
to the refresh rate won't be saved.

When Xfce 13 reaches it's end of support, you could try LMDE. On my system with the GeForce 4 MX 420 video card, I've tried LMDE
with the Cinnamon desktop and the only minor problem is that the background color of the opened menu doesn't display perfectly
because of this old video card. LMDE with the Mate desktop would probably be better since it has less demanding hardware requirements.
Last edited by roblm on Wed Apr 23, 2014 5:38 pm, edited 1 time in total.
AndrewXP
Level 1
Level 1
Posts: 26
Joined: Tue Mar 18, 2014 8:57 am

Re: Install Nvidia proprietary drivers in LinuxMint UPDATED

Post by AndrewXP »

roblm wrote:AndrewXP,

Are you using a CRT or flat panel monitor? I would try to install the Nvidia-96 driver you previously had downloaded from the Nvidia website, like I did. It probably is a newer version than the one in Additional Drivers. It is supposed to have support for X.Org xserver versions 1.11 and 1.12, and Xfce 13 has version 1.11. To remove the Nvidia driver, open Additional Drivers and select the “xserver-xorg-video-nouveau” driver first and then install the downloaded Nvidia-96 driver.
Thanks, roblm. It's an LCD flat-panel monitor. Actually, it appears that the NVIDIA version installed through Additional Drivers is the same as the one I downloaded previously, i.e. 96.43.23. Anyway, I'm reasonably happy with my display now. Onwards and upwards!
Mint 13 Xfce 32-bit
User avatar
roblm
Level 13
Level 13
Posts: 4541
Joined: Sun Feb 24, 2013 2:41 pm

Re: Install Nvidia proprietary drivers in LinuxMint UPDATED

Post by roblm »

AndrewXP,

I replaced the CRT monitor with a flat panel monitor and removed the downloaded Nvidia-96 driver. There was no proprietary
driver available in Additional Drivers. I added the PPA x-swat/x-updates, which has newer drivers, and then the Nvidia-96 driver
was available in Additional Drivers. After installing it, Display lists the same refresh rates as yours and I saw the same message
you got after opening the Nvidia Settings Utility.

It appears that the correct rates are not being listed. Typing xrandr in the Terminal shows the same rates but the monitor is not
being detected correctly. Look at the picture below. You see the message "Failed to get size of gamma" and the monitor is named
default. If detected correctly the third line would say something like DVI or VGA connected. I suspect you will show the same.
xfce-13-xrandr.png
The monitor is usually set to it's optimal refresh rate, which is 60 Hz for most flat panels. This is the rate that is displayed when I
checked the monitor's on-screen menu, so your actual refresh rate is probably 60 Hz.

With the downloaded Nvidia driver, any changes I made in the Nvidia Settings Utility was also seen in the on-screen menu.
I also added the PPA xorg-edgers/ppa later, which can have even newer drivers, but it had the same driver.
ridobe
Level 1
Level 1
Posts: 18
Joined: Fri May 31, 2013 7:09 pm

Re: Install Nvidia proprietary drivers in LinuxMint UPDATED

Post by ridobe »

roblm wrote:In my first post in this topic, I stated how I've been unable to install Nvidia drivers downloaded from the Nvidia website in Mint 16.
I checked that site recently to see if newer drivers were available for my video card, which is a GeForce 210. The 331.67 driver
was available, which supports video cards in the GeForce 8 series and newer. This driver would not install at first but after some
more investigation and testing I was able to get it installed. I first had to open the Synaptic Package Manager and install the
package → libc6-dev. This also installs the package → libc-dev-bin. Both were needed. These packages are both already installed
in Mint 14 and 15 Cinnamon, but not in Mint 16. During the installation there was a different message with this driver. It stated that the
nvidia-installer would also install the libvdpau and libvdpau_trace libraries.
nvidia install-2.jpg
Libvdpau1 is already installed in Mint 14 but not in 15 or 16. It contains those two packages. So I uninstalled the Nvidia driver and
and installed the packages libvdpau1 and libvdpau-dev in Synaptic and then tried to reinstall the 331.67 driver and older Nvidia
drivers, the 319.17 and 325.15, but they would not install. Evidently the libvdpau package that comes with the Nvidia 331.67 driver is
not exactly the same as the package in Synaptic, or there's some other reason. I couldn't find any newer versions either.

I didn't use the method of installation suggested in this topic, but used the method I've always used in Mint 14 and 15. The nouveau
driver has to be disabled first so it doesn't load in the initial ramdisk image that is created early during startup and later in the kernel. I
manually disable that driver by creating a file named “disable-nouveau.conf” by opening the Terminal and typing:
gksudo gedit /etc/modprobe.d/disable-nouveau.conf

Then add these two lines to the opened file:
blacklist nouveau
options nouveau modeset=0

Save the file. To disable nouveau in the ramdisk, open the Terminal and type:
gksudo gedit /etc/default/grub

Look for the line: GRUB_CMDLINE_LINUX_DEFAULT="quiet splash"
Change it to : GRUB_CMDLINE_LINUX_DEFAULT="quiet splash rdblacklist=nouveau"

Some use this command: GRUB_CMDLINE_LINUX_DEFAULT="quiet splash nouveau.blacklist=1"

The first step in disabling nouveau can be done automatically by the nvidia-installer but the second cannot. Save the file and open
the Terminal and type these two commands:
sudo update-grub
sudo update-initramfs -u

Move the downloaded Nvidia driver to your "/home/user-name" directory. Rename the file "N.run" so you don't have to type that long
name later. Reboot and then enter the virtual terminal tty1 by pressing Ctrl+Alt+F1. Then type these commands:
sudo service mdm stop
sudo sh N.run
Answer "yes" at all the screens. After installation type: sudo service mdm start
@roblm

Your homework and tutorial is what finally earned me success with a manual install of nvidia drivers. I have struggled to the point where I was using the xorgedgers ppa until I figured out how to do so. I never gave up but I came close. What the ppa was doing is essentially what you had us do in the first step and that is to create the file disable-nouveau.conf. That was the difference.

Thanks for your help.
AndrewXP
Level 1
Level 1
Posts: 26
Joined: Tue Mar 18, 2014 8:57 am

Re: Install Nvidia proprietary drivers in LinuxMint UPDATED

Post by AndrewXP »

roblm wrote:AndrewXP,

[...]

It appears that the correct rates are not being listed. Typing xrandr in the Terminal shows the same rates but the monitor is not
being detected correctly. Look at the picture below. You see the message "Failed to get size of gamma" and the monitor is named
default. If detected correctly the third line would say something like DVI or VGA connected. I suspect you will show the same.
xfce-13-xrandr.png
The monitor is usually set to it's optimal refresh rate, which is 60 Hz for most flat panels. This is the rate that is displayed when I
checked the monitor's on-screen menu, so your actual refresh rate is probably 60 Hz.

With the downloaded Nvidia driver, any changes I made in the Nvidia Settings Utility was also seen in the on-screen menu.
I also added the PPA xorg-edgers/ppa later, which can have even newer drivers, but it had the same driver.
Roblm, I did indeed get the same response to xrandr, and my on-screen menu does show 60 Hz. I guess I'll have to do without 75 Hz with the v96.43.23 driver I'm using, but, as I said before, the display will do!
Mint 13 Xfce 32-bit
ridobe
Level 1
Level 1
Posts: 18
Joined: Fri May 31, 2013 7:09 pm

Re: Install Nvidia proprietary drivers in LinuxMint UPDATED

Post by ridobe »

New nvidia (beta) driver 337.19 out today:

Code: Select all

ridobe@xubuntu:~$ inxi -SG
System:    Host: xubuntu Kernel: 3.15.0-rc4-ridobe-050514 x86_64 (64 bit) Desktop: Xfce 4.11.6 Distro: Ubuntu 14.04 trusty
Graphics:  Card: NVIDIA GK104 [GeForce GTX 760] X.Org: 1.15.1 driver: nvidia Resolution: 1920x1080@60.0hz, 1920x1080@60.0hz 
           GLX Renderer: GeForce GTX 760/PCIe/SSE2 GLX Version: 4.4.0 NVIDIA 337.19
User avatar
roblm
Level 13
Level 13
Posts: 4541
Joined: Sun Feb 24, 2013 2:41 pm

Re: Install Nvidia proprietary drivers in LinuxMint UPDATED

Post by roblm »

ridobe,

I noticed in your post that you upgraded the kernel to the latest version available, which is 3.15.0-rc4. Since I've never used Xubuntu,
I wanted to test it on my extra partition before responding to your post. I'm sure you saw this message during the Nvidia driver installation:

"The CC version check failed:

The compiler used to compile the kernel (gcc 4.6) does not exactly match the current compiler (gcc 4.8.2). The linux 2.6 kernel module
loader rejects kernel modules built with a version of gcc that does not exactly match that of the compiler used to build the running kernel.

If you know what you are doing and want to ignore the gcc version check, select “No” to continue installation. Otherwise, select “Yes” to
abort installing, set the CC environment variable to the name of the compiler used to compile your kernel, and restart installation. Abort
now? Yes or No."

Here's what Nvidia says about going ahead with an installation where there is a gcc compiler (GNU C compiler) mismatch:

“This may be perfectly fine, but there are cases where this can lead to unexpected behavior and system crashes”.
“You should compile the NVIDIA kernel module with the same compiler version that was used to compile your kernel”.

This information is from the “NVIDIA Accelerated Linux Graphics Driver README and Installation
Guide”, Chapter 8. Common Problems.

Here's the link:
http://us.download.nvidia.com/XFree86/L ... blems.html

Xubuntu comes with the 3.13 kernel. To check what version of the gcc compiler was used to build the running kernel, you can type
this command in the Terminal:
cat /proc/version
For the 3.13 kernel the output is gcc 4.8.2

To check what version of the gcc compiler is installed with Xubuntu and is used to build kernel modules, then type this command:
gcc -v
The output is again 4.8.2.

After installation of the 3.15.0-rc4 kernel and running this command again:
cat /proc/version
The output is gcc 4.6.3, so that kernel was compiled with a different gcc version.

I assume you got that kernel from this site:
http://kernel.ubuntu.com/~kernel-ppa/mainline/

All of those kernels have been compiled with gcc version 4.6.
Hopefully you won't experience any problems. Did you install the newer kernel to correct a critical problem?
ridobe
Level 1
Level 1
Posts: 18
Joined: Fri May 31, 2013 7:09 pm

Post by ridobe »

roblm,
Thanks for replying. I appreciate your posts.

No, I'm not getting that error because I'm compiling straight from source. https://git.kernel.org/cgit/linux/kerne ... x.git/log/

I'm not getting any critical errors at all. I am just trying to learn as much about the kernel build as I can. I build a few times a week, "nightlies" if you will, so I'm always building whats been merged. I experiment with stripping modules I don't need, optimizing, etc. I'm really just getting started but I love this stuff.

Sent from my Nexus 5 using Tapatalk
User avatar
roblm
Level 13
Level 13
Posts: 4541
Joined: Sun Feb 24, 2013 2:41 pm

Re: Install Nvidia proprietary drivers in LinuxMint UPDATED

Post by roblm »

ridobe,

When I get some extra time then I plan on experimenting with building kernels like you're doing.

So if you're building your own kernel, then you should get “gcc version 4.8.2” when using this command in the Terminal:
cat /proc/version

Is that what you get?
ridobe
Level 1
Level 1
Posts: 18
Joined: Fri May 31, 2013 7:09 pm

Re: Install Nvidia proprietary drivers in LinuxMint UPDATED

Post by ridobe »

^Yes, it is.

Code: Select all

ridobe@xubuntu:~$ cat /proc/version
Linux version 3.15.0-rc5-ridobe-050914 (ridobe@xubuntu) (gcc version 4.8.2 (Ubuntu 4.8.2-19ubuntu1) ) #1 SMP Fri May 9 17:06:08 EDT 2014
Post Reply

Return to “Graphics Cards & Monitors”