optimus-manager icon indicating copy to clipboard operation
optimus-manager copied to clipboard

Latest version not functioning; fails at pre-xorg-start hook.

Open salperinlea opened this issue 3 years ago • 8 comments

Describe the bug Post reboot after installing optimus-manager-git via the AUR, the package is not usable and the nvidia gpu seems to be powered off. All commands return the error posted below:

ERROR: the latest GPU setup attempt failed at Xorg pre-start hook.
Log at /var/log/optimus-manager/switch/switch-20220219T221409.log
Cannot execute command because of previous errors.

System info Please include :

  • Arch, kernel 5.16.10.
  • KDE 5.24.1
  • SDDM
  • Hp Envy 15 ep1020 -- intel tigerlake iGPU, Nvidia RTX 3060 dGPU. Notably, this has a 4k OLED screen, which has been a stumbling block for linux until fairly recently.
  • optimus-manager-git (because optimus-manager itself prevents me from even logging in!)
  • no configuration performed.

Logs The log mentioned in the error given is as follows:

[14] INFO: # Xorg pre-start hook
[14] INFO: Previous state was: {'type': 'pending_pre_xorg_start', 'requested_mode': 'integrated', 'current_mode': None}
[14] INFO: Requested mode is: integrated
[1037] INFO: Available modules: ['nouveau', 'nvidia', 'nvidia_drm', 'nvidia_modeset', 'nvidia_uvm']
[1038] INFO: Unloading modules ['nvidia_drm', 'nvidia_modeset', 'nvidia_uvm', 'nvidia'] (if loaded)
[1041] INFO: Cannot unload modules: None
[1042] INFO: Waiting 1s and retrying.
[2049] INFO: Cannot unload modules: None
[2049] INFO: Waiting 1s and retrying.
[3057] INFO: Cannot unload modules: None
[3057] INFO: Waiting 1s and retrying.
[4066] INFO: Cannot unload modules: None
[4066] INFO: Waiting 1s and retrying.
[5074] INFO: Cannot unload modules: None
[5075] INFO: Waiting 1s and retrying.
[6083] INFO: Max tries (6) exceeded
[6084] ERROR: Xorg pre-start setup error
Traceback (most recent call last):
  File "/usr/lib/python3.10/site-packages/optimus_manager/kernel.py", line 269, in _unload_modules
    subprocess.check_call(
  File "/usr/lib/python3.10/subprocess.py", line 369, in check_call
    raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command 'modprobe -r nvidia_drm nvidia_modeset nvidia_uvm nvidia' returned non-zero exit status 1.

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/usr/lib/python3.10/site-packages/optimus_manager/hooks/pre_xorg_start.py", line 51, in main
    setup_kernel_state(config, prev_state, requested_mode)
  File "/usr/lib/python3.10/site-packages/optimus_manager/kernel.py", line 25, in setup_kernel_state
    _nvidia_down(config)
  File "/usr/lib/python3.10/site-packages/optimus_manager/kernel.py", line 104, in _nvidia_down
    _unload_nvidia_modules(available_modules)
  File "/usr/lib/python3.10/site-packages/optimus_manager/kernel.py", line 214, in _unload_nvidia_modules
    _unload_modules(available_modules, ["nvidia_drm", "nvidia_modeset", "nvidia_uvm", "nvidia"])
  File "/usr/lib/python3.10/site-packages/optimus_manager/kernel.py", line 277, in _unload_modules
    raise KernelSetupError(f"Cannot unload modules {modules_to_unload}: {e.stderr}") from e
optimus_manager.kernel.KernelSetupError: Cannot unload modules ['nvidia_drm', 'nvidia_modeset', 'nvidia_uvm', 'nvidia']: None
[6084] INFO: Removing /etc/X11/xorg.conf.d/10-optimus-manager.conf (if present)
[6084] INFO: Writing state {'type': 'pre_xorg_start_failed', 'switch_id': '20220219T221409', 'requested_mode': 'integrated'}

salperinlea avatar Feb 20 '22 03:02 salperinlea

Same error here:

ERROR: the latest GPU setup attempt failed at Xorg pre-start hook.
Log at /var/log/optimus-manager/switch/switch-20220314T101819.log
Cannot execute command because of previous errors.

System info:

  • Manjaro, kernel 5.16.14-1
  • KDE 5.24.2
  • SDDM
  • Asus K501LX
  • Intel HD Graphics 5500 and Nvidia GTX 950M
  • optimus-manager 1.4-4 installed from the AUR

bejucoo avatar Mar 14 '22 15:03 bejucoo

I had a similar issue with same specs as @salperinlea

I enabled PCI Power Control + PCI Reset: Hot reset inside optimus-manager-qt and it changed these in optimus-manager.conf.

I have a feeling by default the card is booting powered down and can't load the kernel module until it's alive. This seemed to resolve it for me

...
[optimus]
pci_power_control=yes
pci_reset=hot_reset
...

idanoo avatar Mar 16 '22 07:03 idanoo

Same error here:

ERROR: the latest GPU setup attempt failed at Xorg pre-start hook.
Log at /var/log/optimus-manager/switch/switch-20220314T101819.log
Cannot execute command because of previous errors.

System info:

* Manjaro, kernel 5.16.14-1

* KDE 5.24.2

* SDDM

* Asus K501LX

* Intel HD Graphics 5500 and Nvidia GTX 950M

* optimus-manager 1.4-4 installed from the AUR

The last Manjaro update fixed whatever error I had. Maybe the nvidia-utils 510.54-2?

bejucoo avatar Mar 19 '22 21:03 bejucoo

same issue here, although I am running on kernel 5.15 LTS

thamudi avatar Mar 23 '22 13:03 thamudi

I'm also seeing this. Keep reading the no login manager FAQ like the errors say but can't find anything relevant but feel like I'm so spread thin I'm missing something obvious. 5.15.35 LTS (Garuda / Arch) here and ye olde nVidia 390 installed (from the nVidia website since the AUR version is broken due to mismatched packages).

Again I've read through the FAQ and docs the message says too about if you don't use a greeter but there is no mention of it. Looking at the service file I see WantedBy=graphical.target so I'm guess this is the issue for me. Now the question will it function if I change that to multi-user.target?! (nope)

nPHYN1T3 avatar Apr 23 '22 21:04 nPHYN1T3

Linux Jason 5.17.5-arch1-2 #1 SMP PREEMPT Fri, 06 May 2022 18:29:03 +0000 x86_64 GNU/Linux
i3 version 4.20.1 (2021-11-03) � 2009 Michael Stapelberg and contributors
lightdm 1.30.0
01:00.0 VGA compatible controller: NVIDIA Corporation GF106GLM [Quadro 2000M] (rev a1)
	Subsystem: Lenovo Device 21d1
	Kernel driver in use: nvidia

Optimus Manager (Client) version 1.4
optimus-manager-qt Version 1.6.6

Traceback (most recent call last):
  File "/usr/lib/python3.10/site-packages/optimus_manager/kernel.py", line 269, in _unload_modules
    subprocess.check_call(
  File "/usr/lib/python3.10/subprocess.py", line 369, in check_call
    raise CalledProcessError(retcode, cmd)

this problem happens to me too, i solve it like this Every time you update the kernel, you need to update the nvidia packages. (It can happen to you even if you use the lts kernel.)

  1. prime-offload run this command
  2. reinstall linux and linux-headers
  3. sudo mkinitcpio -p linux
  4. İnstall nvidia packaages again.
  5. reboot
  6. problem should be solved

If you do not want to do all these operations, you should install the dkms packages. For example nvidia-390xx-dkms When the kernel is updated it will automatically introduce the nvidia kernel modules.

If you don't want to install the dkms package, you can create a hook file

/etc/pacman.d/hooks/nvidia.hook

[Trigger]
Operation=Install
Operation=Upgrade
Operation=Remove
Type=Package
Target=nvidia
Target=linux
# Change the linux part above and in the Exec line if a different kernel is used

[Action]
Description=Update Nvidia module in initcpio
Depends=mkinitcpio
When=PostTransaction
NeedsTargets
Exec=/bin/sh -c 'while read -r trg; do case $trg in linux) exit 0; esac; done; /usr/bin/mkinitcpio -P'

When the kernel is updated, it will automatically reinstall the packages.

If you are using an old card like mine, you will get this error every time you update the kernel. I was currently using kernel version 5.15, I'm updating my kernel to show you :) 2022-05-12-01:26:43

If you don't understand anything from what I wrote, check these resources

  1. https://wiki.archlinux.org/title/NVIDIA#pacman_hook
  2. https://wiki.archlinux.org/title/PRIME#PRIME_GPU_offloading

I updated the kernel, now I will restart my computer and take a screenshot. I'll have edited my answer again in 2 minutes :D Please wait

it works ,hope it helps you too 2022-05-12-01:43:09 .

- Do not forget that every time you update the kernel, you must reinstall your graphics card packages, or you can automate it by trying the methods I mentioned above.
+ This is how I always solve this problem, I hope someone finds it useful

yuceltoluyag avatar May 11 '22 22:05 yuceltoluyag

None of that is relevant. There is no issue with the drivers, the issue is with the switchers pre-hook (not pacmans hooks) and lack of actual docs for running with no greeter.

nPHYN1T3 avatar May 13 '22 09:05 nPHYN1T3

I found that stopping the nvidia-persistanced & nvidia-powerd services before switching to integrated solves this, as nvidia_drm was being held captive by them & couldn't be unloaded.

GamingLiamStudios avatar Jan 03 '23 02:01 GamingLiamStudios