Guide: Install and configure optimus-manager for hybrid GPU setups (Intel/NVIDIA)

For hybrid GPU laptops 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).

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

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

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 just use Pamac or Octopi.

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.

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 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 tray icon on your panel and allows you to see which GPU is used at the moment, 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 tray icon or through a terminal.

You should see intel icon in your tray (optimus-manager boots to Intel session by default, it can be changed). You can right-click it to access to switch and options.

Screenshot_20190623_095607
Screenshot_20190623_124124

However, it’s possible that something went wrong and it won’t boot into 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 efficience 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.

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:

6 Likes

As to point #6 I see the reference in the wiki ... but while my sddm.conf has those lines - the scripts being called have nothing in them.. so I kinda doubt its required to comment out an empty command.

I had those lines, commented them out. Today I discovered I don't have the lines anymore... So maybe @philm changed it or maybe sddm in unstable comes in vanilla version and acquires those on stable branch? Hmm...

Or maybe it was changed recently and your config didn't change properly (didn't delete theme)? On other hand, I thought that configs aren't overwritten automatically, hence we get pacnew files. I don't remember having it for sddm lately.

It would be awesome to have optimus-manager integrated into mhwd and drop the default bumblebee setup, which is useless nowadays. But that's probably too early. That is why we need to encourage more users to use optimus-manager and post issues to improve it. Early versions were unreliable because of dm issues. Now those seems to be fixed and have solutions.

The install is a bit older - but I dont see or remember any pacnews.
Nonetheless the lines are there - but the scripts themselves are empty so it shouldnt matter.

Edit - oh wait. looks like it probably would matter because of this collision >>

So really, you could replace the lines in sddm, or even place a line in the scripts being called by sddm by default [/usr/share/sddm/scripts/X{setup|stop}] to call prime-offload and prime-switch. Well - if the package was built that way without the extra conf file...

Just musings :stuck_out_tongue_winking_eye:

1 Like

Anyway, users should know that those lines may be there and comment them out "just in case" or ignore the point of the lines are not there, regardless of the script.

Also, someone may add some section about the switch settings, like noveau, bbswitch, etc, since this could be an issue point for some, especially if they already messed with their graphics and ignore the tip to have "working default mhwd configuration". Nothing is perfect so this probably will have to be addressed at some point, but let's see if this helps with optimus-manager adoption.

Just clarifying, sddm.conf is a base file. User changes to override this are supposed to be in /etc/sddm.d/my-custom.conf IIRC the folder name. File extension should be .conf.
The difference between having a setting commented out and not (having an override or empty) is that a "no-setting" triggers the default sddm setting from package, while an existing setting (empty or other) does not allow the default to engage. Meaning, if a changed default arrives with an update, you still have your custom setting working.
AFAIK...

1 Like

True, however, sddm isn't creating user config automatically so people tend to edit the base file because of that. I don't have /etc/sddm.d/(only /etc/sddm.conf.d/)and somehow creating it feels wrong (after some time I wouldn't remember this is there).

In this case those lines pointing to Manjaro script are Manjaro specific thing and don't exist in default sddm.conf so it's safe to say that even lack of those lines is achieving the same result, unless, as you pointed out, this will be changed upstream. I guess I should add those commented out lines.

Also, shouldn't it be more like in ~/.config? That way any personal changes wouldn't be affecting other users and the base file. It also would carry on to other installations/reinstallations. However, I'm not sure if that trick works for every conf? Would system settings affect the user conf?

I checked my files and I did find sddm.conf.pacsave (but it's a year old so long before I made any changes manually for optimus-manager) and sddm.conf.pacnew (even older, from 2 years ago) which looks more like a pre-base version with all the explanations of what every line is for.

1 Like

Forum kindly sponsored by Bytemark