optimus-manager: GPU setup was initiated but Xorg post-start hook did not run

Hello! I’ve been optimus-manager for a couple of months now with no issues, but lately I can’t seem to be able to switch modes.

If I run optimus-manager --switch [whatever], my display turns off for a couple of seconds, I get logged out and once I log back in and run optimus-manager --print-mode, I get the following error:

ERROR: a GPU setup was initiated but Xorg post-start hook did not run.  
Log at /var/log/optimus-manager/switch/switch-20201220T121244.log  
[...]  
Cannot execute command because of previous errors.  

The log:

[29] INFO: # Xorg pre-start hook
[29] INFO: Previous state was: {'type': 'pending_pre_xorg_start', 'requested_mode': 'hybrid', current_mode': 'nvidia'}
[29] INFO: Requested mode is: hybrid
[54] INFO: Loaded extra integrated-gpu Xorg options (0 lines)
[54] INFO: Loaded extra nvidia-gpu Xorg options (0 lines)
[54] INFO: Writing to /etc/X11/xorg.conf.d/10-optimus-manager.conf
[54] INFO: Writing state {'type': 'pending_post_xorg_start', 'switch_id': '20201220T121244', 'requested_mode': 'hybrid'}
[55] INFO: Xorg pre-start hook completed successfully.

I am using KDE Plasma with SDDM and I’m on a Dell G5 5587 with a GTX1060Max-Q running Arch. I would appreciate any help you guys can give me!

About this issue

  • Original URL
  • State: closed
  • Created 6 years ago
  • Comments: 32

Most upvoted comments

I had a similar issue, and a workaround for me was first running

prime-offload

and then switching works. I have to do this every time I switch though.

I found some other people with similiar issues and more info : https://github.com/Askannz/optimus-manager/issues/281 and https://bbs.archlinux.org/viewtopic.php?id=255752

My issue was that I’ve not commented out the two lines in /etc/sddm.conf that the wiki says to comment out:

Manjaro ships with a default configuration for SDDM (the default login manager for KDE) which overrides some keys needed by optimus-manager. To use optimus-manager, you need to edit the file /etc/sddm.conf and simply put a # before the line starting with DisplayCommandand the one starting with DisplayStopCommand.

Once I’ve done that, everything works seamlessly.

$ optimus-manager --status
Optimus Manager (Client) version 1.4

Current GPU mode : integrated
GPU mode requested for next login : no change
GPU at startup : auto
Temporary config path: no

Another workaround.

  1. Create a script to launch prime-offload on login. Don’t forget to make it executable.
#!/bin/bash

# not sure why but needs to sleep before launching, otherwise, it doesn't work.
sleep 2
prime-offload &> /dev/null
  1. Under ~/.config/autostart. Create a file called prime-offload.desktop with the following contents.
[Desktop Entry]
Type=Application
Exec=<insert-path-to-script-here>/prime-offload.sh
Name=Prime Offload
Comment=Required for Optimus Prime Graphics switching

In this way you don’t have to create any aliases or execute prime-offload every time you want to switch graphics, which should be the case in the first place.

I’m also having the same issue on Lenovo legion 5 AMD+NVIDIA laptop. The “prime-offload” before “optimus-manager” runs the command successfully and also says it will switch to hybrid or Nvidia next login but it doesn’t and after a reboot sane issue arises without any change in “/etc/X11/xorg.conf.d/10-optimus-manager.conf”. Does anybody have any ideas on what to do next?

Same here, same setup… This is over a year later… I’ve tried the suggestions eg:

Manjaro ships with a default configuration for SDDM (the default login manager for KDE) which overrides some keys needed by optimus-manager. To use optimus-manager, you need to edit the file /etc/sddm.conf and simply put a # before the line starting with DisplayCommandand the one starting with DisplayStopCommand.

so, yeah, no luck. 😕

Welp. After couple sleepless nights I came up with a “solution”, rather the HINT.

Short answer: It’s something wrong within Plasma packets/libraries and something is needed from XFCE libraries.

Long answer: I’ve been using EndeavourOS (arch) with XFCE4 since 2022 + optimus-manager with absolutely no problems (2 optimus laptops with Intel CPU + Nvidia GPU)

I came to this thread the day I installed fresh Endeavour OS with KDE (default DE for now). I tried (gdm, lighdm, sddm) with different combinations of nvidia drivers (nvidia-dkms/open/lts etc.) - no success. I could not keep optimus-manager.service enabled or evern working after first switch because it would keep me on dm login


So I installed XFCE4 without deleting KDE. pacman -S xfce4 xfce4-goodies No success, optimus-manager still bugs out.

BUT drivers worked properly in default (hybrid) mode without optimus-manager installed (External monitor uses Nvidia GPU and launches all games with Nvidia GPU, -Most important: it sees both monitors now, comparing to Plasma (except Plasma’s hybrid mode that detects 2 screens, but won’t launch anything on discrete GPU unless you prime-run it individually (no smooth experience at all anyway)


Second step I deleted Plasma with it’s dependencies pacman -Rdd plasma and moved to XFC4 totally (+ switched to lighdm)

optimus-manager now works like a charm

Both monitors are detected, games are launched from Nvidia GPU, optimus-manager.service can be enabled and boots normally with system

P.S. I am too lazy to check if dm makes any changes (if you can stay on sddm)


(ABOUT MOVING TO XFCE)

  • ! Standard XFCE on non-fresh install won’t have nm-connection-editor (Wifi-connections manager), better install it before deleting Plasma. If it’s too late: use nmtui after you installed nm-connection-editor delete saved connections from nmtui and connect from nm-applet (comes with nm-connection-editor) otherwise it will ask you for wifi password every time you boot.

  • If you want normal Endeavour OS beautiful XFCE interface: [endeavouros-xfce4-theming] To get full normal setup like from fresh install

  1. Use Installation script first
  2. Reboot
  3. Use Manual installation to overwrite rest of ugly artifacts

I do really hope it will help!