Linux
Fedora
Nvidia
optimus
secureboot
drivers
This has been eluding me for a looooong time. Since I got a new SSD anyway, I thought it would be a good time to do a clean install of Fedora 34 and see if I can get my nvidia dGPU to work. There are tons of manuals out there, but none of them match my setup. First of all, linux distro's are starting to switch to Wayland by default, so all the ones that describe how to do it on X11 are outdated. Also, X11 doesn't handle my dual hidpi/lowdpi monitors elegantly, so I prefer Wayland anyway. Secondly, since i also have windows 11 on this laptop, I need secureboot turned on. Which most of them tell you to turn off. ANd lastly, there are guides how to set it up with Bumblebee, but recent Fedora/Gnome version say it should work with PRIME_RENDER_OFFLOAD environment variables only. So I had to find a bunch of different manuals to piece the different parts together, but eventually I made it work. Maybe there are some details I forgot, or there may be something that is slightly different in your setup, but this probably is a lot closer if you're in the same boat as me.
From https://gist.github.com/reillysiemens/ac6bea1e6c7684d62f544bd79b2182a4
Create this script in /root/module-signing/sign_module. This is just for convenience so you don't have to remember the commands later. It allows you to specify a kernel module, which gets signed using the keys created and renrolled below.
Create the keypair with
Enroll this keypair with (this will ask for a password that you will need to enter later. Don't loose it.)
Now reboot your laptop, and when prompted, enter the password you just added to the key.
From https://forum.manjaro.org/t/howto-use-wayland-with-propietary-nvidia-drivers/36130
In /etc/gdm/custom.conf
make sure the line with WaylandEnabled=false
is commented
In /usr/lib/udev/rules.d/61-gdm.rules
comment all the lines that disable wayland in gdm with nvidia drivers:
Enable kms-modifiers to enable Vulkan an OpenGL on wayland:
Make a file /etc/modprobe.d/nvidia-blacklist.conf
with the following content:
Blacklist the module too in grub. In /etc/default/grub
on the line with GRUB_CMDLINE_LINUX
add this at the end of the line, before the closing quote (after quiet
usually):
Uninstall xorg-x11-drv-nouveau.
Update dnf:
In the gnome software center, under repositories (in the hamburger menu), you need to enable the RPM Fusion for Fedora 32 - Nonfree - NVIDIA Driver
repository.
Update your software and refresh the list:
Install the drivers:
Force build the initramfs and kernel module with:
This needs to be done every time a new kernel module is built. Like on every kernel update.
You can run sudo /root/module-signing/sign_module nvidia && sudo /root/module-signing/sign_module nvidia-uvm
After a reboot, hopefully the kernel module is loaded.
If you dnf install glxspheres64
you can test it with:
which on the commandline should tell you it's running using the nvidia GPU: