Askannz / optimus-manager

A Linux program to handle GPU switching on Optimus laptops.
MIT License
2.28k stars 166 forks source link

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

Open karaolidis opened 3 years ago

karaolidis commented 3 years ago

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 commented 3 years ago

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

optimus-manager
Hvassaa commented 3 years ago

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

karaolidis commented 3 years ago

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 commented 3 years ago

Sure, I don't see why not :smile:

karaolidis commented 3 years ago

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

Hvassaa commented 3 years ago

No problem :100:

jthomaschewski commented 3 years ago

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.

Hvassaa commented 3 years ago

@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 commented 3 years ago

@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 commented 3 years ago

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

foldfelis commented 3 years ago

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

WildXav commented 3 years ago

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

willcrutchley commented 3 years ago

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 commented 3 years ago

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 commented 3 years ago

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


2. Under `~/.config/autostart`. Create a file called `prime-offload.desktop` with the following contents.

[Desktop Entry] Type=Application Exec=/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 commented 2 years ago

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 commented 2 years ago

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 commented 2 years ago

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 commented 2 years ago

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?

dhyaneesh commented 2 years ago

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 commented 2 years ago

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 commented 1 year ago

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 commented 5 months ago

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 commented 3 months ago

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