5

Every so often there's a beta version of the Nvidia driver that I want to try out. This has happened today: there's been a big performance issue with version 295.40 and I want to try the shiny new XRandR-enabled 302.07.

I'm more than able to download the installer, remove all the repo-installed driver files and install the new version but it's frankly a pain in the bottom to turn that around and go back to the repo version. It also means I have to re-install the driver manually each time there's a Kernel upgrade.

The other option we commonly give people is a PPA but in this case I'm being really impatient. It's going to be a few days before any PPA gets this but I need to try this today. I've already manually installed it on the media centre and I'm eyeing up my desktop now.

So how do I take an installer (eg: NVIDIA-Linux-x86-302.07.run) and convert that into a new nvidia-current/nvidia-current-updates package?

Another way of asking this might be: How do people package the Nvidia drivers?

3 Answers 3

6

Unless there are structural differences i the new version it should be possible to re-use the current packaging:

NEWVERSION=302.13
DIR=nvidia-graphics-drivers-"$NEWVERSION".orig/
## Making a new tarball
mkdir $DIR
# Copy in new run files
cp NVIDIA*.run $DIR
tar --owner=root --group=src -caf nvidia-graphics-drivers_"$NEWVERSION".orig.tar.gz $DIR
rm -r $DIR

## Setting up the packaging source
apt-get source nvidia-graphics-drivers
cd nvidia-graphics-drivers*/
# Remove old run files and copy in new
rm NVIDIA*.run
cp ../NVIDIA*.run .
# This version number should ensure it gets replaced by official version...
dch -v $VERSION-1 "my release"; dch -l~mybuild "local build"; dch -r

## Installing build-dependencies
mk-build-deps
sudo dpkg -i nvidia-graphics-drivers-build-deps*.deb; apt-get install -f

## Building
debuild -us -uc

Something like that might work, there's quite a bit of mucking around, which I guess is why PPA packages don't get released instantly ;)

4
  • Packaging new versions can be a tiny bit crazy, indeed. Especially when you change the upstream version number and dont reflect that in the debian control/changelog files. That's why it can sometimes take a tiny bit to build the packages. As well, PPAs have build scores that determine how priority-wise a package gets built in, since all PPAs use the same builder(s).
    – Thomas Ward
    Commented Jun 13, 2012 at 12:42
  • apt-get source accepts options like --diff-only which save you from downloading a useless 75MiB .orig.tar.gz file. See my answer
    – Lekensteyn
    Commented Nov 18, 2012 at 10:46
  • Good point about the --diff-only. I think instructions like these are going to be outdated pretty quickly as well (e.g. the packaging change with XvMCConfig you mentioned in your answer). Your version is a bit more robust in that sense I'm guessing, since it's more explanatory. Though as always, the most robust would be to point at Debian new-maint and policy :)
    – arand
    Commented Nov 18, 2012 at 12:47
  • As stated in debian/nvidia-current.README.Debian you should run debclean before running debuild to update neccessary variables. Edit: debuild seems to run debclean automatically, so this seems to be not neccessary.
    – Axel
    Commented Jan 9, 2013 at 11:50
2

As arand said, you can use the existing source packages assuming that it has not changed too much. The below commands will download a .run file, retrieve and adapt existing source files and finally package it.

Prepare for installation by installing some build dependencies:

sudo apt-get build-dep nvidia-graphics-drivers
sudo apt-get install execstack # needed but not included with build-deps

To prepare, set some variables that control the files being downloaded and create a new directory for it:

VER=310.19
mkdir nvidia-graphics-drivers-$VER; cd nvidia-graphics-drivers-$VER

Download the file named like NVIDIA-Linux-x86-310.19.run if you have not already. If you have a 64-bit machine, you should also download the 64-bit installer which is named like NVIDIA-Linux-x86_64-310.19-no-compat32.run:

wget ftp://download.nvidia.com/XFree86/Linux-x86/$VER/NVIDIA-Linux-x86-$VER.run
wget ftp://download.nvidia.com/XFree86/Linux-x86_64/$VER/NVIDIA-Linux-x86_64-$VER-no-compat32.run

Now retrieve the packaging files, "extract" it, change the version number and build the package without signing it:

apt-get source --diff-only nvidia-current
gunzip -c *.diff.gz | patch -p1
dch -v $VER-0~local "New upstream release."

Now, at the time of this writing, version 295.40-0ubuntu1.1 does not build 310.19 because the packaging has changed. It turns out that libXvMCNvidia.* files have been removed, so let's delete those lines including XvMCConfig:

sed -i '/XvMC/d' debian/{*.links*.in,*.install.in,rules}

Build the package:

dpkg-buildpackage -b -uc -us

If all went well, you should now be able to install the resulting deb file with:

sudo dpkg -i ../nvidia-current_$VER-*.deb; sudo apt-get install -f

(the sudo apt-get install -f command is optional if you have installed nvidia-current before, and do not run into dependency issues)

0

These drivers actually depend on newer kernels etc, so in this case you may not be able to just recompile - for a full description including PPAs see this answer

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .