For hybrid GPU laptops with Intel and Nvidia the best solution usually is to have switchable graphics: Intel for normal, everyday usage (uses less power and saves battery) and NVIDIA for games or more graphic intense programs (uses more battery). Optimus manager is a port of Ubuntu’s nvidia-prime solution to Arch Linux where a user can easily choose which GPU can be used at this session, so a user can still can save energy and be mobile on a daily basis but have all power and benefits of NVIDIA discrete card when needed (including Vulkan).
Note: For hybrid combos like AMD-Nvidia, just use the video-hybrid-intel-nvidia-440xx-prime mhwd setup and start apps needing dicrete GPU with prime-run. There is no switching, all works like a multi-purpose hybrid mode. So if you have AMD-Nvidia, stop reading futher as the guide below is only for Intel-Nvidia and you don't need any of this.
CATION: Optimus manager is relatively new and under heavy development so beware, MAKE A SYSTEM BACKUP before proceeding further. It’s not enough to just install the package and some manual configuration is needed. Please, make ALL CHANGES BEFORE REBOOT. If you reboot system before everything is in order, your graphical session may not boot successfully.
Only X session is supported (no Wayland).
Supported display managers are : SDDM (Manjaro KDE), LightDM (Manjaro XFCE), GDM (Manjaro Gnome). Other display managers may work but you have to configure them manually, see this FAQ section:
This tutorial is meant to be used on MANJARO. For other Arch-based systems, skip mhwd part.
Manjaro by default installs bumblebee with hybrid GPUs and I assume you already switched to non-free drivers. If not, please do that:
https://wiki.manjaro.org/index.php/Configure_Graphics_Cards
If you already use video-hybrid-intel-nvidia-440xx-prime configuration, this guide is also for you. The only difference is that you don't have bumblebee so you don't have to disable it. The rest of the guide stays the same. More info on hybrid off loading mode that this setup uses, see point 9.
This guide also assumes you are already able to see and edit root owned files (via terminal or GUI options). If not, please learn bash basics like cd, ls, cp, mv, etc. or use Dolphin with admin extension, or Krusader in administrative mode, or any GUI program that will allow you to perform described operations.
1. Installation of packages: optimus-manager from repo and optimus-manager-qt from AUR (it’s possible to install git versions from AUR):
sudo pacman -S optimus-manager
Use choosen AUR helper or GUI program like Pamac or Octopi to find and install optimus-manager-qt:
trizen optimus-manager-qt
yay optimus-manager-qt
2. Disable Bumblebee daemon:
sudo systemctl disable bumblebeed.service
The sole act of installing optimus-manager packages makes Bumblebee not work correctly, so this is normal if you try run Bumblebee and see errors at this point. Bumblebee process cannot be active for proper optimus-manager work so let’s just disable it as shown above. Bumblebee package may stay on the system if you want reconsider and uninstall optimus-manager in the future but without active daemon, it’s not doing anything, just as it should.
3. Disable Xorg graphic configurations in /etc/X11/xorg.conf.d/
Go to /etc/X11/xorg.conf.d/
and disable any graphic related configs. Instead deleting them, just rename them by adding .bak for the case if you want to restore them manually.
So for example, I had in this location:
00-keyboard.conf 20-intel.conf 30-touchpad.conf 90-mhwd.conf
Your files may be different so don’t worry if you don’t have those or have a bit different ones.
Keyboard and touchpad configs are self explanatory and have nothing to do with GPUs. Intel is clearly graphic related config while mhwd is a Manjaro specific configuration file of mhwd script (won’t be present on non-Manjaro systems) that configures graphic.
I renamed intel and mhwd confs by adding .bak so in the end my files in this locations are:
00-keyboard.conf 20-intel.conf.bak 30-touchpad.conf
10-optimus-manager.conf 20-intel.conf.bak-old 90-mhwd.conf.bak
Did you noticed a new one: 10-optimus-manager.conf
? This one WILL BE GENERATED AUTOMATICALLY LATER by optimus-manager and you won’t have it at this poin't so don’t worry. Optimus manager simply edits this config to switch between graphical modes (Intel and NVIDIA) so its content change dependently which GPU you choose at the moment.
4. Disable Xorg graphic configurations in /etc/X11/
The same situation as above. I had in this location a file:
nvidia-xorg.conf
You can rename it to nvidia-xorg.conf.bak, however, I noticed that some updates may restore the file and optimus-manager still works as intended… so it’s not crucial, however advised to disable this conf anyway.
You may see in this location again different files, like:
xorg.conf
or nvidia-xonfig
The same deal, disable it by renaming it.
5. For Manjaro Gnome users (others ignore this point):
- install gdm-prime from AUR
On Manjaro Gnome you may have manjaro-gdm-tweak installed which requires gdm, so when you install gdm-prime, you get error because of the dependency with gdm.
You need to remove it first:
sudo pacman -Rns manjaro-gdm-tweak
Then dependently which AUR helper you use, install a package gdm-prime and remove gdm from Manjaro repo:
yay gdm-prime
or
trizen gdm-prime
or
pamac build gdm-prime
or just use Pamac or Octopi GUI programs.
After that enable gdm:
sudo systemctl enable gdm
and reboot.
The reason for that is that optimus-manager cannot switch GPUs with default gdm config, while gdm-prime has Canonical’s patches that add two script entry points for GPU Prime switching. The package is otherwise identical to the official one.
- You need to edit the file
/etc/gdm/custom.conf
and remove the # before the line
#WaylandEnable=false
So it would look:
WaylandEnable=false
Gnome launches Wayland sessions by default, which are incompatible with optimus-manager, so the above change forces X session.
- Another quirk of GDM is that the X server may not automatically restart after a GPU switch. If you see an empty black screen or a black screen with a blinking cursor, try switching back to an empty TTY (with Ctrl+Alt+F5 for instance), then back to TTY1 with Ctrl+Alt+F1
6. For Manjaro KDE users (others ignore at this point):
Edit the file /etc/sddm.conf
and simply put a # before the line starting with DisplayCommand
and the one starting with DisplayStopCommand
.
To edit the sddm.conf in terminal:
sudo nano /etc/sddm.conf
The reason for that is that Manjaro ships with a default configuration for SDDM (the default login manager for KDE) which overrides some keys needed by optimus-manager.
Weirdly enough, it’s possible that you may not have lines:
DisplayCommand
DisplayStopCommand
In such a case you are fine and you have nothing to do. It’s possible some recent Manjaro updates deleted those additional lines (they are not present in non-Manjaro systems anyway).
7. Create autostart for optimus-manager-qt
optimus-manager-qt is a small utility that puts a tray icon on your panel and allows you to see which GPU is used at the moment. You can then switch easily by right-click and choose the GPU, or configure optimus-manager. So basically it allows for usage without commandline.
For some systems or DEs it's possible that this step can be skipped as the autostart will be created automatically. In that case you will see the icon in the tray after reboot. If not, set it manually.
Since auto-start is done differently in different DEs, you have to know how it is done in your chosen DE.
In Plasma, you go to Settings→Startup and Shut Down→Automatic Startup (note: this is translated from my native language so it’s possible it will be named slightly different in English)
Then you hit the button “Add a program”, search for optimus-manager-qt, choose it and ensure it’s marked for autostart.
In Gnome it’s possible you will need some additional extension to show tray icons.
8. Reboot
At this point all should be done and to make it work, you need to reboot your computer.
Check if optimus-manager daemon is running correctly:
systemctl status optimus-manager.service
If it's OK, you can start using it from the tray icon or through a terminal.
You should see the intel icon in your tray (optimus-manager boots to Intel session by default, it can be changed). You can right-click it to access switch and options.
However, it’s possible that something went wrong and it won’t boot into the graphical session so it’s vital you have a backup. At this point, you can log into tty and either restore from backup, undo changes you just made or try to fix whatever problem occurred.
Note: when switching GPUs in Plasma, you will have to put a password on a SDDM screen. This is unavoidable and cannot be changed because the way optimus-manager currently works make impossible to trigger auto-login settings (the switch isn’t a full session reboot).
9. Nvidia-435 driver series or newer ones
So far the optimus-manager is compatible with them but since those drivers are not perfect, you still may need to have intel mode for the best energy efficiency so even when Nvidia driver offers discrete GPU off-loading, the technology is not perfect and the ability to run sessions with intel or Nvidia mode is still very beneficial.
Optimus-manager-qt also offers Hybrid mode:
-
optimus-manager --switch hybrid
to switch to the Intel GPU but leave the Nvidia GPU available for CUDA and PRIME Render offload. This will use Intel drivers by default but allows to run a programm with Nvidia on demand (usually with additional command - evrionment parametr)
So this will work for those who have Nvidia 435 or higher driver series. For the rest, it will work as a usual Intel session.
If you want to upgrade to a newer nvidia driver series do a system backup (timeshift), then go to Manjaro Settings->Hardware Configuration, find your current version (in my case it was video-hybrid-intel-nvidia-430xx-bumblebee), right-click it and choose Remove. Wait for the sucess message.
Don't reboot under any circumstances. If you do, you will land in tty (no graphical session) and you will have to proceed in cli.
If you are still in the same graphical session, use the same tool (MHWD) to install the newer driver series, in my case this was video-hybrid-intel-nvidia-440xx-prime (bumblebee is no longer used so prime mhwd setup will suit us well, besides bumblebee setup is currently lacking the newest drivers anyway), so right-click it and choose Instal:
Wait for the sucess message.
Then as with the usual optimus-manager initial setup check those two location for graphical configs that are not from optimus-manager:
/etc/X11/xorg.conf.d/
/etc/X11/
and disable them. In my case, nothing has changed aside new 90-mhwd.conf
which was created by mhwd that I just used. So I reneamed it again to 90-mhwd.conf.bak
.
Now it's time to reboot and check if everything is working. In my case all was working as previously but had newer drivers.
In hybrid mode desktop and all apps are run in Intel by default. If you want an app to run Nvidia, use this environmental command before launch command:
__NV_PRIME_RENDER_OFFLOAD=1 __GLX_VENDOR_LIBRARY_NAME=nvidia appname
or you could use the shorter and more handy alias:
prime-run appname
that does the same as the full command above.
so if you want to start Steam with Nvidia, you should use heavy runtime (as recommended on Arch systems, although currently seems to be not needed, but may be in the future) plus the above command so the launch command will look like:
STEAM_RUNTIME_HEAVY=1 __NV_PRIME_RENDER_OFFLOAD=1 __GLX_VENDOR_LIBRARY_NAME=nvidia steam
or
STEAM_RUNTIME_HEAVY=1 prime-run steam
In the example above I added another environmental variable STEAM_RUNTIME_HEAVY=1 adviced for Arch based systems (this fixed some issues in the past, currently is not needed, but it doesn't hurt and may be needed in the future). You don't have to use it, I just showed it as example how environmental variable commands are used to modify launcher commands.
For permanent solution you can simply edit steam.desktop file in ~/.local/share/application/
So I copied the original steam.desktop file and created another 2 versions so in the end I have 3 launchers:
steam.desktop - for Intel with Intel/Modesetting driver and for Nvidia with Nvidia driver.
steam-hybird.dekstop - for Hybrid with Nvidia driver.
steam-nouveau.desktop - for Intel with Nouveau driver, when you use Nouveau as a switcher and use Intel Modesetting drivers, it also can start Nvidia on demand, just like in a hybrid mode, but in this case it will start Nvidia with nouveau driver, which may be good for some old games that will run OK on Intel drivers as well but will perform better on Nouevau. In some cases Nvidia propietary drivers have bugs which won't allow for normal game play, but Nouveau drivers work well (like for HOMM V), so this kind of setup has it use cases as well.
I modified Exec=
and Name[pl_PL]
lines (of course you change name accordingly to your language locale), so those would look like for me:
steam.desktop:
Exec=STEAM_RUNTIME_HEAVY=1 steam
Name[pl_PL]=Steam
steam-hybird.dekstop:
Exec=STEAM_RUNTIME_HEAVY=1 prime-run steam
Name[pl_PL]=Steam-Hybrid
steam-nouveau.desktop:
Exec=STEAM_RUNTIME_HEAVY=1 DRI_PRIME=1 steam
Name[pl_PL]=Steam-Nouveau
Some will advice you to run generic Steam with intel and add a command to run a game in Nvidia:
__NV_PRIME_RENDER_OFFLOAD=1 __VK_LAYER_NV_optimus=NVIDIA_only %command%
or shorter:
prime-run %command%
However, I prefer simplicity and if Nvidia can render the whole desktop without any losses on performance, running Steam won't burden it and that way you won't have to remeber to add the above command to every installed game. Plus, different desktop files could be made for each driver modes, but when you decide to modify game's starting command, you would have to modify it back and forth depending in which mode you are, which is cumbersome, unless you decide to run Steam only in Hybrid mode, then the problem is gone. The choice is yours...
Remeber, that the command to launch Steam via Nvidia on hybrid mode won't work in Intel so Steam simply won't start. To avoid it just create a copy of Steam launcher and name it Steam-Hybrid as shown above.
If you use Lutris, there is a switcher for enable/disable prime offloading. Go to a games: settings->system options and choose Enable NVIDIA Prime render offload:
Note: Usually, a game that is using DXVK by default (so most games run via Proton with default settings) will use Nvidia even if you didn't run Steam on Nvidia or didn't specify to run game with Nvidia. This is beacause for Vulkan Nvidia is the default so it automatically switches to it. However, native Linux games use Opengl so they will be still using Intel by default and then proper launcher command to start Nvidia are needed. If you don't want to think about it which games needs it or not, just run Steam on Nvidia and it always be Nvidia used for gaming no matter which game.
More about it and Nvdia power managemrnt on optimus-manager-wiki: Nvidia GPU offloading for "hybrid" mode.
When to run Intel, Nvidia or Hybrid mode?
Intel uses the least energy so when you game sporadically and want to have mobility (so you want to use a battery sometimes), also for using Nvidia with Nouveau driver for older games, this is the best starting point.
Hybrid uses Intel Modesetting by default, however, Nvidia isn't powered off completely for non-turing based GPUs, but uses less power (currently, ca. 30-20% less, depends on hardware, so it can be more or less then that), so it's a compromize. Hybrid mode it's good to use if you know you will want to game sometimes and you don't want to be bothered with re-logging your session often, and you are mostly on your AC power or close to it, but you can still use battery when not playing games. It's still using a lot of battery power but a bit less then in Nvidia mode while discrete GPU is still being 100% accesible when needed. The con of using Hybrid mode is that currently there is no way to run multiple monitors on it, however this will change in 450xx drivers line.
Nvidia is good if you game often or use graphic intensive programms and power savings are not an issue because you are always connected to AC. So if you game rarely, use Intel and then switch to Nvidia for a gaming session.
NOTE FOR PLASMA USERS:
If you edit Steam's lauch command on the Favourties on your launcher it will work for the launcher saved in latte, but if you run Steam directly from Favourites, it will launch in the usual Intel mode untill you reboot the session. Test it and check if you are running Nvidia in System Information in Steam.
10. Possible issues during the switch
Optimus manager uses by default nouveau to switch GPUs but for some, it doesn't work. In result, their DM hangs and fans are working like crazy (overheating).
In this case, changing to bbswitch often solves the issue. This is available in Settings of the icon of the try utility. Reboot after the changes.
If for some reason the new setting is working badly and your system cannot start a graphical session after reboot, enter tty session (ctrl+alt+f2), log in and edit manually back to the previous setting:
/etc/optimus-manager/optimus-manager.conf
For more information on how to use optimus-manager in terminal or how to troubleshoot it, go to:
and it's Wiki: