This is a long-overdue blog post about how I install the latest & greatest Nvidia desktop drivers under Kubuntu (the same advice applies to Ubuntu too). The following guide has two major portions, the first is how to proceed at setting up your system to be able to compile & install the Nvidia drivers, which only needs to be done once, and the second section is how to complete the installation of a particular set of drivers. All instructions are run on a 64 bit version of Kubuntu 9.04, but there are no KDE specific ports, so the same basic steps should work on any flavor of Ubuntu.
Initial System Setup
To use restricted modules or not...
By default Kubuntu comes with restricted modules which actually have a proprietary Nvidia graphics driver. The problem is that this driver is generally the one that is current at the time the distro is released, but then will not be updated for another 6 months. Considering that I am writing this article on March 31st 2009 and Nvidia put out 5 driver updates this month alone, the default driver will become obsolete rather rapidly. If everything works great... hey, use the default, but you aren't reading this post because you like the defaults ;-)
The problem is in the linux-restricted-modules-generic and linux-restricted-modules-common and how Ubuntu packages third-party proprietary modules. On my desktop, the only proprietary kernel driver I need is the Nvidia driver... so I actually removed these packages and ALL of the proprietary modules went bye-bye, making it very easy to install my own version of Nvidia's drivers without Ubuntu interfering by trying to overwrite them.... if you are lucky enough to be in this situation where you don't need any other proprietary drivers, I suggest you apt-get remove linux-restricted-modules-common linux-restricted-modules-generic before proceeding with the rest of the process.
So why would it be a bad idea to remove the restricted modules? Well, it is the Ubuntu packager's all-or-nothing approach. Say you have a laptop and need to have a proprietary wireless network driver... you cannot simply remove the unwanted Nvidia driver and keep the wireless driver installed! It's either all the restricted drivers or none of them. Fortunately, there is a way to prevent the Ubuntu provided Nvidia driver from interfering with your own driver. This is an important step because if you do not follow it, you will end up with an installation of the new Nvidia driver that works perfectly fine... until you reboot and Ubuntu will automatically whomp your new driver with its own version and likely cause the X server to fail to load (I speak from personal experience here)
Here's the solution: edit (using sudo to get root permissions) the /etc/default/inux-restricted-modules-common file. We want to go to the bottom and edit the DISABLED_MODULES entry to look like this: DISABLED_MODULES="nv". Note: if you have other modules in that entry, leave them alone and simply add an additional "nv" to prevent Ubuntu from re-loading it's own Nvidia driver instead of the one you will be installing.
Setting up the build environment
Install Nvidia drivers does require some compiling, but don't worry, it is a (relatively) painless process. You do need to have a few packages installed so that the compilation process can succeed. The packages are:
- linux-headers-generic
- gcc
- make
- automake
- xserver-xorg-dev
- pkg-config
Some other packages may be installed to support these, but hopefully this should be sufficient (as I am an occasional developer, I have quite a few more development packages installed which sometimes means I don't know exact dependencies needed to make a package build).
Good news: Once you've made these updates, you have the basic system configuration needed to install the drivers, and you don't have to repeat the above steps to install new drivers!
Downloading & Installing a new Driver
Grabbing a New Driver
The best place I've found to check for new Nvidia drivers is not the Nvidia website (which is a pain to navigate) but instead the Linux forums at NVNews.net. They keep a sticky post to the most up to date drivers. For example, I have the (mostly) current 180.41 driver installed as of this writing. When you download a driver, especially for 64 bit users, it is important that you download the correct variant of the driver. For example, there are three distinct variants of the 180.41 driver: NVIDIA-Linux-x86_64-180.41-pkg0.run, NVIDIA-Linux-x86_64-180.41-pkg1.run, and NVIDIA-Linux-x86_64-180.41-pkg2.run. For my purposes I always download the largest available variant (usually the "2" package). Why? The other drivers will work OK, but come with fewer features, and on a 64 bit system the most important feature is that the "2" variant comes with 32-bit OpenGL compatibility libraries, while the other drivers do not. If you are like me and use WINE with games, the 32-bit compatibility libraries are a must-have or you won't be playing games. So, find the latest driver version & variant you want, and download the file to a safe place
Getting the driver installed
This is where the rubber meets the road.
- First, make sure the driver file is chmod'ed to be executable (for example): chmod 755 ./NVIDIA-Linux-x86_64-180.41-pkg2.run
- Next, we need to turn off the X-server and drop to a VT terminal command line. The drivers will not install if you try running from an X-term like Konsole, sorry. First, save any open files and logout to the KDM screen. Next, CTRL-ALT-F1 to the first VT (any one will do if you want to use another one). Finally, turning off X: sudo /etc/init.d/kdm stop Under normal situations this will kill X, but in case you have some straggling processes you may have to sudo pkill X manually.
- Finally: Run the package you downloaded as root: sudo ./NVIDIA-Linux-x86_64-180.41-pkg2.run The installer will walk you through the installation. When it prompts you to ftp down a kernel interface just say "no", otherwise it will (unsuccessfully) try to download an interface that takes some extra time. When it prompts you to compile a kernel module, make sure to say "yes" (this is why we installed the header files earlier). Finally, at the end the driver will ask to generate an xorg.conf file. The very first time you install the Nvidia driver, say YES since this file will be properly tweaked to use Nvidia's proprietary drivers instead of the open-source nv driver that you have likely been using already. On subsequent installations, you will generally not have to repeat this step and can safely say "no".
- At last! The only thing left to do is to restart X and see if it all worked. As an experiment, you can try sudo modprobe nvidia to make sure the module loads, although the module will auto-load when you restart the X server as well. Just type: sudo /etc/init.d/kdm start and the X desktop should reload with your shiny-new driver!
A few more caveats
There can still be the occasional hiccup, but the above process is how I've been updating Nvidia drivers for some time. Remember that the NVidia package comes with both a kernel driver, AND with user-level drivers that interface with x.org. So, sometimes (particularly when an Ubuntu distro is still in alpha/beta and is being updated frequently) the xorg server is upgraded in a way that whomps the Nvidia user-level drivers. You'll know it when it happens since Xorg will not come up cleanly and may either crash or put you into a 2D-only desktop. If this happens, just drop to a standard console VT, kill kdm/gdm if they are still running, and re-install the Nvidia drivers just as we did above. The Nvidia installer may warn you that drivers are already installed... just continue and let the drivers be re-installed to clean up any problems that the previous update caused. Once the distro becomes stable, these updates are very rare and should not be a big problem.
Conclusion
Well that's it! I hope this helps. As a KDE 4.2 user I've had to be on the cutting-edge of Nvidia drivers in order to get smooth graphics, and with the current drivers the problems of the past have been pretty much eliminated. I'm enjoying a very smooth, composited desktop with my 8800GT. If you have other issues with drivers, please leave a comment and I'll see what I can do.
My computer was attacked by a virus and when i bought it, i missed the drivers, so i needed to looking information by internet. Finally i reached an information that advised me download by the web. i was surprised. I hink all the information cotained in the blogs always result very useful. actually i found a site interesting called costa rica investment opportunities
ReplyDelete