[HowTo] Set up PRIME with NVIDIA proprietary driver



The latest versions of Xorg, kernel, and NVIDIA driver all support PRIME output but setting this up is a bit of a faff. What follows is a method to get this working on an Optimus-enabled laptop.

Note: Fermi-based GPUs should use nvidia-390xx instead of nvidia.

Method Advantages Disadvantages
bumblebee, using “render offload” Uses the dGPU only when requested, allows power saving, is the Manjaro default Some overhead so lower raw performance
PRIME, using “output offload” Uses the dGPU directly, better raw performance dGPU and iGPU both powered on constantly, needs manual configuration
optimus-manager Easy switch between iGPU and dGPU usage Very much pre-release and under rapid development

Note: The easiest way to switch to the dGPU is to disable the iGPU in your BIOS. If that option is available all of this is unnecessary and you can just go ahead and use the NVIDIA driver.

Note 2: While the package optimus-manager offers a semi-automated way of switching configuration between iGPU and dGPU, as of 2018-12-15T00:00:00Z it is still under heavy development.

Disclaimer: NVIDIA’s support for Optimus under Linux is a right mess. There are many different hardware configurations so while this approach works for many it may not work for you. Read the Arch wiki for some options.

Step 1: remove bumblebee

If you installed with the non-free driver option mhwd will have set up bumblebee for you. This will get in the way so the first step is to remove it. Use the mhwd command-line or simply remove it via Manjaro Settings Manager.

Step 2: install the NVIDIA driver

Use mhwd or MSM to install the nvidia driver in the normal way.

Step 3: break fix mhwd's configuration

mhwd does the sensible thing and puts configuration in place as though the NVIDIA GPU was the only device available. We need to change this setup so PRIME will work.

Step 3.1: set up a new Xorg configuration

Firstly, remove /etc/X11/xorg.conf.d/90-mhwd.conf and replace it with:

Section "Module"
    Load "modesetting"

Section "Device"
    Identifier "nvidia"
    Driver "nvidia"
    BusID "PCI:1:0:0"
    Option "AllowEmptyInitialConfiguration"

While the BusID value above should be correct for most Optimus laptops you should check your values with lspci | grep -E "VGA|3D" .

Step 3.2: Refine blacklisting

PRIME relies on nvidia-drm and mhwd puts it in a blacklist by default, but to ensure the nvidia kernel module will load we still need to blacklist certain other modules. Therefore, you’ll have to do some editing of the files in /etc/modprobe.d.

To remove the existing blacklist, edit, move or remove any related mhwd-* files in /etc/modprobe.d/, e.g.

ls /etc/modprobe.d/mhwd*
sudo rm /etc/modprobe.d/mhwd-gpu.conf
sudo rm /etc/modprobe.d/mhwd-nvidia.conf

The end result must include a blacklist of the following modules, e.g. in /etc/modprobe.d/nvidia.conf:

blacklist nouveau
blacklist nvidiafb
blacklist rivafb

Step 4: enable nvidia-drm.modeset

Create a new file,

options nvidia_drm modeset=1

Step 5: Set the output source for your DM.

This is the most complicated part and the one which will take longest to get right. If you reboot now, your DM will load but display on the wrong output; the laptop display will be entirely blank (powered off).

We need to set a startup script to load the correct settings while the DM is loading.


Create a new file with the following content:


xrandr --setprovideroutputsource modesetting NVIDIA-0
xrandr --auto

Make sure to set it world read-execute, chmod a+rx /usr/local/bin/optimus.sh.

Now you have to get this to load in LightDM’s startup sequence, so edit /etc/lightdm/lightdm.conf and set this at the [Seat:*] section



Create a new file,

[Desktop Entry]
Exec=sh -c "xrandr --setprovideroutputsource modesetting NVIDIA-0; xrandr --auto"

Or using the above script,

[Desktop Entry]

and link it into place so it starts with GDM and on login

sudo ln -s /usr/local/share/optimus.desktop /usr/share/gdm/greeter/autostart/optimus.desktop
sudo ln -s /usr/local/share/optimus.desktop /etc/xdg/autostart/optimus.desktop

You’ll also have to use X, not Wayland.


Create a new file,


xrandr --setprovideroutputsource modesetting NVIDIA-0
xrandr --auto

Step 6: reboot

If everything is set correctly, when you reboot your DM will load, you can log in, and:

$ glxinfo | grep -i vendor
server glx vendor string: NVIDIA Corporation
client glx vendor string: NVIDIA Corporation
OpenGL vendor string: NVIDIA Corporation

Hooray! You’re running X via the dGPU not the iGPU!

If you have multiple displays you may have to configure their layout again in the normal way.

References and reading

Impossible to boot after installing Nvidia drivers (gtx1060 laptop)
Nvidia non-free driver prevents me from loading Manjaro
Performance regression with NVIDIA 390.25
GNOME freezing waking up from suspend, now even after restart GUI wont start
KMail corrupt after upgrades
Issues Installing Proprietary Nvidia drivers
Using Only Nividia Card on Optimus System
HDMI port not working on Dell Inspiron 7567
No display after installation on Nvidia drivers
How do I use only nvidia and not use intel graphics?
Hardware configuration hangs out
Trying to understand my setup
Nvidia Drivers with Intel Integrated Graphics - Current Status?
HDMI port not recognized on Acer Nitro V
Extreme difficulties with GTX 1050ti/intel 630 hybrid graphics [SOLVED]
Trying to understand my setup
Manjaro KDE and Nvidia
Cannot enable nvidia gpu for bumblebee XPS 15 9550
Poweroff doesn't work after install
Manjaro KDE works perfectly live but freezes once installed
940MX Geforce Nvidia
Manjaro Deepin on an Asus FX504G laptop
Dual monitors Nvidia graphics (not Nouveau)
No possibility to get Nvidia GT 610M working
Manjaro boot stuck at 'started Network Manager script dispatcher service'
Bumblebee fullscreen problem
NVIDIA driver not working properly (+ poor rendering performance in Chrome)
Manjaro 2018 / Can't detect HDMI cable for another monitor
I3 Manjaro - unable to detect secondary monitor
Manjaro Wiki sanitization - report dangerously outdated articles here!
Acer V5 573G Default PrtScSysRq Screenshot Error
KDE + NVidia lag and jankiness (Solved)
Your 2019 hopes for and from Manjaro?
After install video-nvidia manjaro can't boot
Free or non free for Nvidia GTX960?
NVIDIA Driver disappears after roboot
Installing nvidia and intel driver problem
After install video-nvidia manjaro can't boot
Unable to detect GPU - Dell XPS 9570
Optirun problem on Manjaro KDE
CSGO is Not working on Nvidia Bumblebee (Only Getting 30 fps)
Manjaro KDE after update Black screen
Nvidia Prime vs Optimus-manager
Unable to detect second display
Low resolution after update
Low resolution after update
NVIDIA GeForce GTX 1060 not starting on Dell G5 laptop
Can't make Manjaro boot with bumblebee drivers in HP Omen 15-DC0053la
Lenovo Ideapad 330-17IKB randomly freezes
Artifact card game on dedicated graphics
[bumblebee, opti/primusrun] error: [XORG] (EE) kbd: <default keyboard>: failed to set us as foreground pgrp (Inappropriate ioctl for device)
Where to find resources for newbies?
Where to find resources for newbies?
Nvidia prime leads to black screen
Nvidia prime leads to black screen
[SOLVED] Issue with Nvidia Graphics
Hardware Detection Issue
XCOM 2 not using NVIDIA Drivers
Dell XPS 15 9570 with PRIME -> OS Freezes on wake up
Hardware Detection Issue
How to install nvidia drivers only?
How to install nvidia drivers only?
Unable to boot into system after installation
Optimus setup with nouveau works perfectly on live ISO but doesn't work on a fresh installation
Cannot install Manjaro with the "nonfree" driver option
Subpar browser experience
Second monitor does not work Alienware 13 i3 nvidia / intel
Dell XPS 15 (9550) Suspend to ram once; but not a second time
Multiple monitor dual gpu issues
Dell G7 i7 w GTX1060 6gb
Enabling GPU in Steam Games - Crash on Startup
Need help with my laptop's recovery and driver installation
Dell G7 i7 w GTX1060 6gb
Issues setting up PRIME on a laptop
Random crashes w/flickering black bars
Bad Hardware Support for new devices (laptops) and nVidia cards (mobile variant)
Nvidia proprietary drivers not installable
Install Works, but black screen after login
Bad Hardware Support for new devices (laptops) and nVidia cards (mobile variant)
Black screen after login each time after installing nvidia driver
Dell XPS 15 9570 Discrete Graphics
Unable to install Manjaro, problem with dual graphics
Lock Screen Freeze Manjaro 18 XFCE with Nvidia Prime
Nvidia driver problems
Is it possible to use Prime like in Ubuntu?
[SOLVED] System hang when using mhwd on Entroware Kratos
Optimus laptops & Steam Play (Proton), any news?
[Steam][Bumblebee] Cs:go/dota2 MX940
Manjaro uses integrated graphics card instead of dedicated
[Testing Update] 2018-02-14 - Kernels, Plasma, KDE Framework, Themes
When will PRIME support be added to mhwd?
Cannot manage to have a external monitor and laptop display working at the same time
Installing manjaro linux to external hdd
[Solved] Open GLX Extention not supported by display
System76 & Manjaro
HDMI port not working on Dell Inspiron 7567
[Solved] "NVIDIA X driver not loaded" when running nvidia-settings
[SOLVED] Nvidia Prime Issue With Inspiron 15 GTX 1050TI
[SOLVED] Nvidia Prime Issue With Inspiron 15 GTX 1050TI
NVIDIA Setting Restore on Boot
[SOLVED] Nvidia Prime Issue With Inspiron 15 GTX 1050TI
BIOS allows discrete and hybrid nvidia, but how does manjaro swap?
BIOS allows discrete and hybrid nvidia, but how does manjaro swap?
NVIDIA-bumblebee stops working, needs to be reinstalled
Nvidia-intel hybrid performance issue
Nvidia-prime - manjaro
Dell laptop -- hybrid Intel/nVidia 1050Ti -- dual-monitor issues
Dell laptop -- hybrid Intel/nVidia 1050Ti -- dual-monitor issues
Dell laptop -- hybrid Intel/nVidia 1050Ti -- dual-monitor issues
Intel HD 630 and Nvidia problem
NVIDIA issue (hybrid graphics and non-free driver)
Primusrun very slow?
Trouble installing Manjaro on System with Nvidia GTX 1050 Ti
[SOLVED] Bad performance with Steam game using Nvidia bumblebee
Getting stuck after entering login details
GDM + Bumblebee = black login screen
Can't make Intel + Nvidia gpu's works
Can't boot to manjaro after installing NVIDIA drivers
Fragen zu Intel/Nvidia Hybrid Grafik und nonfree Treiber
Only boot on dual screen
External monitor does not work (hdmi)
(940mx + intel ) Nonfree driver issue ! Looking for helps :(
[SOLVED] UI of some apps not responding but I know they're working and "could not enable discrete graphics"
Manjaro stopped booting
Xorg can't find GLX for Nvidia
Bumblebee: optirun working, primusrun not working
Multiple issues with laptop's GPU
MCE and other problems
[SOLVED] New laptops i7-8750
Deepin Screen Tearing with NVIDIA Drivers - HP Envy
Start with black screen after non-free nvidia-driver installation
Boot Stuck at TPM Error
Start with black screen after non-free nvidia-driver installation
Video-Hybrid-Intel-Nvidia-Bublebee External Display
Video-Hybrid-Intel-Nvidia-Bublebee External Display
Dell XPS 15 9560 - Dual Display (HDMI Out, USB-C to HDMI Adapter Out)
Vetzki's PRIME tutorial discussion
Old desktop (6 years) and nvidia GeForce GT 730
[TOC] Nvidia GPU related Tutorials
Nvidia prime fail to load nouveau driver
Setting up PRIME reduces resolution to 960x540 (16:9)
Prime profiles missing?
Use so called prime instead of bumblebee for nvidia optimus based laptops
Problem with Manjaro on MSI GP72MVR 7RFX gaming laptop
A question about this tutorial (prime with nvidia driver)
How to only use Nvidia drivers?
Fan at maximum speed
Problem installing NVIDIA Drivers - without NVIDIA Optimus
Need help for Nvidia Prime setup
OS not booting. Lighted black screen with white underscore
OS not booting. Lighted black screen with white underscore
Running dedicated GPU Card in my laptop
Manjaro hangs after login on MSI GS63VR
Black screen after installing nvidia drivers - laptop dont work with nvidia drivers only!
Which GPU driver should I use?
[SOLVED] OpenGL not detected with primusrun and NVIDIA 390xx
System crashes on reboot or poweroff
Options for Nvidia Optimus graphics
How can I make Manjaro like my optimus hardware?
Manjaro not booting into kde environment
Manjaro XFCE keeps getting stuck
How to install nvidia driver for secondary GPU on laptop
How to install nvidia driver for secondary GPU on laptop
How to install nvidia driver for secondary GPU on laptop
Issues with gaming on Manjaro i3 with Optimus
Uninstalled libinput drivers and xorg got deleted and now the login screen is gone
Did anyone installed drivers for Nvidia GTX1070?
Need help setting up Nvidia Optimus: Bumblebee / Prime?
Optimus laptop issues
Manjaro KDE and Nvidia
[SOLVED] NVIDIA PRIME synchronization
Nvidia GPU driver (bumblebee) doesn't install correctly
NVIDIA Optimus problematic

Fantastic writeup! More people should be aware of the advantages. Once you leave bumblebee behind you never look back.


A bit off-topic, any idea when 390 will hit Stable branch?


With the next stable update. :wink:

Failed to create Vulkan device (Rise of the Tomb Raider)



Will boot parameters replace the need for a startup script and modprobe configuration?

GRUB_CMDLINE_LINUX_DEFAULT= "nvidia-drm.modeset=1



Yes. It’s a different way of setting the same option.


Are these extensions enabled by default? Are they even necessary?

Section "Extensions"
    Option "Composite" "Enable"
    Option "RENDER" "Enable"


you can try (“Composite” “Enable” should work) and check xorg.log, it will say enabled or unknown option or something like that


grep Composite .local/share/xorg/Xorg.0.log
[    12.470] (**) Extension "Composite" is enabled
[    12.803] (II)         Composite (RENDER acceleration)

be aware that xorg.log could be either in .local or in /var (depends if started as user or with root permissions)
if unsure check timestamp


I was curious if these options are already on default and if setting through the extensions section is redundant. Also, for a compositing window manager like Cinnamon, would it even have an effect to enable through Xorg?

I have it set to run as root to ensure KMS is active.


remove it and check xorg.log if its still enabled
(or xdpyinfo|grep Composite)

I really dont know


So, according to arch wiki Composite isn’t needed for window managers that already include. I assume that means Damage and Render extensions are redundant also.

ARCHWIKI: Some window managers (e.g. Compiz, Enlightenment, KWin, Marco, Metacity, Muffin, Mutter, Xfwm) do compositing on their own. For other window managers, a standalone composite manager can be used.

split this topic #14

A post was split to a new topic: When will PRIME support be added to mhwd?


Can you please explain why you say so? :thinking:
From what I see in OP’s table both gpus are enabled all the time, so I assume this is a PC only solution?


That’s about it.


What kind of difference are we talking about? As far as I have read it is said that bumblebee is not reducing performance. So I am really curious.

Also, I assume on laptop it is a battery draining solution?


It’s all hardware-dependent. The only way to see if it works better for you is to try it.

The point of the OP was not to discuss the relative merits, but the method of switching from render offload to display offload, only including a brief overview of the differences in the introduction.


There is a small mistake here the option requires a boolean as it is presented here it will hang the system.


Option "AllowEmptyInitialConfiguration" "boolean"

    Normally, the NVIDIA X driver will fail to start if it cannot find any display devices connected to the NVIDIA GPU. AllowEmptyInitialConfiguration overrides that behavior so that the X server will start anyway, even if no display devices are connected.

    Enabling this option makes sense in configurations when starting the X server with no display devices connected to the NVIDIA GPU is expected, but one might be connected later. For example, some monitors do not show up as connected when they are powered off, even if they are physically connected to the GPU.

    Another scenario where this is useful is in Optimus-based laptops, where RandR 1.4 display offload (see Chapter 32, Offloading Graphics Display with RandR 1.4) is used to display the screen on the non-NVIDIA internal display panel, but an external display might be connected later.

    Default: off. The driver will refuse to start if it can't find at least one connected display device.

@jonathon following this tutorial using my modification did work here but the system started to overheat and I had to manually run the whole startkde to the gpu which was bad. I remmember I did not have to do it on my good setup so I dont know what I did have that differs from this that you posted


According to the NVIDIA driver documentation it does not require a boolean.

You might want to link to your source.



if its working without should be logged in xorg.log