How to Use PRIME for Hybrid Graphics (NVIDIA Optimus) on Arch Linux
Categories:
5 minute read
Hybrid graphics systems, commonly referred to as NVIDIA Optimus setups, are widespread in modern laptops. They combine the power efficiency of integrated Intel or AMD GPUs with the performance of dedicated NVIDIA graphics. However, managing these hybrid setups under Linux—especially Arch Linux—requires some manual configuration and understanding. This guide walks you through setting up and using NVIDIA PRIME on Arch Linux for optimal performance and power usage.
What is NVIDIA Optimus?
NVIDIA Optimus is a proprietary technology that allows a system to switch between an integrated GPU (iGPU) and a discrete NVIDIA GPU (dGPU) to balance power efficiency and graphics performance. On Windows, this switching is seamless, but on Linux, it requires specific configuration.
There are two primary methods of managing Optimus systems on Linux:
- PRIME Render Offloading – Runs applications on the discrete GPU while keeping the display rendered by the iGPU.
- PRIME GPU Offloading with Reverse PRIME – Uses the NVIDIA GPU for rendering and sends the output to the iGPU for display (Reverse PRIME).
Prerequisites
Before proceeding, ensure that you have:
- A laptop with a hybrid graphics system (Intel/AMD + NVIDIA).
- A working Arch Linux installation.
- A DE or WM using Xorg (Wayland support for PRIME is still experimental).
- Sudo privileges.
Step 1: Identify Your Graphics Setup
First, verify your graphics hardware:
lspci | grep -E "VGA|3D"
Example output:
00:02.0 VGA compatible controller: Intel Corporation UHD Graphics 630
01:00.0 3D controller: NVIDIA Corporation TU117M [GeForce GTX 1650 Mobile] (rev a1)
This confirms a hybrid setup with Intel (iGPU) and NVIDIA (dGPU).
Step 2: Install Necessary Packages
Install the proprietary NVIDIA driver and utilities:
sudo pacman -Syu nvidia nvidia-utils lib32-nvidia-utils
For laptops using an Intel iGPU, also install the Intel drivers:
sudo pacman -S xf86-video-intel
If you use an AMD iGPU:
sudo pacman -S xf86-video-amdgpu
You may also want tools for power management and GPU switching:
sudo pacman -S xorg-xrandr mesa-utils
Step 3: Configure Xorg for PRIME
Arch Linux uses dynamic X configuration, so minimal setup is required. Create or modify a file in /etc/X11/xorg.conf.d/
:
sudo nano /etc/X11/xorg.conf.d/10-nvidia-drm-outputclass.conf
Insert the following content:
Section "OutputClass"
Identifier "nvidia"
MatchDriver "nvidia-drm"
Driver "nvidia"
Option "AllowEmptyInitialConfiguration"
ModulePath "/usr/lib/nvidia/xorg"
ModulePath "/usr/lib/xorg/modules"
EndSection
This instructs Xorg to use the NVIDIA driver when needed, without taking over the entire display stack.
Step 4: Enable Kernel Modesetting (KMS)
Edit your kernel parameters to include NVIDIA DRM modesetting. Add this to your bootloader configuration:
For systemd-boot:
options nvidia_drm.modeset=1
For GRUB, edit /etc/default/grub
:
GRUB_CMDLINE_LINUX_DEFAULT="quiet splash nvidia_drm.modeset=1"
Then update GRUB:
sudo grub-mkconfig -o /boot/grub/grub.cfg
Step 5: Load NVIDIA Modules at Boot
Ensure NVIDIA modules are loaded at startup. Create or edit this file:
sudo nano /etc/mkinitcpio.conf
Add to the MODULES line:
MODULES=(nvidia nvidia_modeset nvidia_uvm nvidia_drm)
Rebuild initramfs:
sudo mkinitcpio -P
Step 6: Reboot and Test
Reboot your system:
sudo reboot
Then check if the drivers are loaded:
nvidia-smi
If you see GPU usage and processes, the NVIDIA driver is working correctly.
Step 7: Using PRIME Render Offloading
With PRIME Render Offloading, you run applications on the dGPU while keeping the desktop rendered by the iGPU. This approach saves power and is suitable for most workflows.
To launch an application on the NVIDIA GPU:
__NV_PRIME_RENDER_OFFLOAD=1 __GLX_VENDOR_LIBRARY_NAME=nvidia <application>
For example:
__NV_PRIME_RENDER_OFFLOAD=1 __GLX_VENDOR_LIBRARY_NAME=nvidia glxinfo | grep "OpenGL renderer"
Expected output:
OpenGL renderer string: NVIDIA GeForce GTX 1650/PCIe/SSE2
This confirms the app is using the discrete GPU.
You can also create custom launchers or .desktop
files to always run specific apps (e.g., games or CAD software) on the dGPU.
Step 8: Optional – Offloading with Environment Variables Wrapper
To simplify usage, create a wrapper script:
sudo nano /usr/local/bin/prime-run
Add the following:
#!/bin/bash
__NV_PRIME_RENDER_OFFLOAD=1 __GLX_VENDOR_LIBRARY_NAME=nvidia exec "$@"
Make it executable:
sudo chmod +x /usr/local/bin/prime-run
Now you can run:
prime-run <application>
Step 9: Power Management (Optional)
To save power, consider installing and configuring nvidia-prime
or bbswitch
alternatives like nvidia-offload
or systemd services
.
Using nvidia-suspend
sudo pacman -S nvidia-prime
Enable systemd hooks:
sudo systemctl enable nvidia-suspend.service nvidia-hibernate.service nvidia-resume.service
These services handle unloading the NVIDIA driver during suspend or hibernate to reduce power drain.
Using systemd
to unload GPU
Add a custom script to disable the NVIDIA GPU on boot if it’s not in use, but be cautious—this may break PRIME offloading if not handled properly.
Step 10: Troubleshooting
Black Screen After Boot?
- Check
nvidia_drm.modeset=1
is set correctly. - Ensure you’re using Xorg, not Wayland.
- Try removing the
/etc/X11/xorg.conf
if it exists.
PRIME Offloading Not Working?
- Verify with
glxinfo
whether the dGPU is used. - Ensure both NVIDIA and Intel drivers are installed.
- Check for typos in environment variable commands.
Poor Performance?
- Check if VSync is enabled via
nvidia-settings
. - Make sure no power-saving daemons are limiting performance.
Bonus: Full NVIDIA Mode (Reverse PRIME)
If you want to use the NVIDIA GPU for everything, including rendering the desktop:
Create a custom Xorg config in
/etc/X11/xorg.conf.d/
.Set NVIDIA as the primary GPU:
Section "ServerLayout"
Identifier "layout"
Screen 0 "nvidia"
Inactive "intel"
EndSection
Section "Device"
Identifier "nvidia"
Driver "nvidia"
BusID "PCI:1:0:0"
EndSection
Section "Screen"
Identifier "nvidia"
Device "nvidia"
Option "AllowEmptyInitialConfiguration" "true"
EndSection
- Restart your system.
This approach may increase performance but at the cost of higher power usage.
Conclusion
Setting up PRIME for hybrid graphics on Arch Linux takes a bit of effort but offers great flexibility. With PRIME Render Offloading, you can run demanding applications on the NVIDIA GPU while maintaining power efficiency for everyday tasks. Arch’s rolling nature and access to the latest drivers make it an ideal platform for experimenting with such advanced configurations.
Remember, with Linux, there’s always room to customize. Whether you choose dynamic offloading or a full NVIDIA setup, understanding how PRIME works gives you control over performance and power usage in your hybrid system.
Feedback
Was this page helpful?
Glad to hear it! Please tell us how we can improve.
Sorry to hear that. Please tell us how we can improve.