Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GPU setup was initiated but Xorg post-start hook did not run #356

Open
karaolidis opened this issue Dec 20, 2020 · 27 comments
Open

GPU setup was initiated but Xorg post-start hook did not run #356

karaolidis opened this issue Dec 20, 2020 · 27 comments

Comments

@karaolidis
Copy link

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!

@nicklauscyc
Copy link

currently having the same issue, I get the same error message when just running

optimus-manager

@Hvassaa
Copy link

Hvassaa commented Dec 25, 2020

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 :
#281 and https://bbs.archlinux.org/viewtopic.php?id=255752

@karaolidis
Copy link
Author

Thanks, that worked, but is there a way to automate this command? Would a simple alias for prime-offload && optimus-manager --switch whatever work?

@Hvassaa
Copy link

Hvassaa commented Dec 25, 2020

Sure, I don't see why not 😄

@karaolidis
Copy link
Author

Cool, I'll try setting that up, thanks for the support!

@Hvassaa
Copy link

Hvassaa commented Dec 25, 2020

No problem 💯

@jthomaschewski
Copy link

jthomaschewski commented Dec 28, 2020

Why is this closed? Have you found an actual solution @Nikas36 ?
I do experience the same issue. Thanks @Hvassaa for this workaround.
But running the post-hook manually and having to browse the issues to find a workaround isn't an actual fix.

I'm using patched gdm-prime & libgdm-prime and sometimes optimus-manager commands work once, but most of the time I have to manually execute prime-offload first.

Looks like hooks are only partially working even with patched gdm - and according to this thread even with sddm hooks seem to be broken.

Update: Thanks for reopening.
Just fyi: I just tested again with both lightdm and sddm on Manjaro and those two worked without any issues.
So my issue seems to be only with the gdm-prime patches, which doesn't seem to work. So probably not related.
I will switch from gdm to lightdm which is a reasonable workaround for me.

@karaolidis karaolidis reopened this Dec 28, 2020
@Hvassaa
Copy link

Hvassaa commented Dec 28, 2020

@JBBr what brand is your computer? Mine is a Dell XPS 15" 7590, and I noticed @Nikas36 had a Dell as well. I meant to do some more digging but forgot.

@jthomaschewski
Copy link

@Hvassaa Mine is Dell as well (XPS 15'' 9560). Wouldn't think this is an hardware issue though.
On my laptop power control works well when using bbswitch method.
Everything is working with lightdm and sddm right now - only patched gdm behaves as if it's not patched (hooks are not executed).
My issue seems to be different to this, as the OP was using sddm.

@NGStaph
Copy link

NGStaph commented Dec 29, 2020

same problem here. Have to prime-offload every single time.
MSI GL63 9SD here

@foldfelis
Copy link

foldfelis commented Dec 30, 2020

After I execute prime-offload and optimus-manager --switch [whatever], it comes up with the same error message:

ERROR: a GPU setup was initiated but Xorg post-start hook did not run.
[...]
Cannot execute command because of previous errors.

Environment:
optimus-manager: 1.3.1
gdm-prime, libgdm-prime: 3.38.2
host: MSI GL72 6QE

----- update -----

I checked out my nvidia-smi and found out that the switch was successful.
After I logged back in, I have to execute prime-offload again before I optimus-manager --status

@0xNipsys
Copy link

0xNipsys commented Jan 7, 2021

Same issue on my Lenovo X1 Extreme Gen2 running ArchLinux with GDM.
Fortunately the offload/switch trick is a temporary solution.

@willcrutchley
Copy link

Same issue on a Dell XPS 15 9560 using Manjaro with GDM.
Again, using prime-offload before trying to switch fixes the issue.
Also using patched gdm-prime and libgdm-prime (3.38.2).

@oz-orz
Copy link

oz-orz commented Jan 20, 2021

I am experiencing the same thing. I am using GDM-Prime and whenever I boot up I am met with a warning notification saying 'Warning: You are not running GDM-PRIME' even though I indeed am. I am on an Asus laptop with regular Arch Linux. (Edit: Also forced GDM to boot with Xorg instead of Wayland as instructed. No change.)

Running prime-offload first works.
Here is a way to run this command and the GPU switch to Nvidia in a single command, for people unfamiliar with alaising commands:

  1. Open ~/.bashrc in a text editor.
  2. At the end of the file, add alias gpuNV='prime-offload && optimus-manager --switch nvidia'
  3. Save and exit.
  4. Run source ~/.bashrc in terminal.

Now you should be able to use the command gpuNV to switch to Nvidia without running prime-offload first.

@mrkvn
Copy link

mrkvn commented Jan 22, 2021

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.

@mei1212123
Copy link

I have the same issue but when i do prime-offload i glxinfo still says my main gpu is the igpu (btw this is a lenovo legion y530)

@ohquero
Copy link

ohquero commented Nov 20, 2021

I've found that in my Archlinux installation the problem was that SDDM changed the name of its default "local configuration file", which are configuration files stored in /etc/sddm.conf.d/, to "default.conf".
This involves that the one installed by optimus-manager in the same folder and named "20-optimus-manager.conf" its overwritten. I've resolved by renaming "default.conf" to "10-default.conf".

@techsk8
Copy link

techsk8 commented Nov 27, 2021

I'm also having ha same issue. Running ArcoLinux on Dell Vostro 7500.. with the patched gdm-prim/libdgm-prime. I've had no issues what so ever so far until today when it keeps sending me directly into the black screen and I have to go into tty from there, no matter what I do get Xorg errors. I'm gonna switch to lightdm to see if that will work better for me.
So far I've tried many things all day and I'm already sick of it. The 'prime-offload` doesn't do the trick trick for me.

@ankitpaudel20
Copy link

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?

@Askannz Askannz added the bug label Mar 24, 2022
@dhyaneesh
Copy link

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?

Yes same setup and same issue

@techsk8
Copy link

techsk8 commented Apr 17, 2022

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

@Retrorage
Copy link

Retrorage commented Sep 10, 2023

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

This worked for me, many thanks. I need to read more carefully next time.

@thursdaybw
Copy link

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. :/

@Eu-g3ne
Copy link

Eu-g3ne commented Jun 22, 2024

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. :/

Same here, same setup.
AMD+NVIDIA, Manjaro KDE
tried also with prime-offload
prime-offload && optimus-manager --switch hybrid

Switching to mode : hybrid
/bin/sh: line 1: i3-msg: command not found
/bin/sh: line 1: openbox: command not found
/bin/sh: line 1: awesome-client: command not found
/bin/sh: line 1: bspc: command not found
/bin/sh: line 1: qtile: command not found
/bin/sh: line 1: herbstclient: command not foun

and nothing happens

optimus-manager --status           
A GPU switch from integrated to hybrid is pending.
Log out and log back in to apply.
Optimus Manager (Client) version 1.5

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

@es20490446e es20490446e removed the bug label Sep 21, 2024
@THXRXAPXR
Copy link

none of the above worked it just spits out [Xx_JXHN_xX@archlinux ~]$ prime-offload && optimus-manager --switch nvidia
ERROR: the latest GPU setup attempt failed at Xorg pre-start hook.
Log at /var/log/optimus-manager/switch/switch-20241005T140822.log
Error parsing config file /var/lib/optimus-manager/tmp/config_copy.conf. Falling back to default config /usr/share/optimus-manager/optimus-manager.conf. Error is : File contains no section headers.
file: '/var/lib/optimus-manager/tmp/config_copy.conf', line: 2
'switching=none\n'
Cannot execute command because of previous errors.
[Xx_JXHN_xX@archlinux ~]$

@es20490446e
Copy link
Collaborator

@THXRXAPXR Yours seems different: #583

@HonestPorcupine
Copy link

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!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests