Getting Pascal GPU's to Work on Linux
- 7 minsI’ve been running ubuntu on computers with discrete GPU’s for a few years now. Not ONCE has it ever been easy. The problem is that the Ubuntu default Nouveau drivers require time to update compatibility, and Nvidia drivers hate working with/disabling Nouveau. Given my itch to have the latest and greatest laptop hardware for the past few years I’ve had to deal with hacking away at the kernel/nouveau and nvidia beta drivers to get linux running on my various devices. Compatibility is generally introduced in kernel updates a couple months after the release of new hardware, but ain’t nobody got time for that.
Around a month or so ago, after a friend at facebook gifted me an Oculus Rift; as a result I decided to build my own computer. I bought the new Nvidia GTX 1080 and a month later also purchased the new Pascal Titan X (or Titan XP, thanks linustechtips) and decided to dual boot Ubuntu 16.04 because I thought it’d be interesting to test CUDA benchmarks with the new GPU’s. I also failed to find anyone post anything about their success or even failure with trying to run the GPU’s on linux.
After hours of failure getting the beta linux drivers from BOTH the PPA and the official Nvidia website link to work with my install I finally found a method that I think works 100% of the time when getting Ubuntu to work with dGPUs.
How to get new GPU's working with Ubuntu
Note: the following steps expect a fresh Ubuntu install. If you’re trying to trouble shoot after installing, getting this to work would require at least being able to boot to TTY which may not be garunteed for certain installs. The basic framework is as follows:
- Install Ubuntu: to boot into the installer edit the boot parameters and add nomodeset before quiet splash
- Boot into Ubuntu with nomodeset, run ALL updates and connect to the internet
- (Optional) Restart the system, add nomodeset again, download the latest kernel and upgrade the kernel
- Restart the computer, same setup with nomodeset, add the graphics PPA, then logout
- Switch to TTY, login and stop the desktop envrionment service (gdm or lightdm depending on your OS)
- Purge the nouveau driver
- Install latest nvidia driver
nvidia-###
- Reboot to your OS
These are the basics steps detailed tutorial below.
0. Installing Ubuntu
The steps to installing ubuntu vary based off of your needs. In my case I generally skip the preset options for installation and click “something else” where I can add my own partition scheme. I prefer to create a partition for /
and /home
generally alloting 30-50 gigs for / and the rest for /home on the drive. My tutorial assumes you’ve got a live disk of your chosen distro (personall running Gnome 16.04 because the UI is fantastic).
1. Booting into the Live Disk
In order to boot into the live disk for the install you need to highlight the “Intall Ubuntu” option at the live disk grub menu and type e to edit the commands and add nomodeset
right after “quiet splash”, I also recommend changing quiet splash to noquiet nosplash
but that’s optional
2. Boot into Ubuntu
After the install you should see the regular grub menu, once the grub menu appears type “e” again to edit the boot commands and type nomodeset as in step 1. Nomodeset is neccesary at boot because it disables certain video drivers which may fail with newer GPU’s.
Once logged in, connect to the internet and open up a terminal window and run: sudo apt-get update
, sudo apt-get upgrade
, and sudo apt-get dist-upgrade
. Some people tend to add &&
and -y
but I don’t really mind so I do them one at a time in case there are errors.
Lastly reboot the system and use nomodeset to login again. At this point you’re an expert at adding nomodeset to the boot commands so just assume anytime there is a reboot (unless otherwise stated) just add nomodeset to boot.
2.a (Optional) Kernel Update
I like to run the latest RC kernel because there’s generally better compatibility with new hardware but it’s not neccesarily 100% stable. More like 98% stable in my experience. Given the new hardware I atleast recommend preforming a kernel update to the latest kernel (non RC) to be safe but it’s optional.
Click here to see the latest kernel builds:
- From the link above find the folder for the latest kernel (in my case at the time of writing this is 4.8-rc6 but 4.7 is the latest final release)
- Depending on your distribution download 3 deb files for your distro. In my case I am running generic linux (default) and need the following deb files:
linux-headers-4.8.0-040800rc6_4.8.0-040800rc6.201609121119_all.deb linux-headers-4.8.0-040800rc6-generic_4.8.0-040800rc6.201609121119_amd64.deb linux-image-4.8.0-040800rc6-generic_4.8.0-040800rc6.201609121119_amd64.deb
- Move the files to an empty folder, open terminal and cd to that folder
- In order to install the kernels type:
sudo dpkg -i *.deb
which will install each of the deb files you downloaded - After completing the install restart the computer and login
3.Add the Graphics PPA
Open terminal and type sudo add-apt-repository ppa:graphics-drivers/ppa
then run sudo apt-get update
.
4. Logout and Remove Nouveau
Some people say removing nouveau isn’t neccesary, but in my experience it causes more problems when disabled and tends to restart itself during updates. As a result I recommend removing nouveau. In order to remove nouveau, disbale the desktop environment, and install the graphics drivers do the following:
- Logout of your account and at the login screen type CTRL+ALT+F1 to switch to "tty1"
- Type your username and password into the console to login to your account
- Depedning on your desktop environment, type either
sudo service gdm stop
orsudo service lightdm stop
to disable the desktop envrionment - Next remove nouveau with by typing:
sudo apt-get --purge remove xserver-xorg-video-nouveau
- Now that nouveau is removed, we can go ahead and install the latest nvidia driver by typing
sudo apt-get intall nvidia-
and pressing TAB to see the drivers available - In my case the latest driver (highest number after nvidia-) was "nvidia-370" so I installed the driver by typing
sudo apt-get intall nvidia-370
5. Reboot the OS and Test
The final step is to type sudo reboot-
to restart the computer. This time you do not need to type nomodeset at the grub menu. If all goes well you should be able to boot into the OS without any problems.
So far I have been able to successfully run the latest nvidia GPUs on the following systems multiple times with these steps:
Desktops:
Motherboard | Proccessor | GPU |
---|---|---|
Asus Maximus VIII Gene | i7 6700k | Titan XP |
Asus Z170 Pro Gaming | i7 6700 | GTX 1080 and 1070 |
Gigabyte Z170 Wifi | i5 6600k | GTX 1070 |
Laptops: Dell XPS 15 9550, Surface Book w. DGPU (both of these needed additional tweaks to install and run a dual boot but the graphics card install was identical)
If the install fails I recommend the following trouble-shooting steps:
- If you get the login screen but can't get the desktop, swithc to TTY and check the permissions of the .Xauthority file in your home folder
- If you're getting a flickering screen and no login screen, switch to TTY and try to stop the display manager and repair the install there