Home page of this blog

Tuesday, February 22, 2011

Installing latest nvidia driver in Ubuntu Lucid using APT Pinning

Disclaimer: This is a risky upgrade technique, follow only if you love to take risks and enjoy the benefit of risks. If it fails, you may have to reinstall the entire operating system


In this experiment I will try to explain, how I used apt pinning to install latest nvidia drivers from Ubuntu Natty inside Ubuntu Lucid. I wanted to use X Updates PPA but unfortunately, it is always pulling the beta versions of nvidia drivers (270.x when I last saw)

This apt pinning will use the debian trick of pinning upcoming versions of the distribution to pull the packages which we like

see the following links


Initial steps

Install the restricted nvidia drivers in lucid using Hardware drivers tool. This step is most important. By default Ubuntu Lucid will offer to install 195.36.x version of nvidia drivers. After installing this nvidia drivers, ensure Ubuntu works fine, that is we are able to boot into graphical mode

Addding entry for packages of natty in /etc/apt/sources.list

In the last line of /etc/apt/sources.list add entry to natty mirror.

To open the sources.list in editable mode, open it as root

sudo vi /etc/apt/sources.list

move to the last line and append

deb http://in.archive.ubuntu.com/ubuntu/ natty main restricted universe multiverse

As you can see, I have given in.archive.com as Ubuntu points to Indian mirror in my system. You should change it to appropriate mirror of your region for blazing fast updates

Very important, do not run apt-get update after this step, there is an even more important step, which is giving low priority to natty packages in Lucid installation, which is explained in following

APT Pinning natty packages with lower priority

Create a new file  /etc/apt/preferences as root

To do that I am using, sudo vi /etc/apt/preferences

and add the following three lines (If already you have a preferences file, do not worry, just append these three lines for giving natty packages a priority compared to current distribution packages)

Package: *
Pin: release a=natty
Pin-Priority: 400

First line Package: * tells apt to treat all packages, which is meant by asterik *
Second line tells the release name which we want to pin
Third line gives a priority value of 400 for all natty packages. Default priority is 500 and giving 400 to natty makes sure update manager does not inadvertently update to natty packages

Now after saving this file, run apt-get update

sudo apt-get update

You should not be offered to dist upgrade or upgrade to natty packages. If you are being offered lots of updates or offered to do dist upgrade, remove the entry for natty from /etc/apt/sources.list (the last line we added in /etc/apt/sources.list) and re run apt-get update to avoid inadvertent upgrade

Use Synaptic or APT to upgrade packages selectively to natty

This step can be achieved via a single apt-get or via synaptic, I try to explain both

Via synaptic

This step is tricky when using synaptic because many packages can't be upgraded to natty as is due to nested dependencies. For nvidia the most important package to be upgraded is nvidia-current and libvdpau1

Search and select nvidia-current in synaptic and press Ctrl + E and select the version from natty, 

see the screenshot to understand when I meant

Repeat this selective upgrade for libvdpau1, nvidia-185-kernel-source and nvidia-185-libvdpau

Press apply and synaptic will take care of upgrading the selected package to versions to natty

Via apt-get

This step is easier via apt-get

sudo apt-get install -t natty nvidia-185-kernel-source nvidia-185-libvdpau nvidia-current libvdpau1

See the -t natty which specifies apt-get to look for the packages from natty distribution

If suppose apt-get asks you to upgrade lots of packages, do not do, it might be a full upgrade to natty, just stop as is and recheck preferences file


Now reboot to see if the nvidia card is upgraded to the version of natty

See the screenshots below which shows my nvidia-settings showing the latest nvidia versions running from natty inside lucid

System monitor  + nvidia settings screenshot, which shows I am running lucid but latest nvidia drivers!!


  1. Hello,

    Thanks for the post, I tried to test it on a VirtualBox VM on Lucid (before applying it on my PC) but I got this error :

    Reading package lists... Error!
    E: Dynamic MMap ran out of room. Please increase the size of APT::Cache-Limit. Current value: 25165824. (man 5 apt.conf)
    E: Error occurred while processing frogatto (NewVersion1)
    E: Problem with MergeList /var/lib/apt/lists/in.archive.ubuntu.com_ubuntu_dists_natty_multiverse_binary-i386_Packages
    W: Unable to munmap
    E: The package lists or status file could not be parsed or opened.

    Do you know how to resolve it ?

  2. Increase APT cache limit

    the file to edit is /etc/apt/apt.conf

    APT::Cache-Limit "50331648";