I need help installing nvidia drivers for my RTX3060 laptop gpu

Hello everyone.
I need help installing nvidia drivers for my RTX3060 laptop gpu.
I first tried installing the official nvidia drivers from nvidia.com, but that didn’t work.
I also followed this guide: https://docs.fedoraproject.org/en-US/quick-docs/how-to-set-nvidia-as-primary-gpu-on-optimus-based-laptops/
That didn’t work either.
I don’t know what to do and the “screenfetch” command displays my gpu.

Hello Pierre and welcome to ask :fedora:

Please show us the output of dnf repolist so we cn verify that you have at least the rpmfusion-nonfree-nvidia-driver repo enabled. That repo would have been enabled if you chose to enable the 3rd party repos within the gnome software app.

If you installed the drivers directly from nvidia.com then you might have a conflicting package installed that could prevent a clean install from the rpmfusion repo. Those packages would need to be fully removed to avoid conflicts.

Normally I would suggest that you do a clean install from the beginning but we can probably recover.

  1. check the status of secure boot with mokutil --sb-state. If enabled then you have 2 options.
    a. disable secure boot within the bios so it allows unsigned kernel modules to load
    b. Create a signing key and import it into the bios so the kernel module will be signed at time of compile then loaded during boot. Instructions for that are in the file usr/share/doc/akmods/README.secureboot

Note that if you do not have the package akmods installed that must be done before anything in step 1 except disabling secure boot can be performed.

  1. install the kernel modules from rpmfusion then allow adequate time for the compile to complete before rebooting. sudo dnf install akmod-nvidia xorg-x11-drv-nvidia-cuda will install both the nvidia drivers and the cuda software. If you have any error messages when performing this step please post the exact details as copy&paste from your screen.

You did not state how the process failed when following the instructions from the fedora documentation so we are left guessing as to the actual symptoms and/or errors you saw.

Hi. thank you for taking the time to help me
output of dnf repolist :

copr:copr.fedorainfracloud.org:phracek:PyCharm Copr repo for PyCharm owned by phracek
fedora Fedora 38 - x86_64
fedora-cisco-openh264 Fedora 38 openh264 (From Cisco) - x86_64
fedora-modular Fedora Modular 38 - x86_64
google-chrome google-chrome
rpmfusion-free RPM Fusion for Fedora 38 - Free
rpmfusion-free-updates RPM Fusion for Fedora 38 - Free - Updates
rpmfusion-nonfree RPM Fusion for Fedora 38 - Nonfree
rpmfusion-nonfree-nvidia-driver RPM Fusion for Fedora 38 - Nonfree - NVIDIA Driver
rpmfusion-nonfree-steam RPM Fusion for Fedora 38 - Nonfree - Steam
rpmfusion-nonfree-updates RPM Fusion for Fedora 38 - Nonfree - Updates
updates Fedora 38 - x86_64 - Updates
updates-modular Fedora Modular 38 - x86_64 - Updates

Secure boot is disabled, and output of sudo dnf install akmod-nvidia xorg-x11-drv-nvidia-cuda is

Last metadata expiration check performed 2:17:20 ago on Sat Aug 26, 2023 09:33:30.
The package akmod-nvidia-3:535.98-1.fc38.x86_64 is already installed.
The package xorg-x11-drv-nvidia-cuda-3:535.98-2.fc38.x86_64 is already installed.
Dependencies resolved.
Nothing left to do.
Done!

When I did the installation before, the installer tells me that I’m in the x server and that I have to exit it to continue the installation. This time, it tells me that the drivers are already installed with another program.

Here’s what I got:

The NVIDIA driver appears to have been installed previously using a different installer. To prevent potential conflicts, it is recommended either to update the existing installation using the same mechanism by which it was originally
installed, or to uninstall the existing installation before installing this driver.

I take this as good news?

Update: After a reboot, the gpu still doesn’t work.

Not a good news post.

It seems to indicate that the earlier installed drivers are still there and active. They must be uninstalled before the drivers from rpmfusion can be properly installed and activated.

I tryed but i get this when i retryed

ERROR: Unable to load the kernel module ‘nvidia.ko’. This happens most frequently when this kernel module was built against the wrong or improperly configured kernel sources, with a version of gcc that differs from the one used to
build the target kernel, or if another driver, such as nouveau, is present and prevents the NVIDIA kernel module from obtaining ownership of the NVIDIA device(s), or no NVIDIA device installed in this system is supported by
this NVIDIA Linux graphics driver release.
Please see the log entries ‘Kernel module load error’ and ‘Kernel messages’ at the end of the file ‘/var/log/nvidia-installer.log’ for more information.

The log file: nvidia-installer-log.txt - Google Drive

This from your log clearly shows that you did not have the driver from rpmfusion.

creation time: Sat Aug 26 17:09:32 2023
installer version: 535.104.05

The rpmversion at present would show version 535.98

# dnf list installed akmod-nvidia
Installed Packages
akmod-nvidia.x86_64                                 3:535.98-1.fc38                                 @rpmfusion-nonfree-nvidia-driver

and does not create that installer log.

As stated earlier, this is an either -- or situation.
Either
you install the driver from nvidia and deal with any problems that occur
or
you install the driver from rpmfusion which has been tweaked and tested to function properly with fedora and almost never have any following problems.

Your choice.
I cannot assist with problems that may crop up when installing drivers directly from nvidia since I do not use that install method and do not have a test machine to use for comparison.

The driver from nvidia must be uninstalled before you can install and use the driver from rpmfusion.

I ran this command as you told me:

sudo dnf install akmod-nvidia xorg-x11-drv-nvidia-cuda

Isn’t this the rpm fusion thing? And how the heck am i supposed to uninstall nvidia drivers ? I’m sorry but I don’t think I understand.