Fedora 35 nvidia drivers for optimus laptop won't install/be used

I am running an Nvidia Optimus Dell XPS laptop and recently updated to F35, but, whatever I try, I can’t get the nvidia drivers to install and be used by the system. During startup I get the message:

NVIDIA kernel module missing. Falling back to nouveau

I am trying to get things working under Plasma/KDE with X11 for now. I do not have the option of “Run with discrete GPU” when trying to right-click application, nor do I see my NVIDIA device listed under system information or from using screenfetch.

I have secureboot disabled from within my Dell settings:

[jdl@astro ~]$ mokutil --sb-state
SecureBoot disabled

I don’t really know at all how Secure Boot plays with BIOS/UEFI, so maybe this is useless information: I am booting into UEFI, and not “Legacy” mode. This seems to suggest the “Legacy” option is needed to disable secure boot, but I cannotuse this option owing to this issue. Although it does seem I am booting without secure boot enabled from every check I can find to do within the OS, and I found this comment suggesting it is doable

To install the drivers I have followed the instructions here, namely:

sudo dnf remove '*nvidia*'
sudo dnf update --all
sudo dnf install gcc kernel-headers kernel-devel akmod-nvidia xorg-x11-drv-nvidia xorg-x11-drv-nvidia-libs xorg-x11-drv-nvidia-libs.i686
# wait 10 minutes
sudo akmods --force && sudo dracut --force
# wait 5 minutes

As well as some others in the past, the details of which I don’t recall fully.

If anyone can spot something I am doing wrong, or other things to check, please let me know. Most solutions on similar threads I think are covered above with no luck, or not relevant (e.g. old card model).

Many thanks.

System/start-up details:

[jdl@astro ~]$ uname -a
Linux astro 5.16.18-200.fc35.x86_64 #1 SMP PREEMPT Mon Mar 28 14:10:07 UTC 2022 x86_64 x86_64 x86_64 GNU/Linux

[jdl@astro ~]$ lspci | grep -E 'VGA|3D'
00:02.0 VGA compatible controller: Intel Corporation HD Graphics 630 (rev 04)
01:00.0 3D controller: NVIDIA Corporation GP107M [GeForce GTX 1050 Mobile] (rev a1)

[jdl@astro ~]$ lsmod | grep nvidia
[jdl@astro ~]$ lsmod | grep nouveau
nouveau              2387968  1
drm_ttm_helper         16384  1 nouveau
i2c_algo_bit           16384  2 i915,nouveau
ttm                    81920  3 drm_ttm_helper,i915,nouveau
drm_kms_helper        315392  2 i915,nouveau
mxm_wmi                16384  1 nouveau
drm                   634880  25 drm_kms_helper,drm_ttm_helper,i915,ttm,nouveau
wmi                    32768  7 intel_wmi_thunderbolt,dell_wmi,wmi_bmof,dell_smbios,dell_wmi_descriptor,mxm_wmi,nouveau
video                  57344  4 dell_wmi,dell_laptop,i915,nouveau

[jdl@astro ~]$ sudo dmidecode | grep -A3 '^System Information'
System Information
	Manufacturer: Dell Inc.
	Product Name: XPS 15 9560
	Version: Not Specified

[jdl@astro ~]$ sudo grubby --default-kernel
[jdl@astro ~]$ sudo grubby --info /boot/vmlinuz-5.16.18-200.fc35.x86_64
args="ro rootflags=subvol=root rd.luks.uuid=luks-42e228ff-8482-46d5-b60f-f55afa846c7d rd.luks.uuid=luks-5a932c1f-1c15-45ed-baad-77a129f4e71e rhgb quiet systemd.unified_cgroup_hierarchy=0 rd.driver.blacklist=nouveau modprobe.blacklist=nouveau nvidia-drm.modeset=1"
title="Fedora Linux (5.16.18-200.fc35.x86_64) 35 (Workstation Edition)"

I have tried it with both nvidia-drm.modeset=1 and nvidia-drm.modeset=0 in the start up args.

1 Like

There are many posts on this forum about exactly this issue.

The fix in almost all cases has been to disable secure boot in the bios.

To verify if that is the cause for you the command dmesg | grep -iE "secure|nvidia" will return the pertinent info. If it returns a line that says secureboot: Secure boot enabled then it certainly is the cause of the nvidia driver not loading. Additional info that shows the failure of nvidia to load will also be shown.

You stated that secure boot is disabled, but the messages say that may not be the case.

You also should post the output of sudo dnf list installed \*nvidia*

1 Like

I know there are many posts. But to my knowledge I have followed all instructions an solutions to no avail, so I resorted to posting - sorry for the clutter.

For my information, where does it suggest in the messages above that secure boot is not disabled?

Your dmesg search returns nothing.

[jdl@astro ~]$ dmesg | grep -iE "secure|nvidia"
[jdl@astro ~]$ sudo dnf list installed \*nvidia*
Installed Packages
akmod-nvidia.x86_64                                3:510.60.02-1.fc35         @rpmfusion-nonfree-updates
kmod-nvidia-5.16.18-200.fc35.x86_64.x86_64         3:510.60.02-1.fc35         @@commandline             
nvidia-persistenced.x86_64                         3:510.60.02-1.fc35         @rpmfusion-nonfree-updates
nvidia-settings.x86_64                             3:510.60.02-1.fc35         @rpmfusion-nonfree-updates
xorg-x11-drv-nvidia.x86_64                         3:510.60.02-1.fc35         @rpmfusion-nonfree-updates
xorg-x11-drv-nvidia-cuda.x86_64                    3:510.60.02-1.fc35         @rpmfusion-nonfree-updates
xorg-x11-drv-nvidia-cuda-libs.i686                 3:510.60.02-1.fc35         @rpmfusion-nonfree-updates
xorg-x11-drv-nvidia-cuda-libs.x86_64               3:510.60.02-1.fc35         @rpmfusion-nonfree-updates
xorg-x11-drv-nvidia-kmodsrc.x86_64                 3:510.60.02-1.fc35         @rpmfusion-nonfree-updates
xorg-x11-drv-nvidia-libs.i686                      3:510.60.02-1.fc35         @rpmfusion-nonfree-updates
xorg-x11-drv-nvidia-libs.x86_64                    3:510.60.02-1.fc35         @rpmfusion-nonfree-updates
xorg-x11-drv-nvidia-power.x86_64                   3:510.60.02-1.fc35         @rpmfusion-nonfree-updates

Posting is not a clutter nor a bother. We are here to assist as we can and I enjoy it when a problem is solved. :smiley:

The fact that dmesg gives you no results is concerning. On my system I get the below and a lot more. I have secure boot disabled as you can see, and the nvidia driver loads properly. I only posted the first 4 lines from the dmesg output with that command.

$ dmesg | grep -iE "secure|nvidia"
[    0.000000] Command line: BOOT_IMAGE=(hd0,gpt5)/vmlinuz-5.16.18-200.fc35.x86_64 root=/dev/mapper/fedora_laptop-root ro rd.lvm.lv=fedora_laptop/root rhgb quiet rd.driver.blacklist=nouveau modprobe.blacklist=nouveau nvidia-drm.modeset=1
[    0.000000] secureboot: Secure boot disabled
[    0.017214] secureboot: Secure boot disabled
[    0.071759] Kernel command line: BOOT_IMAGE=(hd0,gpt5)/vmlinuz-5.16.18-200.fc35.x86_64 root=/dev/mapper/fedora_laptop-root ro rd.lvm.lv=fedora_laptop/root rhgb quiet rd.driver.blacklist=nouveau modprobe.blacklist=nouveau nvidia-drm.modeset=1

If you are unable to get an output from dmesg then there is something else going on.

First try dmesg to see if you get a response. If none then try to fix the system before you do anything else.
sudo dnf upgrade --refresh followed by sudo dnf distro-sync and that followed by a reboot would be a good first step.

1 Like

Well it is much appreciated, thanks. So it seems my dmesg output is significantly clipped, the first entry I see is:

[31987.811600] nvme 0000:04:00.0:    [ 0] RxErr 

but there are a fair bunch of lines. I don’t know if the buffer for dmesg is too small to hold the entire output?

Anyway, after some hunting around I can call

[jdl@astro ~]$ journalctl --dmesg | grep -i secure
Mar 31 10:28:35 astro kernel: secureboot: Secure boot disabled
Mar 31 10:28:35 astro kernel: secureboot: Secure boot disabled
Mar 31 10:28:35 astro kernel: integrity: Loaded X.509 cert 'Fedora Secure Boot CA: fde32599c2d61db1bf5807335d7b20e4cd963b42'

which I think indeed confirms it.

For good measure I ran the upgrade and distro-sync, which updated some irrelevant packages and had “Nothing to do”, respectively.

For information/confirmation of why it isn’t loading:

Mar 31 21:32:50 astro kernel: nvidia: loading out-of-tree module taints kernel.
Mar 31 21:32:50 astro kernel: nvidia: module license 'NVIDIA' taints kernel.
Mar 31 21:32:50 astro kernel: nvidia: module verification failed: signature and/or required key missing - tainting kernel
Mar 31 21:32:54 astro kernel: nouveau 0000:01:00.0: NVIDIA GP107 (137000a1)

That output from dmesg means it has had a lot of entries since your last boot.
The command I provided should be run immediately after a reboot so you can see the entries before they are pushed out of the buffer by later entries.

The journalctl post shows secureboot is disabled, but it still does not load.

Try these steps to ensure all the needed packages are installed and that the kernel module gets properly built. It may be a little overkill, but should succeed.
sudo dnf remove kmod-nvidia*
sudo dnf reinstall akmod-nvidia kernel-devel nvidia-* xorg-x11-drv-nvidia* kernel*
That should reinstall all the appropriate packages and trigger akmods to rebuild the kernel module for nvidia.
After a couple minutes you should be able to reboot then the dmesg command I gave above should show the status of loading the nvidia driver module.
You could also do lsmod | grep -iE 'nouveau|nvidia' and if the nvidia module has loaded properly it should list the nvidia modules and not the nouveau modules.

Right - so I ran through the reinstall, and as part of that noticed something:

make -j8 KERNELRELEASE=5.16.18-200.fc35.x86_64 KVERSION=5.16.18-200.fc35.x86_64...(bad exit status: 2)
Error! Bad return status for module build on kernel: 5.16.18-200.fc35.x86_64 (x86_64)
Consult /var/lib/dkms/bbswitch/0.8.0/build/make.log for more information.

bbswitch! I recall eons ago installing that when I unsuccessfully tried to get things working with the discrete GPU.

Anyway, unscientifically, I also did a:

$ sudo dnf remove bbswitch-dkms.x86_64

before restarting. It seems the NVIDIA module is now loading (yay) although I can’t say if it was the reinstall or removing bbswitch that did it. At least another thing for people to check who might have the same issue.

When I run screenfetch now, it identifies the NVIDIA card as the GPU, although I though optimus laptops should show both the integrated and discrete together? Weirdly the “About this system” information still shows the integrated card under “Graphics Processor”.

Anyway, things like nvidia-smi now work, and when I ran some 4k video I could see the temp increasing, so I am guessing it is working!

Now to try the switch to Wayland…

Many thanks for your help @computersavvy !

1 Like

My guess would be that finding that bbswitch error and removing that package was the answer. bbswitch is not required and likely interfered.

Good luck. :+1: