Install Nvidia proprietary drivers in LinuxMint UPDATED 2014

Screen resolution, 3D Acceleration, nVidia, ATI
Forum rules
Before you post please read this
carsten888
Level 1
Level 1
Posts: 11
Joined: Sun Dec 01, 2013 5:46 am

Re: Install Nvidia proprietary drivers in LinuxMint UPDATED

Post by carsten888 » Thu Feb 20, 2014 9:31 am

I got a nvidia GTX 765M and an integrated intel. Where to go from here?

I tried step 1. sudo service mdm stop and screen went black.

kraghot
Level 1
Level 1
Posts: 6
Joined: Fri Oct 18, 2013 4:42 pm

Re: Install Nvidia proprietary drivers in LinuxMint UPDATED

Post by kraghot » Thu Feb 20, 2014 9:38 am

Any advice on properly installing the drivers if you have the "optimus" hybrid configuration? I've been trying for a long time and I just can't get the drivers to work.

mweishaa
Level 1
Level 1
Posts: 26
Joined: Fri May 10, 2013 3:32 pm

Re: Install Nvidia proprietary drivers in LinuxMint UPDATED

Post by mweishaa » Thu Feb 20, 2014 9:50 am

carsten888 wrote:I got a nvidia GTX 765M and an integrated intel. Where to go from here?

I tried step 1. sudo service mdm stop and screen went black.
Did you read all of the steps before doing step 1? (including the part where you go to a console via CTRL-ALT-F1)

carsten888
Level 1
Level 1
Posts: 11
Joined: Sun Dec 01, 2013 5:46 am

Re: Install Nvidia proprietary drivers in LinuxMint UPDATED

Post by carsten888 » Thu Feb 20, 2014 2:36 pm

mweishaa wrote:
carsten888 wrote:I got a nvidia GTX 765M and an integrated intel. Where to go from here?

I tried step 1. sudo service mdm stop and screen went black.
Did you read all of the steps before doing step 1? (including the part where you go to a console via CTRL-ALT-F1)
yes.

mweishaa
Level 1
Level 1
Posts: 26
Joined: Fri May 10, 2013 3:32 pm

Re: Install Nvidia proprietary drivers in LinuxMint UPDATED

Post by mweishaa » Thu Feb 20, 2014 2:50 pm

carsten888 wrote:
mweishaa wrote:
carsten888 wrote:I got a nvidia GTX 765M and an integrated intel. Where to go from here?

I tried step 1. sudo service mdm stop and screen went black.
Did you read all of the steps before doing step 1? (including the part where you go to a console via CTRL-ALT-F1)
yes.
Well, in looking back in this thread, I don't think that was anyone's "step 1". In what I did, it was step 3.
But stopping mdm will make your display manager screen go blank, it stops the display manager. That is why you exeucute it from the console.
Did you go any further, attempt to install the new driver, etc?

carsten888
Level 1
Level 1
Posts: 11
Joined: Sun Dec 01, 2013 5:46 am

Re: Install Nvidia proprietary drivers in LinuxMint UPDATED

Post by carsten888 » Fri Feb 21, 2014 2:59 am

I tried step 1. sudo service mdm stop and screen went black.
ahum, that actually was step 5.
Did you go any further, attempt to install the new driver, etc?
no because I could not see anything as the screen went black.
I tried to skip step five and go straight to the install, but that did not work. I figured that if the current fallback is on the intel driver, maybe as the other driver is not active, I didn't need to deactivate it to install the new driver. (I'm just a newbe)

mweishaa
Level 1
Level 1
Posts: 26
Joined: Fri May 10, 2013 3:32 pm

Re: Install Nvidia proprietary drivers in LinuxMint UPDATED

Post by mweishaa » Fri Feb 21, 2014 9:45 am

carsten888 wrote: ahum, that actually was step 5.
Not in the steps I did, which I posted about halfway down the first page of the thread. That's why I said "in what I did". :)
carsten888 wrote:
Did you go any further, attempt to install the new driver, etc?
no because I could not see anything as the screen went black.
I tried to skip step five and go straight to the install, but that did not work. I figured that if the current fallback is on the intel driver, maybe as the other driver is not active, I didn't need to deactivate it to install the new driver. (I'm just a newbe)
No problems on being a newbie... Linux can sometimes make anyone feel like that. :)
So I'll get really basic then.
The screen that was running your desktop should go black, but if your console went black I am not sure.
Sorry to beat this dead horse... but you were on your desktop, with firefox, a terminal, whatever... and you downloaded the driver and saved it somewhere. Then, while on your desktop, you pressed CTRL+ALT+F1 (at the same time)? That should have taken you to a text terminal, where you logged in, and stopped mdm?
With mdm stopped, if you then went back to where your desktop was by pressing CTRL-ALT-F8, you would have seen a black screen.

But... you said the fallback was on your intel driver... so you have integrated graphics as well as an nvidia card that you're trying to update the drivers for. Is your monitor plugged into the nvidia card or the integrated port? Maybe you could describe your video setup, version of Mint, driver, etc.

carsten888
Level 1
Level 1
Posts: 11
Joined: Sun Dec 01, 2013 5:46 am

Re: Install Nvidia proprietary drivers in LinuxMint UPDATED

Post by carsten888 » Fri Feb 21, 2014 11:24 am

you pressed CTRL+ALT+F1 (at the same time)? That should have taken you to a text terminal, where you logged in, and stopped mdm?
thats what I did. pressed CTRL+ALT+F1 (at the same time) logged in and after entered 'sudo service mdm stop' I hit enter and all went black.
so you have integrated graphics as well as an nvidia card that you're trying to update the drivers for
yes. well I only need to install the driver for nvidia, as the intel seems to work fine. This is on a laptop, so can't really see anything plugged in :wink:

This is on mint cinnamon 16. I did the extra install of the mate desktop yesterday, so now I at least got one stable system, but I much rather have cinnamon. No problems on mate at all. If I do 'lspci -nn | grep VGA' while logged in in a mate session, I also get the intel card in the result. So mate is not using my nvidia card either. When in mate, I opened the driver manager, but no driver suggestions at all.

mweishaa
Level 1
Level 1
Posts: 26
Joined: Fri May 10, 2013 3:32 pm

Re: Install Nvidia proprietary drivers in LinuxMint UPDATED

Post by mweishaa » Fri Feb 21, 2014 11:57 am

carsten888 wrote:
you pressed CTRL+ALT+F1 (at the same time)? That should have taken you to a text terminal, where you logged in, and stopped mdm?
thats what I did. pressed CTRL+ALT+F1 (at the same time) logged in and after entered 'sudo service mdm stop' I hit enter and all went black.
so you have integrated graphics as well as an nvidia card that you're trying to update the drivers for
yes. well I only need to install the driver for nvidia, as the intel seems to work fine. This is on a laptop, so can't really see anything plugged in :wink:

This is on mint cinnamon 16. I did the extra install of the mate desktop yesterday, so now I at least got one stable system, but I much rather have cinnamon. No problems on mate at all. If I do 'lspci -nn | grep VGA' while logged in in a mate session, I also get the intel card in the result. So mate is not using my nvidia card either. When in mate, I opened the driver manager, but no driver suggestions at all.
AH... laptop eh? I run on a desktop so don't really have any hands-on with hybrid graphics. You might want to check out vgaswitcheroo or bumblebee. I've only heard of them, and there may be some other better option out there. Or perhaps someone else here will have some advice.

welder
Level 1
Level 1
Posts: 2
Joined: Fri Feb 21, 2014 11:54 am

Re: Install Nvidia proprietary drivers in LinuxMint UPDATED

Post by welder » Fri Feb 21, 2014 12:19 pm

My graphic card is NVIDIA Go FX5200 and I have problem with nvidia-173 driver. Mint 16 Petra MATE, clean install. With previous version (15) no issue with this at all. When try to install it from Driver Manager, after restart, became black screen. When try to install script from text mode (without mdm loaded), became error in module or something else and installation process has been aborted. I try to upgrade kernel with new version (latest for few days ago - 3.13.2), but no change - all is the same. Nouveau driver working, but very laggy and after few minutes system freeze and became unresponsive. Now i use old and outdated Windows XP. :?

carsten888
Level 1
Level 1
Posts: 11
Joined: Sun Dec 01, 2013 5:46 am

Re: Install Nvidia proprietary drivers in LinuxMint UPDATED

Post by carsten888 » Mon Feb 24, 2014 10:50 am

I got an integrated intel card and a nvidia 765M. (as posted above)

When I did CTRL+ALT+F1 (at the same time) after entered 'sudo service mdm stop' I hit enter and all went black. So I figured maybe I don;t need to kill the display manager as I'm installing a driver for a device which is not in use anyway. So I went straight for the install
sudo sh n.run
it seemed to be doing something, unpacking and then a lot of --------'s in the terminal, then this:
exit.png
Does this mean I got to exit linux before I can install? How to install without Linux? Is there some graphic-driver-installer-distro that can be run from cd?

After 'ok' it tells me it made a log from this error. This is in the log:
nvidia-installer log file '/var/log/nvidia-installer.log'
creation time: Mon Feb 24 15:35:06 2014
installer version: 331.49

PATH: /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin

nvidia-installer command line:
./nvidia-installer

Using: nvidia-installer ncurses user interface
-> The file '/tmp/.X0-lock' exists and appears to contain the process ID '1509' of a runnning X server.
ERROR: You appear to be running an X server; please exit X before installing. For further details, please see the section INSTALLING THE NVIDIA DRIVER in the README available on the Linux driver download page at http://www.nvidia.com.

mweishaa
Level 1
Level 1
Posts: 26
Joined: Fri May 10, 2013 3:32 pm

Re: Install Nvidia proprietary drivers in LinuxMint UPDATED

Post by mweishaa » Mon Feb 24, 2014 6:15 pm

From your screenshot, you are trying to run it in a terminal app on your desktop... the Xserver has to be stopped to install the driver. That is why you have to go to the console with CTRL-ALT-F1. You can't install it with the Xserver/display manager running.

User avatar
roblm
Level 11
Level 11
Posts: 3666
Joined: Sun Feb 24, 2013 2:41 pm

Re: Install Nvidia proprietary drivers in LinuxMint UPDATED

Post by roblm » Mon Feb 24, 2014 6:27 pm

carsten888,

As mweishaa said, you always need to stop the X server in tty1 with the command “sudo service mdm stop” before trying to
install a video driver from the Nvidia website. The next time you get the black screen just try pressing Ctrl+Alt+F1 again. I've
seen that message “You appear to be running an X server” even after stopping the mdm service. If that happens then you will
need to open the file manager and look in the /tmp directory for “X0-lock” files. Right click on the /tmp directory and select
“Open as Root” and then delete those files. You may need to reboot before entering tty1 again.

However, it appears you have hybrid graphics so you can't install the Nvidia driver this way. You will need to install Bumblebee
first. Check this link:
http://forums.linuxmint.com/viewtopic.p ... us#p725173

welder,

I just experienced the same black screen problem as you did while testing a Mint 16 installation. I had added the PPA
xorg-edgers to get the latest Nvidia driver first. Then the nvidia-331 driver appeared in Driver Manager. After installation
I got a black screen. I was able to enter tty1 by pressing Ctrl+Alt+F1. I then removed the driver with this command:
sudo apt-get remove nvidia-331
I also typed this command to remove any “xorg.conf” file that may have been created: sudo rm /etc/X11/xorg.conf

After rebooting, the previous system was restored. I then tried a test by installing the nvidia-331 driver again in Driver Manager,
and to my surprise it worked this time. I tested this procedure again twice, both with and without installing updates, to see if it was
some fluke but it worked again. Evidently some packages must have been removed or upgraded to allow this. So you could try
this as a last resort.

From reading the posts in this topic it appears that nobody with Mint 16 installed has been able to download video drivers from
the Nvidia website and successfully install them using the steps in this topic. In Mint 14 and 15 I had no problem doing this but
I have not been able to do it with Mint 16. I tried the steps in this topic but ended up with the exact same error messages I got
when using my previous method of installation. The two people who claim success are mweishaa, who has Mint 15 installed and
luick, who didn't say what version of Mint he had installed. Some other people have hybrid graphics so they need to install
Bumblebee first. Mint 16 uses the 3.11 kernel but this problem started with the 3.10 kernel, which I became aware of when testing
LMDE with a 3.10 kernel.

Here's a quote from a recent article I read that deals with this topic:

“Proprietary NVIDIA/AMD graphics drivers don't support KMS/VirtualFB and are often late supporting newer X.org server and
kernel releases. Besides Linux developers do everything to break closed source drivers by changing APIs (to give you an example,
kernels 3.8, 3.9, 3.10, 3.11, 3.12 and 3.13 all had changes that rendered NVIDIA binary drivers inoperable, i.e. uncompilable)
or making APIs unusable beyond the GPL realm.”

Now that statement isn't totally true because I was able to install downloaded Nvidia drivers in kernels 3.8 and 3.9.

In step 12 of kk5000's first post, the package name “libdrm-nouveau1a” in the line:
sudo apt-get purge xserver-xorg-video-nouveau libdrm-nouveau1a nvidia*
does not exist in Mint 16. It should be “libdrm-nouveau2”. There was a package with that name in Mint 14 but it was changed in Mint 15.
WARNING: It's very fortunate that mistake was made because if "libdrm-nouveau1a" is removed in Mint 14 Cinnamon or libdrm-nouveau2 is removed in Mint 16 Cinnamon, then 38 other packages are also removed, some of which are necessary for normal operation, such as nemo and cinnamon. After rebooting you will end up with a black screen, unable to recover, even after entering tty1 and reinstalling
libdrm-nouveau2 or libdrm-nouveau1a.
Last edited by roblm on Sat Apr 19, 2014 9:12 am, edited 3 times in total.

carsten888
Level 1
Level 1
Posts: 11
Joined: Sun Dec 01, 2013 5:46 am

Re: Install Nvidia proprietary drivers in LinuxMint UPDATED

Post by carsten888 » Tue Feb 25, 2014 9:51 am

@roblm
thank you.
You will need to install Bumblebee first. Check this link:
viewtopic.php?f=49&t=135283&p=725173&hilit=optimus#p725173
I'm continuing my quest for getting this driver installed in that thread.

Ayawisgi
Level 1
Level 1
Posts: 20
Joined: Thu Feb 20, 2014 3:08 pm

Re: Install Nvidia proprietary drivers in LinuxMint UPDATED

Post by Ayawisgi » Fri Feb 28, 2014 2:34 pm

I can confirm that these instructions worked on my dual-boot WINXP system running a fresh install of Mint16 w/Cinnamon and an NVIDIA 550 ti graphics card. (There were no previous drivers to deal with.)

While I'm a noob regarding Linux, I've wrestled with himem.sys and the Hayes command set so I'm pretty comfortable with command-line instructions. For anyone else who's new to Linux, a few thoughts:

1) Write down the instuctions in the original post in order, and double-check each one. I dropped a hypen between "update" and "initramfs" and it stopped me cold. If you get jammed up, don't be afraid to launch Firefox and revisit the instructions (which you should pin or bookmark now) in the middle of the process.

2) If you feel like you're doing the same thing over and over and getting nowhere, that's because you are.

3) You'll know you've gotten over the hump when you boot for the nth time but the Mint logo size has changed. That signals that you've finally kicked Nouveau to the curb, and if your experience is like mine you'll finally be able to load the NVIDIA drivers.

4) After the drivers loaded I was asked if I wanted to build a "DKMS kernel module" and had no idea if that was a good idea or a bad idea. I said yes and so far nothing bad has happened.

5) The only reason I wanted to install the NVIDIA drivers was because the default Mint drivers were running my monitor refresh rate at 60 and killing me. The new drivers now say they are running at 85, but there's no option to change that number, which strikes me as comically ironic.

Good luck.

Yfrwlf
Level 3
Level 3
Posts: 129
Joined: Sat Jun 08, 2013 7:46 pm

Re: Install Nvidia proprietary drivers in LinuxMint UPDATED

Post by Yfrwlf » Fri Mar 07, 2014 10:33 am

Success, finally!

So this is what I did to get mine working with the latest stable nVidia driver 331.49. This was done while I had the 319 version installed with the Linux Mint driver manager (I ended up removing that driver)

Not sure if this was needed, but:

Code: Select all

sudo apt-get install build-essential linux-headers-`uname -r` xserver-xorg-dev pkg-config
Downloaded and made the 331.49 driver executable with the GUI.

Then I did

Code: Select all

CONTROL-ALT-F1 to get to tty1
switched to root

Code: Select all

sudo su -
ran the driver installer

Code: Select all

cd /home/username/Desktop (where I saved it to)
./NVIDIAblahblahblah just hit the tab key
After selecting yes on everything I tried to start back up Xorg.

Code: Select all

start mdm
This failed, and when it does it will ask if you want to check the Xorg output, as well as the "advanced" output, to find out why. It was not helpful and simply told me that the nvidia modules failed to load, and suggested I check the kernel log.

After checking the kernel log, I found that it was complaining about a version mismatch between the 319 driver I had installed with the driver/package manager and the new 331 version. I then purged the old driver and settings tool

Code: Select all

apt-get purge nvidia-319 nvidia-settings-319
made sure mdm was completely stopped again

Code: Select all

stop mdm
and reinstalled the driver again

Code: Select all

./N<tab>
after doing this, just for good measure, even though it does it at the end of the installation, I did

Code: Select all

nvidia-xconfig
and then tried starting Xorg again

Code: Select all

start mdm
It worked! I then rebooted, and it is still working!

Here is hoping that nVidia will make a Linux installer that doesn't require stopping Xorg as that is a horrible annoying experience. Even AMD doesn't require doing that with their driver installer, and AMD's installer even has a GUI as well as command line. Someone at nVidia hinted recently that they had big things in store for Linux, well I hope to see it soon and hope it is in the form of getting a nice auto-updater and installer like on Windows that leaves all this silliness in the past.

Hope this helps someone.

ridobe
Level 1
Level 1
Posts: 18
Joined: Fri May 31, 2013 7:09 pm

Post by ridobe » Fri Mar 07, 2014 10:40 am

^ My issue with this is exactly what you are saying. When I stop mdm, I lose everything. I cannot get to tty1. Nothing. I would love to be able to apply manually instead of exorg-edgers, but I cannot get past this point.

Sent from my Nexus 5 using Tapatalk

User avatar
Brahim Salem
Level 8
Level 8
Posts: 2406
Joined: Tue May 29, 2012 10:12 pm
Location: USA

Re: Install Nvidia proprietary drivers in LinuxMint UPDATED

Post by Brahim Salem » Fri Mar 07, 2014 11:07 am

Thanks for the update! But would please add this tutorial here http://community.linuxmint.com/ :D Thanks :D

Maybe you should add this to your tutorial as a tip http://forums.linuxmint.com/viewtopic.php?f=42&t=161341
Image

Grokling
Level 1
Level 1
Posts: 22
Joined: Fri May 06, 2011 5:32 am

Re: Install Nvidia proprietary drivers in LinuxMint UPDATED

Post by Grokling » Wed Apr 09, 2014 7:11 am

I just ran through this on a fresh install of LM16 Cinnamon on a new Dell laptop (inspiron 7000) and Cinnamon crashes consistently leaving me in failback mode.

inxi -Gx (from tty1) shows that I'm running on the Intel integrated graphics using nouveau,intel (unloaded: nvidia,fbdev,vesa)

lspci shows 04:00.0 3D controller: NVIDIA Corporation GK107M [GeForce GT 750M] (rev a1)

Any suggestions?

User avatar
roblm
Level 11
Level 11
Posts: 3666
Joined: Sun Feb 24, 2013 2:41 pm

Re: Install Nvidia proprietary drivers in LinuxMint UPDATED

Post by roblm » Sun Apr 13, 2014 5:02 pm

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
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
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
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 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.


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. See the update below for the most recent drivers.

This method won't work on Mint 18.xx

Use this command to install nvidia-prime: apt install nvidia-prime

Download the Nvidia driver and move it to your “/home/your-user-name” directory. 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

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”. There are actually no libglvnd files installed on your system, so nothing will be overwritten.

After the installation, use this command: sudo service lightdm start

Don't reboot. 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. Iif you want to use it, download it from here:
https://imgur.com/sb0LSOy

Switch  GPU.png
Switch GPU.png (1.97 KiB) Viewed 591 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.


Uninstalling the Nvidia driver:

The Intel GPU should be selected. In tty1, use the command N-390.87.run --uninstall. Ignore the message:
ERROR: File '/usr/lib/xorg/modules/extensions/libglx.so' is not a symbolic link.
Ignore the next screen message. If you get a black screen, press and hold the Alt key and then press these keys, one at a time: Print Screen, R, E, I, S, U, B


Reinstalling the Nvidia driver:

First use this command in the Terminal and reboot: sudo prime-select nvidia; reboot
Install the Nvidia driver in tty1. At the desktop, use these commands:

Code: Select all

sudo cp /opt/libglamoregl.so /usr/lib/xorg/modules
sudo cp /opt/libglx.so.old /usr/lib/xorg/modules/extensions

Installing a newer driver version:

The Nvidia GPU must be selected. The driver presently installed does not need to be removed. Install the newer driver in tty1. At the desktop, use this command:

Code: Select all

sudo cp /opt/libglamoregl.so /usr/lib/xorg/modules
Open the .Switch-GPU script and change the Nvidia driver version number in line 5.


UPDATED 2019: Starting with the Nvidia 410.66 driver, Nvidia has changed the libglx module name. Instead of using the simple libglx.so.410.66 name, the module is named libglxserver_nvidia.so.410.66.

Install nvidia-prime (apt install nvidia-prime). The driver installation does not remove libglx.so from /usr/lib/xorg/modules/extensions but does remove libglamoregl.so, so it needs to be copied to another location such as the /opt folder, before the driver installation: sudo cp /usr/lib/xorg/modules/libglamoregl.so /opt

After the installation, add it back: sudo cp /opt/libglamoregl.so /usr/lib/xorg/modules

There is no PRIME Profiles page in the Nvidia Settings utility, so switching GPUs must be done using the sudo prime-select intel or sudo prime-select nvidia commands, or with this script.

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 

UPDATED 10-2019: for the 435.21 driver, both libglx.so and libglamoregl.so are not removed by the installation.
Same for the 440.31 and 440.44 drivers.


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 Dec 11, 2019 6:17 pm, edited 48 times in total.

Post Reply

Return to “Graphics Cards & Monitors”