How to install Nvidia drivers in Linux
The hunt for gaming performance on Linux is a constant and ever-changing challenge. The market for discrete graphics cards has become dominated by the two graphics giants: Nvidia and Advanced Micro Devices (AMD).
This has meant the decision boils down to one simple question: Which company's graphics card do I buy? But once you delve deeper into the details this question becomes quite a complex one.
The answer will change depending on your price/performance preferance; your operating system; other components in your computer; and at times even where you live.
If you visit online forums for answers there's also a constant back and forth between fans of both AMD and Nvidia over which graphics card has the best price/performance ratio, has a longer useful life and which performs best in which popular game.
As Linux becomes more user-friendly and game developers add Linux support, the biggest question – outside of what physical card to buy – seems to be graphics driver performance. With varying levels of support for each platform, the performance of a graphics card will vary from OS to OS.
Going more in depth, let's start with Nvidia. Its Linux driver support is widely considered the best with consistent updates at almost the same frequency as Windows driver updates.
However, the caveat here is that its driver software isn't opensource, which leaves many Linux users frustrated or forced to compromise. AMD's driver support lags behind Nvidia in terms of gaming performance, but AMD's graphics driver support is friendlier to open-source, as it offers both a higher-performing, closed-source Catalyst driver and an opensource Radeon driver.
Intel, which offers integrated graphics processors on its newer processors, provides completely open-source drivers, although its integrated graphics chips are not powerful enough to compete with the dedicated graphics cards of AMD and Nvidia.
Although Nvidia only releases a proprietary GeForce driver, the Linux community has created its own open-source driver called nouveau. Unlike the AMD open-source driver which was helped along by AMD's release of specifications, the nouveau driver has been built almost entirely through reverse engineering.
To Nvidia's credit, it has recently begun helping nouveau development by releasing documentation and specifications. So to recap, Nvidia cards have both proprietary GeForce drivers and open-source nouveau drivers. AMD has proprietary Catalyst drivers and opensource Radeon drivers. Intel provides an open-source driver that's included in all Ubuntu installations.
Now that you have a brief overview of the drivers available, let's get to work installing the right one for you. First, we'll cover the installation of Nvidia's GeForce and nouveau drivers. We will be using the Ubuntu distribution (distro) for this tutorial, but these steps can be applied to any Linux platform with only minor modifications.
In Ubuntu, the nouveau driver is the default for any new user. In theory, it's a great feature because it's open-source. In practice, it's usable only for 2D graphics and may not work well, or at all, with newer Nvidia graphics cards and technologies. For 3D applications, such as games and modelling, it's usually recommended to stick to the Nvidia proprietary driver for the sake of performance and stability as well as support for Nvidia's latest graphics technologies, such as Nvidia HairWorks.
How to install Nvidia drivers in Linux
The nice thing about Nvidia's proprietary driver is that they are quite easy to install. First, make sure that your system is updated and Linux headers are installed.
To make sure they are, just use the following command in the terminal:
$ sudo apt-get install linux-headers-generic
Installing the Nvidia drivers can be done in three easy steps. First, install the drivers themselves with $ sudo apt-get install nvidia-current in a terminal.
The next step is more of a safety measure as there are cases when the Nvidia installation script doesn't run this command. This can lead to severe problems when the system reboots, so the solution here is just to run the command again separately: $ sudo nvidia-xconfig .
Finally, reboot your system using the reboot command to apply your changes. That's it! You should now be using Nvidia GeForce driver. The driver can be updated as you see fit by either running the command again or going to the Nvidia website and downloading and installing the new one.
We recommend sticking to running the command as there's less risk of a new driver causing unwanted problems on your system. However, it's important to note that you must remove the previous driver before installing the new one. The commands to do that are:
$ sudo apt-get remove nvidia* && sudo apt-get autoremove
Next, reboot and when you're back at the login screen press CTRL + Alt + F1 to switch to command console. Login here with your username and password. When you're at the text console, you'll have to kill the current graphics session by running $ sudo stop lightdm.
Finally, give permissions to the downloaded driver package and run it with:
cd /Downloads && chmod +x NVIDIA-Linux-*-346.35.run && sudo sh NVIDIA-Linux-*-361.42.run
From here, just follow the onscreen instructions and then reboot your computer. At next boot, run $ sudo nvidiaxconfig to save your new configuration. Optionally, you can also blacklist the nouveau driver to prevent it from installing itself during a system update or uninstall them completely.
If you want to do this, edit the following config file with:
$ gksudo gedit /etc/modprobe.d/blacklist-nouveau.conf
Once in the file, add the following lines at the end and save the file.
blacklist nouveau
blacklist lbm-nouveauoptions nouveau modeset=0
alias nouveau off
alias lbm-nouveau off
You can also choose to disable the kernel nouveau by running the following commands one by one:
$ echo options nouveau modeset=0 | sudo tee -a /etc/
modprobe.d/nouveau-kms.conf
$ sudo update-initramfs –u
And once you reboot you're done!
Graphics Drivers PPA
Another method that was recently developed is the introduction of the Graphics Drivers PPA, which can distribute the latest GeForce drivers to desktop users if you opt-in for it.
This method isn't completely devoid of errors, but can be much easier for the novice user to maintain and keep up to date with the best-performing drivers. To add the PPA and update drivers run the following commands in the terminal:
$ sudo add-apt-repository ppa:graphics-drivers/ppa
$ sudo apt-get update
If you ever run into an error due to a driver update, run the ppa-purge command to roll back the driver. The open-source nouveau driver can also be uninstalled after installing the GeForce drivers. However, this isn't necessary and therefore not recommended for most users.
If you still want to remove nouveau, enter the following command in the terminal:
$ sudo apt-get –purge remove xserver-xorg-video-nouveau
How to install AMD drivers in Linux
AMD drivers can be a little trickier depending on whether you want to use proprietary drivers or not. By default, Ubuntu uses the open-source Radeon drivers when it detects an AMD graphics card in the system.
These drivers are maintained by a team employed by AMD and are more up to speed than the Nvidia open-source drivers. In many games, you may not even notice a difference between the two. However, the closed-source Catalyst driver (also known as the fglrx driver) is made available for those who would like to use it.
To begin installation of the Catalyst driver, you have two options: First, you can go visit the AMD website and enter your graphic card details. If you're not sure which graphics card you are using, you can find out using this command at the terminal: $ lspci –vvnn | grep VGA.
Second, you can install the graphics driver via command line. Some Linux gamers prefer this method as it can be less prone to error, but we'll cover both.
Depending on the graphics card you're using, the AMD website will supply you with the appropriate driver version. However, if you're handed a legacy driver version (often the case with older cards), it may be better to stick with the opensource radeon driver, which tends to support older cards better.
We would recommend sticking with the open-source driver if you are using a graphics card older than the HD 6xxx series. Note: if you're switching from another graphics card, say from Nvidia, make sure to uninstall the driver for the previous card before proceeding.
To start a manual installation of Catalyst, you must make sure you have dh-make libraries installed. To do so, use the following command (Note: Catalyst (fglrx) isn't supported on Ubuntu 16.04. You're required to use the open source drivers):
$ sudo apt-get install dh-make dh-modaliases execstack libc6-i386 lib32gcc1
While still in the terminal, navigate to the folder where you downloaded the driver, and run the install package.
For Ubuntu 14.04:
$ sh amd-driver-installer-catalyst-13-4-x86.x86_64.run --buildpkg Ubuntu/trusty
For Ubuntu 12.04:
$ sh amd-driver-installer-catalyst-13-4-x86.x86_64.run --buildpkg Ubuntu/precise
In Ubuntu 12.04, a package manager window may open and install some dependencies, if they are required, and create three Deb packages.
To install the newly created .deb files, use $ sudo dpkg –i flgrx*.deb . After that, run $ sudo amdconfig –initial to configure the installation. After this command is finished, reboot the system. If all went well, the fglrx (Catalyst) driver will be installed and working on your system.
To confirm that the drivers are working open a terminal and type $ flgrxinfo. You should get terminal output that looks something similar to the following:
display: :0 screen: 0
OpenGL vendor string: Advanced Micro Devices, Inc.
OpenGL renderer string: AMD Radeon HD 6700 Series
OpenGL version string: 4.2.11733 Compatibility Profile
Context
If you need to make configuration changes via AMD Catalyst Control Center you can find it in the Application
menu or by using $ gksudo amdcccle.
Now that we've covered how to install a driver using downloaded drivers from AMD's website, let's cover how to install the drivers using Ubuntu repositories (repos) and the command line interface. The first thing we want to do is make a backup copy of the xorg.conf configuration file (if you have it) in case this ends up failing and we need to restore the previous version.
This file is where all of the configuration information for your input devices and output devices resides, such as video cards, monitors, keyboards and mice:
$ sudo cp /etc/X11/xorg.conf /etc/X11/xorg.conf.BAK
Next, you need to purge the current fglrx files and install the Linux generic headers (if you haven't already). Use the following two commands to complete these tasks and then reboot before proceeding to the next step.
$ sudo apt-get purge fglrx*
$ sudo apt-get install linux-headers-generic
After rebooting, install the drivers from the Ubuntu repos using the following commands.
For Ubuntu 12.04:
$ sudo apt-get install fglrx fglrx-amdcccle
For Ubuntu 14.04:
$ sudo apt-get install fglrx
Now this next step is very important so follow the details closely. Before rebooting, generate a new xorg.conf file. This absolutely must be done before rebooting or you will run into some massive headaches trying to fix this problem without being able to see anything on the screen. Use the following command to generate the file:
$ sudo amdconfig –adapter=all –initial
Now once you've completed this step, reboot and check the installation using the same fglrxinfo command we discussed earlier and check the output. After that, you are done. Congratulations, you are now running Catalyst drivers on your Linux system.
AMD troubleshooting
However you may see a message that looks like this:
Xlib: extension "XFree86-DRI" missing on display ":1.0
If you do, don't panic, as it doesn't necessarily indicate a major problem. However, just to be safe, in order to fix it, open the /etc/X11/xorg.conf file again and add the following line to Section: Module :
load "dri"
One other component you might want to enable is video hardware acceleration using your AMD graphics card. To do so you'll need to add four packages after installing the driver:
$ sudo apt-get install xvba-va-driver libva-glx1 libva-egl1 vainfo
To check that the packages have been installed correctly, you can use the $ sudo vainfo command and should get similar output to the following:
libva: VA-API version 0.32.0
Xlib: extension "XFree86-DRI" missing on display ":0".
libva: va_getDriverName() returns 0
libva: Trying to open /usr/lib/x86_64-linux-gnu/dri/fglrx_drv_
video.so
libva: va_openDriver() returns 0
vainfo: VA-API version: 0.32 (libva 1.0.15)
vainfo: Driver version: Splitted-Desktop Systems XvBA
backend for VA-API - 0.7.8
vainfo: Supported profile and entrypoints
VAProfileH264High : VAEntrypointVLD
VAProfileVC1Advanced : VAEntrypointVLD
We should briefly cover Intel's graphics driver for its range of integrated graphics. The open-source driver for Intel's chipsets comes as part of the xserver-xorg-video-intel driver package, which is installed on all Ubuntu systems by default, so there is no need to perform an installation with those.
However, if they aren't there for whatever reason, you simply need to run the following command to install them again:
$ sudo apt-get install xserver-xorg-video-intel
Remember that many of these methods are not completely foolproof, so always backup your xorg.conf file before beginning any driver changes. There are some methods safer than others, yet some can be riskier yet provide more freedom in your installation.
You should assess the risks and benefits of each method and decide which method of installation and which driver in particular suits your preferences and needs as well as the unique nature of your personal Linux system setup. Although we've mainly covered Ubuntu installations in this tutorial, these methods are somewhat adaptable to other Linux distributions as well, but we'd encourage you to read the documentation of your particular distro before proceeding.
More troubleshooting tips
If your driver installation failed for whatever reason and your computer will no longer boot, there's a fix in recovery mode available that can help. While turning on the system, press the escape button at the Grub bootloader, and choose 'recovery mode' for your kernel.
Drop down to 'root shell' and run the ATI uninstaller using the following commands. Note, don't mistype any of them as they could break your system, especially the rm –rf command.
$ cd /usr/share/ati/
$ sh ./fglrx-uninstall.sh
$ cd
$ rm -rf /etc/ati/
$ apt-get remove -purge xorg-driver-fglrx fglrxamdcccle
Next, run the following command to restore your xorg.conf file to its default settings:
$ dpkg-reconfigure -phigh xserver-xorg
Now your computer should be able to boot with the default radeon drivers the next time that you boot up. If it doesn't, open the xorg.conf file using a file editor such as vi or nano and where it says Device make sure the driver field says 'radeon'.
That should cover about all of the main methods of graphics driver installation on Linux. Whichever path you end up choosing, each has its own merits. The wonderful thing about Linux is you have choice, whether it be in how you set up your desktop or which video drivers you choose.
The world of Linux gaming is expanding rapidly, and there may come a day soon where you will not need a Windows machine to play all of the latest games. Until then, we hope this guide allows you to, at least, get started and enjoy the hundreds of titles that are supported.
- Enjoyed this article? Expand your knowledge of Linux, get more from your code, and discover the latest open source developments inside Linux Format. Read our sampler today and take advantage of the offer inside.
from Techradar - All the latest technology news http://www.techradar.com/1327223
No comments:
Post a Comment