Nvidia Optimus on Ubuntu: PRIME, Bumblebee, and Troubleshooting

Nvidia Optimus on Ubuntu: PRIME, Bumblebee, and Troubleshooting

A comprehensive guide to getting Nvidia Optimus working on Ubuntu โ€” covering PRIME profiles, legacy Bumblebee setups, driver installation, and common debugging steps.

Tested on: Ubuntu 20.04 LTSUbuntu 22.04 LTSUbuntu 24.04 LTSXubuntuKubuntu

If you’ve bought a laptop with an Intel (or AMD) integrated GPU and a discrete Nvidia card, you’ve got an Optimus system โ€” and on Linux, that means you’ve got some work to do. This guide covers the full landscape of getting Nvidia Optimus working on Ubuntu: the modern PRIME offloading approach, the legacy Bumblebee context (and why you probably don’t need it anymore), driver installation through ubuntu-drivers and PPAs, and a detailed troubleshooting section for the black screens, login loops, and performance issues that make Optimus the single most asked-about hardware topic in the Ubuntu ecosystem. We’ve been wrestling with Optimus laptops since the technology launched, across ThinkPads, Dell XPS machines, and budget Acer boxes โ€” what follows is hard-won, tested knowledge. For broader hardware topics, our Hardware Guides hub covers printers, wireless, and more.

What Is Optimus and Why Is It Complex on Linux?

Nvidia Optimus is a hardware switching technology that lets a laptop use its power-efficient integrated GPU for light tasks (desktop, browsing, video) and fire up the power-hungry discrete Nvidia GPU only when demanding applications need it. On Windows, this is transparent โ€” the Nvidia driver handles switching automatically. On Linux, it has historically been anything but transparent.

The fundamental problem: the discrete Nvidia GPU renders frames, but on most Optimus laptops the display outputs are physically wired to the integrated GPU. The rendered frame has to be copied from one GPU to another before it reaches the screen. How that copy happens โ€” and who manages the switching โ€” has been the source of a decade of driver conflicts, kernel workarounds, and community projects. The Arch Wiki’s Optimus article provides an excellent technical history of the various approaches across distributions.

The good news: since roughly 2019, the situation has improved dramatically. But you need to know which approach applies to your hardware and Ubuntu version.

PRIME: The Modern Approach

PRIME is the name for the GPU switching framework built into both the Nvidia proprietary driver and the open-source nouveau driver (though you almost certainly want the proprietary driver for Optimus). On Ubuntu, PRIME support comes through the nvidia-prime package.

PRIME Profiles

After installing the Nvidia driver, you have three profiles:

nvidia โ€” everything runs on the discrete GPU. Maximum performance, maximum power consumption. The integrated GPU is disabled entirely.

sudo prime-select nvidia

intel โ€” everything runs on the integrated GPU. The Nvidia card is powered down. Best battery life.

sudo prime-select intel

on-demand โ€” both GPUs are active. Applications default to the integrated GPU; you explicitly launch GPU-intensive apps on the Nvidia card. This is the profile most laptop users want.

sudo prime-select on-demand

Switching between nvidia and intel profiles requires a logout or reboot. The on-demand profile doesn’t require switching because both GPUs remain available.

Running Applications on the Discrete GPU

In on-demand mode, you launch an application on the Nvidia GPU with environment variables:

__NV_PRIME_RENDER_OFFLOAD=1 __GLX_VENDOR_LIBRARY_NAME=nvidia glxgears

For Vulkan applications:

__NV_PRIME_RENDER_OFFLOAD=1 __VK_LAYER_NV_optimus=NVIDIA_only vulkan-app

Some desktop environments (GNOME on Ubuntu 22.04+, KDE Plasma 5.24+) add a “Launch using Discrete GPU” option to application right-click menus, which sets these variables automatically.

Checking the Active GPU

Verify your current profile:

prime-select query

Verify what’s actually rendering:

glxinfo | grep "OpenGL renderer"

If it says “Mesa Intel” you’re on the integrated GPU. If it says “NVIDIA GeForce” (or similar), the discrete card is active.

Bumblebee: Legacy Context

Before Nvidia added PRIME offloading support to their proprietary driver, the community built Bumblebee. It was clever: it used optirun or primusrun to launch applications on the Nvidia GPU and copied frames to the integrated GPU’s display using VirtualGL. It worked, and for several years it was the only viable option.

But Bumblebee had real limitations. The frame-copying mechanism added latency. Performance was significantly lower than native rendering โ€” some benchmarks showed 50-70% of the performance you’d get running the Nvidia GPU directly. Configuration was manual and fragile: a kernel update or driver change could break the setup with no obvious error message.

Bumblebee is effectively unmaintained. The project’s last meaningful update was years ago, and it conflicts with modern PRIME setups. If your Ubuntu version is 20.04 or newer and your GPU is supported by driver version 435+, use PRIME. We mention Bumblebee here because older forum posts and tutorials still reference it, and understanding the history helps you avoid following outdated advice.

Driver Installation

Ubuntu provides a straightforward tool for detecting and installing the right Nvidia driver:

ubuntu-drivers devices

This lists your GPU and the recommended driver version. Install the recommended driver:

sudo ubuntu-drivers autoinstall

Or install a specific version:

sudo apt install nvidia-driver-535

After installation, reboot. The driver should load automatically and prime-select becomes available.

The Additional Drivers GUI

For desktop users, open “Software & Updates” โ†’ “Additional Drivers” tab. It shows the same driver options in a graphical interface. Select the recommended proprietary driver, click “Apply Changes,” and reboot. This is the same mechanism as ubuntu-drivers under the hood.

When You Need the PPA

If your GPU is very new and the Ubuntu repository drivers don’t support it yet, the graphics-drivers PPA carries newer versions:

sudo add-apt-repository ppa:graphics-drivers/ppa
sudo apt update
ubuntu-drivers devices

Be cautious here. PPA drivers can conflict with Ubuntu’s packaged versions, especially during dist-upgrades. Only add the PPA if the repository driver genuinely doesn’t support your hardware.

Troubleshooting

Black Screen After Driver Install

This is the most common Optimus failure. You install the driver, reboot, and get a black screen โ€” sometimes with a blinking cursor, sometimes nothing at all.

Step 1: Boot into recovery mode (hold Shift during GRUB, select Advanced Options, then Recovery Mode).

Step 2: Check the Xorg log:

cat /var/log/Xorg.0.log | grep -E "(EE|WW)"

Step 3: Check kernel messages:

dmesg | grep -i nvidia

Common causes:

  • Secure Boot is blocking the unsigned Nvidia kernel module. Either sign the module using mokutil (Ubuntu’s driver installer usually prompts for this) or disable Secure Boot in BIOS.
  • DKMS failed to build the module for your current kernel. Run sudo dkms status to check, and sudo dkms autoinstall to rebuild.
  • Wrong Xorg configuration. The file /etc/X11/xorg.conf might point to a GPU that isn’t available in the current PRIME profile. Remove or rename it and let the driver auto-configure:
sudo mv /etc/X11/xorg.conf /etc/X11/xorg.conf.bak

Login Loop with GDM

You enter your password, the screen flickers, and you’re back at the login screen. This usually means the display manager can’t start a session on the configured GPU.

Check ~/.local/share/xorg/Xorg.0.log (the per-user Xorg log on Wayland-enabled systems) and /var/log/Xorg.0.log. Switching to a TTY (Ctrl+Alt+F3) lets you troubleshoot from the command line. Reinstalling the driver and reconfiguring PRIME often resolves it:

sudo apt install --reinstall nvidia-driver-535 nvidia-prime
sudo prime-select on-demand
sudo reboot

Low Performance Despite Nvidia Being Active

If glxinfo confirms the Nvidia renderer but performance is poor, check for power management issues:

cat /proc/driver/nvidia/gpus/0000:01:00.0/power

Some laptops aggressively throttle the discrete GPU unless the power profile is set correctly. The nvidia-smi tool shows clock speeds, temperature, and power draw โ€” a GPU running at base clock under load usually points to a thermal or power limit.

Common Pitfalls

Installing both Bumblebee and PRIME packages. These conflict directly. If you’ve ever had Bumblebee installed, fully purge it (sudo apt purge bumblebee* primus*) before setting up PRIME.

Skipping the reboot after driver installation. The Nvidia kernel module must be loaded, and the display server must restart with the new configuration. A reboot is not optional.

Forgetting initramfs updates. After installing or reinstalling Nvidia drivers, run sudo update-initramfs -u to ensure the early boot environment includes the correct modules. Most package installations trigger this automatically, but manual driver manipulation sometimes skips it.

Ignoring Secure Boot. On UEFI systems with Secure Boot enabled, unsigned kernel modules will not load. The Nvidia driver package on Ubuntu prompts you to set a MOK (Machine Owner Key) password during install โ€” don’t skip that step, and don’t forget the password, because you’ll need it on the next reboot to enroll the key in the UEFI firmware.

Mixing driver sources. Installing from the Ubuntu repository, then layering a PPA on top, then trying Nvidia’s .run installer from their website โ€” this creates an untangleable mess. Pick one source and stick with it. If you need to switch, completely purge the existing driver first.

Check the front matter of this page for internal links to related Ubuntu Portal content, including our hardware hub and CLI basics guide.

Frequently Asked Questions

How do I check which GPU is currently active?
Run prime-select query to see the current PRIME profile (nvidia, intel, or on-demand). To verify the active renderer, run glxinfo | grep ‘OpenGL renderer’ โ€” it will show the Intel or Nvidia string depending on what is driving the display.
Do I need to reboot after switching GPU profiles?
With prime-select, yes โ€” switching from intel to nvidia (or vice versa) requires a logout or reboot for the Xorg/Wayland session to restart with the new GPU. The on-demand profile does not require switching because both GPUs are available simultaneously.
Should I use the Nvidia PPA or the Ubuntu repository drivers?
For most users, the Ubuntu repository drivers (installed via ubuntu-drivers or the Additional Drivers GUI) are the right choice. They are tested against the Ubuntu kernel and Mesa stack. The Nvidia PPA (ppa:graphics-drivers/ppa) carries newer driver versions, which may be necessary for very recent GPU models, but mixing PPA drivers with Ubuntu’s packaged versions can cause dependency conflicts.
Why do I get a black screen after installing Nvidia drivers?
A black screen after driver install usually means the Nvidia kernel module did not load correctly, or the Xorg configuration points to the wrong GPU. Boot into recovery mode, check /var/log/Xorg.0.log and dmesg for errors. Common causes include Secure Boot blocking unsigned kernel modules (sign them with mokutil or disable Secure Boot) and missing DKMS rebuilds after a kernel update.
Is Bumblebee still worth using?
No. Bumblebee was a necessary workaround before Nvidia supported PRIME offloading in their proprietary driver. Since driver version 435 and Ubuntu 19.10, PRIME on-demand rendering handles the same use case natively with better performance. Bumblebee’s frame-copying approach (via VirtualGL) added latency and capped frame rates. Unless you are stuck on very old hardware with driver constraints, use PRIME instead.
How do I make a specific application use the Nvidia GPU in on-demand mode?
Set the environment variables before launching the application: __NV_PRIME_RENDER_OFFLOAD=1 __GLX_VENDOR_LIBRARY_NAME=nvidia command-here. For Vulkan applications, use __NV_PRIME_RENDER_OFFLOAD=1 __VK_LAYER_NV_optimus=NVIDIA_only command-here. Some desktop environments also provide right-click menu options to launch with the discrete GPU.