Unable to use Nvidia GPU (Optimus Manager) in Linux 5.10.3-arch1-1 and below

NEW (JAN 4):
I’ve noticed that the 5.10.4 update is out according to “yay”, so I installed it. Upon reboot, the GPU works (but not the audio as per previous thread). Alright, nothing funky so far.

So I’ve downgraded to 5.10.3 again to test. This time, the GPU doesn’t work despite working earlier! (Audio doesn’t work as normal) I’d like to speculate that Optimus Manager can only detect the latest kernel installed, but is unable to “roll back” to earlier nvidia modules?

For now, I’m staying on 5.9.14 as I’m prioritizing having audio over the GPU. Hopefully I’ll get to use both soon!

Reinstalling nvidia nvidia-settings nvidia-utils lib32-nvidia-utils optimus-manager-git while on 5.9.14 then rebooting doesn’t work either.


Just started my computer, and realized that my Nvidia GPU isn’t being utilized. I initially inferred this from my lack of frame rate while gaming. I then tried to manually specify Optimus Manager to use it, and got this:
optimus-manager --switch nvidia

ERROR: the latest GPU setup attempt failed at Xorg pre-start hook.
Log at /var/log/optimus-manager/switch/switch-20210103T234311.log
Config parsing : error in option "startup_auto_battery_mode" in section [optimus] : invalid value "intel"
Cannot execute command because of previous errors.

Here’s the relevant entry within /etc/optimus-manager/optimus-manager.conf

# GPU mode to use at computer startup. Possible values: nvidia, intel, hybrid, >
# "auto" is a special mode that auto-detects if the computer is running on batt>
# and selects a proper GPU mode. See the other options below.
startup_mode=auto
# GPU mode to select when startup_mode=auto and the computer is running on batt>
# Possible values: nvidia, intel, hybrid
startup_auto_battery_mode=intel
# GPU mode to select when startup_mode=auto and the computer is running on exte>
# Possible values: nvidia, intel, hybrid
startup_auto_extpower_mode=nvidia

Here is the relevant log file:

[32] INFO: # Xorg pre-start hook
[32] INFO: Previous state was: {'type': 'pending_pre_xorg_start', 'requested_mode': 'nvidia', 'current_mode': None}
[32] INFO: Requested mode is: nvidia
[32] INFO: Checking for GDM display servers
[52] ERROR: Config parsing : error in option "startup_auto_battery_mode" in section [optimus] : invalid value "intel"
[52] INFO: Falling back to default value "integrated"
[214] INFO: Available modules: ['nouveau']
[214] INFO: Unloading modules ['nouveau'] (if loaded)
[218] INFO: switching=none, nothing to do
[297] INFO: Loading module nvidia
[297] ERROR: Xorg pre-start setup error
Traceback (most recent call last):
  File "/usr/lib/python3.9/site-packages/optimus_manager/hooks/pre_xorg_start.py", line 45, in main
    setup_kernel_state(config, prev_state, requested_mode)
  File "/usr/lib/python3.9/site-packages/optimus_manager/kernel.py", line 22, in setup_kernel_state
    _nvidia_up(config, hybrid=(requested_mode == "hybrid"))
  File "/usr/lib/python3.9/site-packages/optimus_manager/kernel.py", line 91, in _nvidia_up
    _load_nvidia_modules(config, available_modules)
  File "/usr/lib/python3.9/site-packages/optimus_manager/kernel.py", line 134, in _load_nvidia_modules
    _load_module(available_modules, "nvidia", options="NVreg_UsePageAttributeTable=%d" % pat_value)
  File "/usr/lib/python3.9/site-packages/optimus_manager/kernel.py", line 234, in _load_module
    raise KernelSetupError(
optimus_manager.kernel.KernelSetupError: module nvidia is not available for current kernel. Is the corresponding package installed ?
[298] INFO: Removing /etc/X11/xorg.conf.d/10-optimus-manager.conf (if present)
[298] INFO: Writing state {'type': 'pre_xorg_start_failed', 'switch_id': '20210103T234311', 'requested_mode': 'nvidia'}

Then, I decided to directly specify the Nvidia GPU instead like such, thus potentially bypassing whatever issue there is on the “Intel” end:

# GPU mode to use at computer startup. Possible values: nvidia, intel, hybrid, >
# "auto" is a special mode that auto-detects if the computer is running on batt>
# and selects a proper GPU mode. See the other options below.
startup_mode=nvidia
# GPU mode to select when startup_mode=auto and the computer is running on batt>
# Possible values: nvidia, intel, hybrid
#startup_auto_battery_mode=intel
# GPU mode to select when startup_mode=auto and the computer is running on exte>
# Possible values: nvidia, intel, hybrid
#startup_auto_extpower_mode=nvidia

I then rebooted my laptop immediately, but the issue persists. Here’s the new output from my next attempt at optimus-manager --switch nvidia:

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

Here is the new, relevant log file:

[40] INFO: # Xorg pre-start hook
[40] INFO: Previous state was: {'type': 'pending_pre_xorg_start', 'requested_mode': 'nvidia', 'current_mode': None}
[40] INFO: Requested mode is: nvidia
[40] INFO: Checking for GDM display servers
[178] INFO: Available modules: ['nouveau']
[178] INFO: Unloading modules ['nouveau'] (if loaded)
[182] INFO: switching=none, nothing to do
[204] INFO: Loading module nvidia
[204] ERROR: Xorg pre-start setup error
Traceback (most recent call last):
  File "/usr/lib/python3.9/site-packages/optimus_manager/hooks/pre_xorg_start.py", line 45, in main
    setup_kernel_state(config, prev_state, requested_mode)
  File "/usr/lib/python3.9/site-packages/optimus_manager/kernel.py", line 22, in setup_kernel_state
    _nvidia_up(config, hybrid=(requested_mode == "hybrid"))
  File "/usr/lib/python3.9/site-packages/optimus_manager/kernel.py", line 91, in _nvidia_up
    _load_nvidia_modules(config, available_modules)
  File "/usr/lib/python3.9/site-packages/optimus_manager/kernel.py", line 134, in _load_nvidia_modules
    _load_module(available_modules, "nvidia", options="NVreg_UsePageAttributeTable=%d" % pat_value)
  File "/usr/lib/python3.9/site-packages/optimus_manager/kernel.py", line 234, in _load_module
    raise KernelSetupError(
optimus_manager.kernel.KernelSetupError: module nvidia is not available for current kernel. Is the corresponding package installed ?
[204] INFO: Removing /etc/X11/xorg.conf.d/10-optimus-manager.conf (if present)
[204] INFO: Writing state {'type': 'pre_xorg_start_failed', 'switch_id': '20210104T000811', 'requested_mode': 'nvidia'}

So in both log files, it doesn’t recognize the module “nvidia”! They were working fine up until today. (Might it be potentially caused by me downgrading kernels in my previous post at https://forum.endeavouros.com/t/no-sound-from-laptop-speakers-and-mic-not-working-too/10928/16?)

Update: Upon switching back to Linux kernel 5.10.3 (so, undoing changes from the previous thread above) has restored GPU functionality as normal. But the audio is no longer working then!

which version python do you have ?

pacman -Qs python
python -V

if its python 3.8

update first te system, and reinstall optimus-manager from aur

In the log files for Optimus manager above, the version indicated is 3.9. Running “python -V” told me it’s version 3.9.1.

Meanwhile, I’ve tried downgrading my kernels further, and for all cases below so far, the GPU isn’t working:

  • 5.9.10.arch1-1-x86_64
  • 5.9.11.arch2-1-x86_64
  • 5.9.12.arch1-1-x86_64
  • 5.9.13.arch1-1-x86_64
  • 5.8.14.arch1-1-x86_64
  • 5.7.12.arch1-1-x86_64

Will keep trying to downgrade and report back my findings by editing the list above. Edit: 5.7 is my oldest kernel in my pacman cache, and I don’t think downgrading the kernel helps at this point.

The funny part is, my GPU has always been working even through all of the above mentioned kernels. Now, they no longer work except for the latest 5.10.3, but then my audio breaks…

Additionally, I’ll try 5.9.14 again and maybe reinstall optimus-manager instead? Could be more useful than blindly downgrading. Edit: Tried this through “yay” with Cleanbuild, but doesn’t work.

Instead of downgrading, I’ve tried switching to the Zen kernel instead:

5.10.3-zen1-1-zen-x86_64

This doesn’t work for me either, which is puzzling!

Have you tried the LTS kernel? linux-lts?

I’ve just made the switch to 5.4.86-1-lts as listed by “uname -r” but the GPU isn’t working still, I’m afraid! Audio works fine though.

I’ve noticed that the 5.10.4 update is out according to “yay”, so I installed it. Upon reboot, the GPU works (but not the audio as per previous thread). Alright, nothing funky so far.

So I’ve downgraded to 5.10.3 again to test. This time, the GPU doesn’t work despite working earlier! (Audio doesn’t work as normal) I’d like to speculate that Optimus Manager can only detect the latest kernel installed, but is unable to “roll back” to earlier nvidia modules?

For now, I’m staying on 5.9.14 as I’m prioritizing having audio over the GPU. Hopefully I’ll get to use both soon!

Reinstalling nvidia nvidia-settings nvidia-utils lib32-nvidia-utils optimus-manager-git while on 5.9.14 then rebooting doesn’t work either.

Doe didnt forgot mkinitcpio -P ?

nvidia driver needs to be builded against the running kernel, so it can not load module if this is not the case !

My output for sudo mkinitcpio -P is this:

==> Building image from preset: /etc/mkinitcpio.d/linux-lts.preset: 'default'
  -> -k /boot/vmlinuz-linux-lts -c /etc/mkinitcpio.conf -g /boot/initramfs-linux-lts.img
==> ERROR: specified kernel image does not exist: `/boot/vmlinuz-linux-lts'
==> Building image from preset: /etc/mkinitcpio.d/linux-lts.preset: 'fallback'
  -> -k /boot/vmlinuz-linux-lts -c /etc/mkinitcpio.conf -g /boot/initramfs-linux-lts-fallback.img -S autodetect
==> ERROR: specified kernel image does not exist: `/boot/vmlinuz-linux-lts'
==> Building image from preset: /etc/mkinitcpio.d/linux.preset: 'default'
  -> -k /boot/vmlinuz-linux -c /etc/mkinitcpio.conf -g /boot/initramfs-linux.img
==> Starting build: 5.9.14-arch1-1
  -> Running build hook: [base]
  -> Running build hook: [udev]
  -> Running build hook: [autodetect]
  -> Running build hook: [modconf]
  -> Running build hook: [block]
==> WARNING: Possibly missing firmware for module: xhci_pci
  -> Running build hook: [keyboard]
  -> Running build hook: [keymap]
  -> Running build hook: [filesystems]
  -> Running build hook: [fsck]
==> Generating module dependencies
==> Creating gzip-compressed initcpio image: /boot/initramfs-linux.img
==> Image generation successful
==> Building image from preset: /etc/mkinitcpio.d/linux.preset: 'fallback'
  -> -k /boot/vmlinuz-linux -c /etc/mkinitcpio.conf -g /boot/initramfs-linux-fallback.img -S autodetect
==> Starting build: 5.9.14-arch1-1
  -> Running build hook: [base]
  -> Running build hook: [udev]
  -> Running build hook: [modconf]
  -> Running build hook: [block]
==> WARNING: Possibly missing firmware for module: aic94xx
==> WARNING: Possibly missing firmware for module: wd719x
==> WARNING: Possibly missing firmware for module: xhci_pci
  -> Running build hook: [keyboard]
  -> Running build hook: [keymap]
  -> Running build hook: [filesystems]
  -> Running build hook: [fsck]
==> Generating module dependencies
==> Creating gzip-compressed initcpio image: /boot/initramfs-linux-fallback.img
==> Image generation successful
==> Building image from preset: /etc/mkinitcpio.d/linux-zen.preset: 'default'
  -> -k /boot/vmlinuz-linux-zen -c /etc/mkinitcpio.conf -g /boot/initramfs-linux-zen.img
==> ERROR: specified kernel image does not exist: `/boot/vmlinuz-linux-zen'
==> Building image from preset: /etc/mkinitcpio.d/linux-zen.preset: 'fallback'
  -> -k /boot/vmlinuz-linux-zen -c /etc/mkinitcpio.conf -g /boot/initramfs-linux-zen-fallback.img -S autodetect
==> ERROR: specified kernel image does not exist: `/boot/vmlinuz-linux-zen'

However, when I switch kernels I run sudo pacman -U <linux-version> <linux-headers-version> the above command is run automatically as shown towards the end:

loading packages...
warning: linux-5.9.14.arch1-1 is up to date -- reinstalling
warning: linux-headers-5.9.14.arch1-1 is up to date -- reinstalling
resolving dependencies...
looking for conflicting packages...

Packages (2) linux-5.9.14.arch1-1  linux-headers-5.9.14.arch1-1

Total Installed Size:  205.95 MiB
Net Upgrade Size:        0.00 MiB

:: Proceed with installation? [Y/n] 
(2/2) checking keys in keyring                     [----------------------] 100%
(2/2) checking package integrity                   [----------------------] 100%
(2/2) loading package files                        [----------------------] 100%
(2/2) checking for file conflicts                  [----------------------] 100%
:: Running pre-transaction hooks...
(1/1) Remove upgraded DKMS modules
:: Processing package changes...
(1/2) reinstalling linux                           [----------------------] 100%
(2/2) reinstalling linux-headers                   [----------------------] 100%
:: Running post-transaction hooks...
(1/5) Arming ConditionNeedsUpdate...
(2/5) Updating module dependencies...
(3/5) Install DKMS modules
(4/5) Updating linux initcpios...
==> Building image from preset: /etc/mkinitcpio.d/linux.preset: 'default'
  -> -k /boot/vmlinuz-linux -c /etc/mkinitcpio.conf -g /boot/initramfs-linux.img
==> Starting build: 5.9.14-arch1-1
  -> Running build hook: [base]
  -> Running build hook: [udev]
  -> Running build hook: [autodetect]
  -> Running build hook: [modconf]
  -> Running build hook: [block]
==> WARNING: Possibly missing firmware for module: xhci_pci
  -> Running build hook: [keyboard]
  -> Running build hook: [keymap]
  -> Running build hook: [filesystems]
  -> Running build hook: [fsck]
==> Generating module dependencies
==> Creating gzip-compressed initcpio image: /boot/initramfs-linux.img
==> Image generation successful
==> Building image from preset: /etc/mkinitcpio.d/linux.preset: 'fallback'
  -> -k /boot/vmlinuz-linux -c /etc/mkinitcpio.conf -g /boot/initramfs-linux-fallback.img -S autodetect
==> Starting build: 5.9.14-arch1-1
  -> Running build hook: [base]
  -> Running build hook: [udev]
  -> Running build hook: [modconf]
  -> Running build hook: [block]
==> WARNING: Possibly missing firmware for module: aic94xx
==> WARNING: Possibly missing firmware for module: wd719x
==> WARNING: Possibly missing firmware for module: xhci_pci
  -> Running build hook: [keyboard]
  -> Running build hook: [keymap]
  -> Running build hook: [filesystems]
  -> Running build hook: [fsck]
==> Generating module dependencies
==> Creating gzip-compressed initcpio image: /boot/initramfs-linux-fallback.img
==> Image generation successful
(5/5) Inform user to reboot after certain system package upgrades.
Reboot is recommended because of recent core system package upgrades.

I’ve reinstalled my current 5.9.14 for this example. Since pacman does this for me I believe it should not be the issue.

And which nvidia package do you use also? Dkms? The nvidia module must match and weird error on linux-lts

That sounds like a very plausible solution! Could you please hint me out ways to rebuild my current, pre-existing Nvidia drivers against my current running kernel?

I’m currently in a poor-internet location, so the method that I’ve discovered on my own, which is to run sudo nvidia-installer-dkms isn’t viable as it started downloading the drivers instead.

My /var/cache/pacman/pkg/ already has the latest nvidia-installer-dkms-3.3.8-3-any.pkg.tar.zst available, as well as various other Nvidia packages such as nvidia nvidia-settings nvidia-utils lib32-nvidia-utils at the latest version of nvidia-455.45.01-12-x86_64.

I have both nvidia-installer-db-2.4.11-2-any.pkg.tar.zst and nvidia-installer-dkms-3.3.8-3-any.pkg.tar.zst present in my /var/cache/pacman/pkg/.

Just need to figure out how to rebuild them against my current kernel in offline mode, i.e. without redownloading them! I’m currently on 5.9.14-arch1-1 as that is the latest kernel with working audio.

As for the LTS error, don’t worry as I’ve deleted them in /boot on purpose. The reason I intentionally deleted them manually was that upon switching kernels to LTS and Zen for my earlier test via sudo pacman -S, I was unable to switch back to the original, plain non-LTS/non-Zen kernel. It kept loading the Zen and LTS kernel upon me logging in (according to uname -r). From terminal analysis, I’ve deleted the /boot files directly, as opposed to searching for the solution to switch properly.

These are both scripts to install drivers and configure the system, the drivers themself are not inside these packages.

what I wanted to say is that kernel packages and Nvidia packages need to be even, meaning if you downgrade the kernel and headers you need to downgrade the Nvidia packages also to the same version used when that kernel was current, there is also a dkms version of NVidia package what will build the nvidia driver modules against all installed kernels automatic, but it looks like that dkms itself currently have issues but could be solved already.

for both current kernels and Nvidia packages it will be these combinations:

linux linux-headers  nvidia 
linux-lts linux-lts-headers nvidia-lts

For downgrades it would be this combinations:

nvidia 455.45.01-7: linux 5.9.14.arch1-1

nvidia 455.45.01-6: linux 5.9.13.arch1-1

nvidia 455.45.01-5: linux 5.9.12.arch1-1

As mentioned earlier, I’m currently on 5.9.14.arch1-1.
Thus I ran the following command, as per your suggestion for my version of Linux:

sudo pacman -U /var/cache/pacman/pkg/nvidia-455.45.01-7-x86_64.pkg.tar.zst

I then restarted my laptop, and voila! The GPU is working fine again! Many thanks to both of you (joekamprad and ringo!) pointing out Nvidia’s kernel interdependence, and listing them out for my sake. Is there a site which lists each corresponding Nvidia module to their Linux kernel, so I can refer to them myself in the future?

Whenever I updated my system, I simply entered yay into my terminal without paying much attention to it. While downgrading kernels earlier, I merely specified sudo pacman -U <linux> <linux-headers>. What could be yay doing in the background (that I may have missed out) that causes it to automatically invoke dkms etc.?

this will give the info… the changelog from packages side:
https://github.com/archlinux/svntogit-packages/commits/packages/nvidia/trunk

if you run yay it will update everything Repositories and AUR builds… and it will indeed invoke dkms if you have it in use…