Configuring Optimus (Intel & NVIDIA) GPU  under Ubuntu can be quite difficult. This guide aims to help you configure Ubuntu on a laptop which has a dual GPU. (Optimus technology).

Before Ubuntu 19.04 its was possible to use bumblebee however configuring bumblebee has become quite impossible in Ubuntu 19.04. Until now I have not got it working.

When you have a machine with a dual GPU, Ubuntu will after installation set the discrete GPU (NVIDIA) card as the default. This will have a negative impact on your battery life.

So is it possible to switch between cards... ? Yes, its possible. During my installation process I've opted to install third-party and proprietary software. So my laptop was using the official NVIDIA driver out-of-the-box.

First check the graphics cards you have.

lspci -k | grep -A 2 -i "VGA\|3D"
00:02.0 VGA compatible controller: Intel Corporation HD Graphics 630 (rev 04)
	Subsystem: CLEVO/KAPOK Computer HD Graphics 630
	Kernel driver in use: i915
--
01:00.0 3D controller: NVIDIA Corporation GP107M [GeForce GTX 1050 Ti Mobile] (rev a1)
	Subsystem: CLEVO/KAPOK Computer GP107M [GeForce GTX 1050 Ti Mobile]
	Kernel modules: nvidiafb, nouveau, nvidia_drm, nvidia

Next check which graphics card is currently active, go to System Settings -> Details, there you will see which card is currently in use.

Install and configure the proprietary NVIDIA driver. Start Software & Updates from the start menu. Go to the tab Additional Drivers Select the highest version for your NVIDIA card, and click Apply Changes.

In the newest version of Ubuntu switching card is done with NVIDIA PRIME. After installing the driver, you might need to reboot before PRIME support is enabled.

Switch Cards

There are two ways of switching between card, either by using the Nvidia X Server Setttings application or through command line.

In Nvidia X Server settings There is an option list item called PRIME Profiles. Here you can select which card to be active.

Through commandline this can be done with the following command.

sudo prime-select {CARD}  

Replace {CARD} with either nvidia or intel.

You can also check which card is currently active with:

prime-select query
NOTE: When you switch PRIME profile you must restart you desktop session. Either by logging out and logging in again.

From the command line you can logout with the command
gnome-session-quit --logout --force

After restarting your GUI session you can check System Settings -> Details to verify your selected card is active.

GNOME Extensions

If you want to be able to switch directly from your status bar, check out my GNOME extensions post.


I hope this guide was helpful, if you have any comments, ideas for improving this guide. Please let me know.

If you found this post useful, subscribe to this blog.