Author Topic: How To: Install nVidia drivers in Debian (Current kernels and drivers)  (Read 3993 times)

0 Members and 1 Guest are viewing this topic.

warfacegod

  • Ubuntu Up Your Ass!
  • *
  • Offline Offline
  • Beanses: 30,212
  • Karma: +5/-48
  • Poison Tasting Your Beer Department
    • View Profile
    • Open Linux Forums Founder
So here we are again with nVidia drivers and getting them into Debian Wheezy (and friends). For some time now, getting proprietary drivers into Debian based systems with newer kernels has been a real ...hassle*. First of all, let me say this. I don't give a damn what Debian's "Preferred" method is. If they even have one yet for current drivers. This is my preferred method. For two reasons. I trust this by far over Debian's and it works.

*Please insert your own colorful expletive.

Keep in mind I've only done this with the 3.11 kernel. I don't know that it will work for the 3.9, 3.10, or 3.12 kernels. Although I have no reason to believe it won't, don't come whining to me if it doesn't. In fact, I've no real reason to think this won't work for legacy kernels as well. I have no intention of finding out. If you want to, feel free.

We'll be using the sgfxi method but first we need to get you the proper repos. In other words, Wheezy's repos will fail. First of all, you must have the header packages installed for your kernel. Otherwise, the driver won't install. So, without further ahh doo doo... and for the sake of brevity because I'm just about sick to death of dealing with this. There's a bit of trickery here that I'll discuss later on.

.01 Open your sources list as root. It can be found in /etc/apt/sources.list

Code: [Select]
gksudo gedit /etc/apt/sources.list
Substitute "gedit" with the text editor installed in your system. geany, leafpad, pluma, etc.

.02 Paste these lines into your sources.list and save.

Code: [Select]
deb http://http.debian.net/debian sid main contrib non-free

deb http://http.debian.net/debian jessie main contrib non-free

I can already see the comments coming so let me save you the trouble. Don't bother me with your nonsense. They are BOTH required. I've tried dozens of times to get nVidia drivers installed with newer kernels for months. (See above mention of sickness to death.)

.03
Code: [Select]
sudo apt-get update
.04 Go here: http://packages.debian.org/experimental/nvidia-kernel-source Download the nvidia-kernel-source package and install it with gdebi. It will want to install something like 18 additional packages. This is normal.


So now all that's done. You should be ready to install the actual driver.


Quote

Edit:


It looks like the 3.12 growing pains may be over or drawing to a close anyway. I just did a Wheezy minimal install and did not need to enable either or both of Sid and Jessie repos. Wheezy's repo is now sufficient for nVidia drivers via sgfxi. I'm leaving the above in place for folks that want to use older kernels or in case the same doesn't work for full installs for some reason. -w
« Last Edit: January 08, 2014, 04:36:27 pm by warfacegod »
"And his hands would plait the priest's entrails,
For want of a rope, to strangle kings." - Diderot

Desktop
OS: Some Debian based crap I built (Openbox/XBMC) 64bit
Machine: A better than yours custom build.
AMD FX-8350 / 24 GB DDR3 RAM / GTX550 Ti / 60 GB SSD / ~12 TB HDD's

"Dead or alive, you're coming with me." - Robocop

warfacegod

  • Ubuntu Up Your Ass!
  • *
  • Offline Offline
  • Beanses: 30,212
  • Karma: +5/-48
  • Poison Tasting Your Beer Department
    • View Profile
    • Open Linux Forums Founder
Re: How To: Install nVidia drivers in Debian (Current kernels and drivers)
« Reply #1 on: November 17, 2013, 05:07:30 am »
.01 cd /usr/local/bin

cd = change directory. This is the text version of going to a folder using your GUI File Manager (Caja, Thunar, etc.).

.02
Code: [Select]
sudo wget smxi.org/smxi.zip && sudo unzip smxi.zip
This will download and unpack the sgfxi script into the directory (folder) you cd'd into above.

.03 Ctrl+Alt+F1

This drops you into a tty (text). You'll need to log in.

.04
Code: [Select]
sudo su -
Code: [Select]
sgfxi
The first thing the script will do is stop your Display Manager. Doesn't matter which one you're using, SLiM, gdm3, etc. The script knows how to stop it. The next thing it will do is scan your hardware and download the driver for it from the nVidia site. 99% of the time, that means the current driver (331, as of right now). At this point, one of two things will happen. That depends entirely on what driver you were already using.

Nouveau: It's almost certain the script won't be able to unload the nouveau module from your kernel. We can lay the blame for this straight at nouveau's feet because it sucks. sgfxi can either Shutdown (Recommended) or Reboot. It's labeled as Recommended for a reason. You should listen to it. Choose option 1 (Shutdown). Option 2 (Reboot) has a very good chance of not working. Once you've started back up, the vesa driver will be loaded. At this point you need to go back to step .03

nVidia driver: Assuming you've install the proprietary driver through Synaptic, or some other Debian approved method, it's going to find all of that and purge it. Don't panic. This is normal.

In either case, you should be at the point that sgfxi downloads the nVidia driver. Then it unpacks it and runs the installer. ...this may take a while. Depends on your hardware. If it's more than say 5 minutes, something utterly horrible has happened and you best option is to go set yourself on fire.

If everything went okay, choose option 1 to start your desktop back up. Congrats, you've finally got real drivers.

.05 Open your sources as root again.

Code: [Select]
gksudo gedit /etc/apt/sources.list Now remove both the Sid and Jessie repos you added in steps .01 and .02 in my first post. It may be better to simply comment # them out. I suspect you'll need them again.

That's it. You're done. Yes, yes. I know. I'm awesome. Welcome and all that jazz. :P
« Last Edit: December 05, 2013, 01:06:10 pm by warfacegod »
"And his hands would plait the priest's entrails,
For want of a rope, to strangle kings." - Diderot

Desktop
OS: Some Debian based crap I built (Openbox/XBMC) 64bit
Machine: A better than yours custom build.
AMD FX-8350 / 24 GB DDR3 RAM / GTX550 Ti / 60 GB SSD / ~12 TB HDD's

"Dead or alive, you're coming with me." - Robocop

warfacegod

  • Ubuntu Up Your Ass!
  • *
  • Offline Offline
  • Beanses: 30,212
  • Karma: +5/-48
  • Poison Tasting Your Beer Department
    • View Profile
    • Open Linux Forums Founder
"And his hands would plait the priest's entrails,
For want of a rope, to strangle kings." - Diderot

Desktop
OS: Some Debian based crap I built (Openbox/XBMC) 64bit
Machine: A better than yours custom build.
AMD FX-8350 / 24 GB DDR3 RAM / GTX550 Ti / 60 GB SSD / ~12 TB HDD's

"Dead or alive, you're coming with me." - Robocop

warfacegod

  • Ubuntu Up Your Ass!
  • *
  • Offline Offline
  • Beanses: 30,212
  • Karma: +5/-48
  • Poison Tasting Your Beer Department
    • View Profile
    • Open Linux Forums Founder
Re: How To: Install nVidia drivers in Debian (Current kernels and drivers)
« Reply #3 on: November 17, 2013, 05:48:01 am »
Some Notes:

.01 Here's the trickery thing I mentioned earlier. If you open Synaptic, you won't see the nvidia-kernel-source package you installed earlier. I've no idea why that is.

.02 More on trickery. Timing is critical here. The nvidia-kernel-source package you get from the Jessie repo needs to match the driver version the sgfxi script will download. For example, right now the source package is version 331.20 and so is the nVidia driver. If one was 331.20 and the other were 331.60, it would probably still work. However, if the nvidia-kernel-source package is version 331.20 and meanwhile the current driver becomes say 360.20, it's very unlikely this will work. Not until Debian posts a 360 version as well.

.03 For some time now, the main issue with getting proprietary drivers installed with new kernels seems to have been because the kernel kids have been churning them out at an unprecedented rate. Similar to what Mozilla has been doing to the people that write Firefox addons. From what I've read, nVidia was simply unable to keep up and so stopped bothering to write modules to go along with their drivers. Supposedly the 331 driver was built specifically to install and run but not need kernel modules. Total bunk. If that were the case then there would be no need for the entire first half of this tutorial. Hell, the entire tutorial would be pointless, if 331 worked without modules.

.04 Unlike my last tutorial on this subject, this one has no mention of nvidia-xconfig. That's because the sgfxi script now handles that.

.05 Kernel updates will require that the script be rerun. That is, if you want to use the new kernel.
« Last Edit: November 17, 2013, 06:53:01 am by warfacegod »
"And his hands would plait the priest's entrails,
For want of a rope, to strangle kings." - Diderot

Desktop
OS: Some Debian based crap I built (Openbox/XBMC) 64bit
Machine: A better than yours custom build.
AMD FX-8350 / 24 GB DDR3 RAM / GTX550 Ti / 60 GB SSD / ~12 TB HDD's

"Dead or alive, you're coming with me." - Robocop

warfacegod

  • Ubuntu Up Your Ass!
  • *
  • Offline Offline
  • Beanses: 30,212
  • Karma: +5/-48
  • Poison Tasting Your Beer Department
    • View Profile
    • Open Linux Forums Founder
Re: How To: Install nVidia drivers in Debian (Current kernels and drivers)
« Reply #4 on: November 17, 2013, 06:10:24 am »
The traditional method:

I'm not going to go into any real depth on the more normal method as I've already done that here: https://openlinuxforums.org/index.php/topic,2661.msg93507.html#msg93507

Assuming the Jessie nvidia-kernel-source is installed along side everything else. I see no reason that using the Jessie packages and following along with the above link wouldn't work. There's a catch though. Synaptic won't display Experimental packages. You'll either have to download them manually and use dpkg, gdebi, or apt-get -t.

However, I have no intention of trying it right now. I don't currently have an OS I'm willing to inflict that upon. By its very nature, the Experimental repos are likely to cause breakage. Doing something like this will almost certainly require several Experimental packages aside from the driver packages themselves, a very large number of Jessie packages, and probably a healthy mix of Sid as well.
"And his hands would plait the priest's entrails,
For want of a rope, to strangle kings." - Diderot

Desktop
OS: Some Debian based crap I built (Openbox/XBMC) 64bit
Machine: A better than yours custom build.
AMD FX-8350 / 24 GB DDR3 RAM / GTX550 Ti / 60 GB SSD / ~12 TB HDD's

"Dead or alive, you're coming with me." - Robocop

warfacegod

  • Ubuntu Up Your Ass!
  • *
  • Offline Offline
  • Beanses: 30,212
  • Karma: +5/-48
  • Poison Tasting Your Beer Department
    • View Profile
    • Open Linux Forums Founder
Re: How To: Install nVidia drivers in Debian (Current kernels and drivers)
« Reply #5 on: November 17, 2013, 06:52:39 am »
.05 Kernel updates will require that the script be rerun. That is, if you want to use the new kernel.

Speaking of, I just finish typing that and then I get an update for the Liquorix kernel. :think: That's this guy  >:D saying "Yeah, yeah. Do it! You know you want to. Ahhahahhhhhaaaaa!"

I'm happy to report that nothing went wrong. Once the driver, via sgfxi is installed, 99% of this how to becomes irrelevant.
Code: [Select]
sudo su -
Code: [Select]
sgfxi is sufficient.
« Last Edit: December 05, 2013, 01:03:04 pm by warfacegod »
"And his hands would plait the priest's entrails,
For want of a rope, to strangle kings." - Diderot

Desktop
OS: Some Debian based crap I built (Openbox/XBMC) 64bit
Machine: A better than yours custom build.
AMD FX-8350 / 24 GB DDR3 RAM / GTX550 Ti / 60 GB SSD / ~12 TB HDD's

"Dead or alive, you're coming with me." - Robocop

warfacegod

  • Ubuntu Up Your Ass!
  • *
  • Offline Offline
  • Beanses: 30,212
  • Karma: +5/-48
  • Poison Tasting Your Beer Department
    • View Profile
    • Open Linux Forums Founder
Re: How To: Install nVidia drivers in Debian (Current kernels and drivers)
« Reply #6 on: December 05, 2013, 01:01:56 pm »
The sgfxi people have recently adjusted their script so that it no longer runs with sudo. Either you must log in directly as root or

Code: [Select]
sudo su -
then

Code: [Select]
sgfxi
Note the dash ( -)after "su". If your root account is locked (because you don't use a root password like I do) then sudo su will not work. That's what the dash does.

I've updated the above posts to reflect the new method.
"And his hands would plait the priest's entrails,
For want of a rope, to strangle kings." - Diderot

Desktop
OS: Some Debian based crap I built (Openbox/XBMC) 64bit
Machine: A better than yours custom build.
AMD FX-8350 / 24 GB DDR3 RAM / GTX550 Ti / 60 GB SSD / ~12 TB HDD's

"Dead or alive, you're coming with me." - Robocop

ranch hand

  • *
  • Offline Offline
  • Beanses: 9,890
  • Karma: +52/-3
    • View Profile
Re: How To: Install nVidia drivers in Debian (Current kernels and drivers)
« Reply #7 on: December 05, 2013, 05:45:39 pm »
To clarify on "su -" in a bit different way;
User prompt of;
Code: [Select]
tom@jessie:~$
indicates that you are working from, in this case, /home/tom.  In other words, the users own directory.

"su" or "sudo su" will give you;
Code: [Select]
root@jessie:/home/tom#
once again working from the users home directory.

"su -" gives you;
Code: [Select]
root@jessie:~#
which has you working from the home directory of user "root".

This will put all "user" config files in /root instead of in /home/<user name>.  This is a good thing because this will cause them to be used by all possible users on your system.

While most folks have only one "normal" user Linux is set up for many users.  Configuring a driver for just one normal user would not make much sensse.
NewBox1, ADM FX-6300 6core 3.5GHz, Radeon HD 6450 PRO, SB Audigy 5.1, 1x320G HDD, 3x500G HDD, 1x500G External as demo/loaner, Debian Testing for normal use, Stable for secure use, Sid for FUN.

Not one shred of evidence supports the notion that life is serious.

warfacegod

  • Ubuntu Up Your Ass!
  • *
  • Offline Offline
  • Beanses: 30,212
  • Karma: +5/-48
  • Poison Tasting Your Beer Department
    • View Profile
    • Open Linux Forums Founder
Re: How To: Install nVidia drivers in Debian (Current kernels and drivers)
« Reply #8 on: December 08, 2013, 05:37:00 pm »
(Sigh.)

Now that the 3.12 kernel is stable, it's time to upgrade. There's a catch though. At least there is for the Liquorix kernel (which I'm using again). In Wheezy, the kernel package itself will install. The headers will not. I'm willing to bet the same thing will happen if you compile 3.12 yourself.

The solution is to enable the Sid repo. Open /etc/apt/sources.list as root and change wheezy main line to read sid.

From something like this:
Code: [Select]
deb http://http.debian.net/debian wheezy main contrib non-free
To this:
Code: [Select]
deb http://http.debian.net/debian sid main contrib non-free
Save the file but don't close yet.

Using an in repo kernel:
Next, we open and Reload Synaptic Package Manager. Find the Liquorix headers file and mark it for upgrade. Allow it to mark whatever other packages it wants and run the upgrade.

Using self compiled kernel:
Navigate to wherever you've been working and open the headers file with gdebi. It should then want to pull in some other packages from Sid. Let it and do the install.

Regardless of which way you got your headers installed, you should now set your sources.list back to Wheezy and save it.
"And his hands would plait the priest's entrails,
For want of a rope, to strangle kings." - Diderot

Desktop
OS: Some Debian based crap I built (Openbox/XBMC) 64bit
Machine: A better than yours custom build.
AMD FX-8350 / 24 GB DDR3 RAM / GTX550 Ti / 60 GB SSD / ~12 TB HDD's

"Dead or alive, you're coming with me." - Robocop

warfacegod

  • Ubuntu Up Your Ass!
  • *
  • Offline Offline
  • Beanses: 30,212
  • Karma: +5/-48
  • Poison Tasting Your Beer Department
    • View Profile
    • Open Linux Forums Founder
Re: How To: Install nVidia drivers in Debian (Current kernels and drivers)
« Reply #9 on: December 08, 2013, 05:46:41 pm »
Part 2 to this is doing the actual driver stuff.

Same as before, you now have to run sgfxi with

Code: [Select]
sudo su -
Here's where it changes slightly because of the kernel version number change. Simply doing

Code: [Select]
sgfxi
as before won't work. Because of the version change, it needs to recompile the driver. This is accomplished with

Code: [Select]
sgfxi -fNote the -f tag. This time around, the sgfxi script with check your repos and install module-assistant and possibly a few other packages as needed. Depends on what you've got installed already. When it's done, it will recompile the nVidia driver, install the new module to the new kernel, and ask you to start the desktop. At this point, you're done. You can start the desktop or play with your wanger on the keyboard in text land for all I care.
"And his hands would plait the priest's entrails,
For want of a rope, to strangle kings." - Diderot

Desktop
OS: Some Debian based crap I built (Openbox/XBMC) 64bit
Machine: A better than yours custom build.
AMD FX-8350 / 24 GB DDR3 RAM / GTX550 Ti / 60 GB SSD / ~12 TB HDD's

"Dead or alive, you're coming with me." - Robocop

warfacegod

  • Ubuntu Up Your Ass!
  • *
  • Offline Offline
  • Beanses: 30,212
  • Karma: +5/-48
  • Poison Tasting Your Beer Department
    • View Profile
    • Open Linux Forums Founder
Re: How To: Install nVidia drivers in Debian (Current kernels and drivers)
« Reply #10 on: December 08, 2013, 05:49:57 pm »
FYI:

I don't know what would happen if going from nouveau to nVidia drivers across different kernel versions like this. In other words nouveau and kernel 3.11 to nVidia and 3.12. I've no reason to believe what I've laid out in this tutorial wouldn't work. I only mention it because I've never done it.

I'll also point out that going from one kernel version to another will stop the nVidia driver from working in the first kernel. If, for whatever reason, you want to go back to your old kernel, you'll need to recompile the drivers again.
« Last Edit: December 08, 2013, 06:06:02 pm by warfacegod »
"And his hands would plait the priest's entrails,
For want of a rope, to strangle kings." - Diderot

Desktop
OS: Some Debian based crap I built (Openbox/XBMC) 64bit
Machine: A better than yours custom build.
AMD FX-8350 / 24 GB DDR3 RAM / GTX550 Ti / 60 GB SSD / ~12 TB HDD's

"Dead or alive, you're coming with me." - Robocop