[Armadillo.Tech ~]$

Linux: Installing GTX 10 Series Drivers On An Optimus Laptop

I bought a MSI GS43VR 7RE gaming laptop recently. I bought it thinking I could run Linux on it fairly easily. Unfortunately, it turned that MSI laptops and Linux are not always a good mix. The good news is that the hardware in this laptop is MOSTLY supported by drivers that are included with recent releases of Antergos, Mint, Ubuntu, and probably a few other Linux distributions as well.

The bad news here is that this laptop has an Nvidia Optimus setup. That means that it has both integrated Intel graphics and a discrete Nvidia graphics card. The idea behind Optimus is that it extends battery life by only using the more powerful (and less energy efficient) Nvidia graphics card when games and other GPU-intensive software are running. That wouldn’t be so much of a problem in a slightly older laptop from another more Linux-friendly brand.

Why is Nvidia Optimus a problem in this particular case? For whatever reason, the typical methods for getting Linux to work with Optimus simply don’t work on this machine. To make things worse, many Linux distributions refuse to boot out of the box! (Without a few tweaks, that is.) I wasted so much time just trying to figure out how to get Ubuntu and other distros to boot on this thing! Thankfully, I finally found a fix. The Nouveau driver, which is included in newer Linux distributions, is incompatible with GTX 10 series cards and simply needs to be disabled.


How to boot the Ubuntu installer with Nouveau disabled:

When GRUB loads from your install disk or flash drive, press e to edit GRUB’s boot options. Look for the part of the line that says quiet splash and change it to quiet splash nouveau.modeset=0

Once you have Ubuntu (or almost any other Linux distro) installed, you’ll have to do the above again when you boot from the laptop’s internal drive. Naturally, most people would get tired have having to do this every single time they turn a computer on. Guess what? There’s a fix for that too!

How to permanently add nouveau.modeset=0 to GRUB:

Open up a terminal and type sudo nano /etc/default/grub. The Nano text editor will open a very familiar-looking file. Look again for the part of the file that says “quiet splash” and change it to quiet splash nouveau.modeset=0. Once that is done, press ctrl+o to write the changes you made. Press ctrl+x to exit back to the terminal. The last step is to update GRUB’s configuration by typing sudo update-grub. Now would probably be a good time to reboot.

Ok, now Linux will boot just fine. Now we need to get some graphics drivers installed! As I said before, the open source Nouveau driver is incompatible with newer GTX 10 series graphics cards. This means we need to use the proprietary Nvidia graphics drivers. The latest Nvidia drivers are not available to Ubuntu, so you’ll also need to add the graphics drivers PPA first.

Add the graphics driver PPA:

Open a terminal. (Big surprise, right?) Type sudo add-apt-repository ppa:graphics-drivers/ppa. Press enter when it asks if you want to add the PPA. After that finishes, type sudo apt-get update and let it finish. (You can substitute apt for apt-get if you prefer.)

Install the proprietary Nvidia drivers and a few other necessities:

Open a terminal and type sudo apt-get install nvidia-384 nvidia-settings nvidia-prime Once driver installation completes, type sudo prime-select nvidia. This will make sure that the Nvidia drivers are loaded the next time the laptop starts. As usual, it’s time to reboot again!

Note: Nvidia-384 was the newest driver at the time of writing. Check the PPA to see what the newest version is at Launchpad.

You’ll probably notice that VSync (Vertical Sync) is not working when your laptop starts up. The good news is, this can be fixed! You have two different choices you can make at this point. You can do it without Bumblebee and reboot every time you want to switch graphics for gaming or power saving purposes. Alternatively, you can do it with Bumblebee. It does have a negligible gaming FPS loss but does not require restarting every time you want to play games.


Without Bumblebee

Fix screen tearing on Nvidia graphics:

Open a terminal and type sudo xrandr –output eDP-1-1 –set “PRIME Synchronization” 1. For other laptops, you will need to replace eDP-1-1 with the output that is actually being used for your monitor. Type xrandr –verbose in your terminal and look for the phrase “connected primary”. The name of your output will be to the left of this phrase. LVDS-1-1 is also a common output name.

Open up a terminal and type sudo nano /etc/default/grub. Look again for the part of the file that you edited earlier. Change quiet splash nouveau.modeset=0 to quiet splash nouveau.modeset=0 nvidia-drm.modeset=1 nvidia-384-drm.modeset= 1. (You will want to change the version number in nvidia-384-drm to the first 3 digits of the version number of the Nvidia drivers you installed.)

Once that is done, press ctrl+o to write the changes you made. Press ctrl+x to exit back to the terminal. Update GRUB’s configuration by typing “sudo update-grub”. Go ahead and reboot.

How to switch between Nvidia and Intel graphics:

You’ll want to open a terminal for either of these two scenarios:

-If you are running Intel graphics and want to switch to Nvidia graphics for gaming:

Type sudo prime-select nvidia and reboot when the command finishes.

-If you are running Nvidia graphics and want to switch to Intel graphics for energy savings:

Type sudo prime-select Intel and reboot when the command finishes.


With Bumblebee

Switch back to Intel graphics:

We need to switch back to Intel graphics in order to continue from here. Open a terminal window and type sudo prime-select Intel Reboot, and we will continue from there.

Install Bumblebee, Primus, and Mesa Utils:

Now that we are running on Intel graphics, open a terminal window and type sudo apt-get install bumblebee primus mesa-utils mesa-utils-extra Keep the window open for the next step.

Configure Bumblebee

Bumblebee is not configured out of the box to work with the version of the Nvidia drivers that we installed earlier, so let’s fix that. Open a terminal window and type sudo nano /etc/bumblebee/bumblebee.conf.

Look for the line starting with Driver= and set it to Driver=nvidia if it isn’t set that way already. In my case, it was on line 22 of the file. Note that we used nvidia instead of nvidia-384 here. This simply tells Bumblebee that we are using the proprietary Nvidia driver. It has nothing to do with the driver package name in this case.

We just have one last thing to take care of in the Bumblebee configuration file. Find the line starting with LibraryPath= and change every occurrence of nvidia to nvidia-384. Do the same for the line starting with XorgModulePath=. Now hit ctrl+o to save and ctrl+x to exit.

Fix your SSDT!

Unfortunately, newer laptops with Nvidia Optimus (especially those with GTX 10 series graphics) often have broken Linux support in their SSDTs. Medakk on GitHub wrote an excellent tutorial showing how to fix the issue, would quote it in this post, but it is a little long. You can find it in his comment here on Github. If it is no longer available for any reason, I am hosting a copy of it here on my blog.

Make sure to restart your computer before continuing any further!

Test Bumblebee

If all goes well after restarting, your machine should start back up without any issues. Now, let’s make sure Bumblebee is actually working! Open a terminal and type optirun glxgears -info to run a basic test. A small should pop up, showing a pair of spinning 3D gears.