question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

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

See original GitHub issue

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'}

Issue Analytics

  • State:open
  • Created 2 years ago
  • Reactions:5
  • Comments:7

github_iconTop GitHub Comments

1reaction
yuceltoluyagcommented, May 11, 2022
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

<del>I updated the kernel, now I will restart my computer and take a screenshot. I’ll have edited my answer again in 2 minutes 😄 Please wait</del>

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

0reactions
nPHYN1T3commented, May 13, 2022

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.

Read more comments on GitHub >

github_iconTop Results From Across the Web

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...
Read more >
Git pre-commit hook is not running on Windows - Stack Overflow
Just tried that and now it comes up with an error when I try to commit: "error: cannot spawn .git/hooks/pre-commit: no such file...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found