How to Set Nvidia as Primary GPU on Optimus-based Laptops

I’m trying to have the NVIDIA GPU enabled on my ASUS TUF Dash F15 with NVIDIA GA106M [GeForce RTX 3060 Mobile / Max-Q].
The command

sudo akmods --force

provides the following output:

Checking kmods exist for 6.9.10-200.fc40.x86_64Warning: Could not determine what package owns /lib/modules/6.9.10-200.fc40.x86_64/extra/nvidi [ OK ]

I haven’t found any help on how to overcome this error.
Can anyone tell me how I can proceed?

1 Like

That’s a warning and not an error - the kernel module exists. Did you perhaps use the nvidia website script before trying to install the drivers from RPMFusion?

The title suggests you’re trying to run on the discrete GPU exclusively instead of the integrated. Sometimes there is a BIOS setting for this and that’s the approach I would recommend. Otherwise, I know there’s a method @computersavvy has shared a number of times here for doing it with an Xorg.conf for X11. I’m otherwise not sure how to do this with Wayland if you don’t have a BIOS option.

By default, Optimus lets you run on the integrated GPU for regular workloads and use the Discrete for things like gaming. On Gnome, when you launch something, right click and you should see an option for “Run on Discrete Graphics” and then you’ll use the nvidia card for that. You can also set DRI_PRIME=1 in the Desktop file or launching things from terminal.

Hey there, Welcome to :fedora:

Can you provide the output of inxi -Fzxx for us to better understand your hardware

I’ve been using switcherooctl launch for the same effect. although DRI_PRIME=X is pretty ubiquitous.

Hi, thanks for the help.

This is the output of inxi -Fzxx

System:
  Kernel: 6.9.10-200.fc40.x86_64 arch: x86_64 bits: 64 compiler: gcc
    v: 2.41-37.fc40
  Desktop: GNOME v: 46.3.1 tk: GTK v: 3.24.43 wm: gnome-shell dm: GDM
    Distro: Fedora Linux 40 (Workstation Edition)
Machine:
  Type: Laptop System: ASUSTeK product: ASUS TUF Dash F15 FX517ZM_FX517ZM
    v: 1.0 serial: <superuser required>
  Mobo: ASUSTeK model: FX517ZM v: 1.0 serial: <superuser required>
    UEFI: American Megatrends LLC. v: FX517ZM.318 date: 06/28/2023
Battery:
  ID-1: BAT1 charge: 62.6 Wh (100.0%) condition: 62.6/75.8 Wh (82.6%)
    volts: 16.8 min: 15.9 model: ASUS A32-K55 serial: N/A status: full
CPU:
  Info: 10-core (6-mt/4-st) model: 12th Gen Intel Core i7-12650H bits: 64
    type: MST AMCP arch: Alder Lake rev: 3 cache: L1: 864 KiB L2: 9.5 MiB
    L3: 24 MiB
  Speed (MHz): avg: 525 high: 849 min/max: 400/4600:4700:3500 cores: 1: 400
    2: 400 3: 642 4: 400 5: 623 6: 400 7: 628 8: 400 9: 648 10: 400 11: 652
    12: 400 13: 400 14: 849 15: 400 16: 764 bogomips: 86016
  Flags: avx avx2 ht lm nx pae sse sse2 sse3 sse4_1 sse4_2 ssse3 vmx
Graphics:
  Device-1: Intel Alder Lake-P GT1 [UHD Graphics] vendor: ASUSTeK driver: i915
    v: kernel arch: Gen-12.2 ports: active: eDP-1 empty: DP-1,DP-2
    bus-ID: 0000:00:02.0 chip-ID: 8086:46a3
  Device-2: NVIDIA GA106M [GeForce RTX 3060 Mobile / Max-Q] vendor: ASUSTeK
    driver: nvidia v: 555.58 arch: Ampere bus-ID: 0000:01:00.0
    chip-ID: 10de:2520
  Device-3: IMC Networks USB2.0 HD UVC WebCam driver: uvcvideo type: USB
    rev: 2.0 speed: 480 Mb/s lanes: 1 bus-ID: 3-7:3 chip-ID: 13d3:56a2
  Display: x11 server: X.Org v: 1.20.14 with: Xwayland v: 24.1.1
    compositor: gnome-shell driver: X: loaded: modesetting failed: nvidia
    alternate: fbdev,nouveau,nv,vesa dri: iris gpu: i915 display-ID: :1
    screens: 1
  Screen-1: 0 s-res: 1920x1080 s-dpi: 96
  Monitor-1: eDP-1 model: Najing CEC Panda 0x004d res: 1920x1080 dpi: 142
    diag: 395mm (15.5")
  API: OpenGL v: 4.6 vendor: intel mesa v: 24.1.4 glx-v: 1.4 es-v: 3.2
    direct-render: yes renderer: Mesa Intel Graphics (ADL GT2)
    device-ID: 8086:46a3
  API: EGL Message: EGL data requires eglinfo. Check --recommends.
Audio:
  Device-1: Intel Alder Lake PCH-P High Definition Audio vendor: ASUSTeK
    driver: snd_hda_intel v: kernel bus-ID: 0000:00:1f.3 chip-ID: 8086:51c8
  Device-2: NVIDIA GA106 High Definition Audio vendor: ASUSTeK
    driver: snd_hda_intel v: kernel bus-ID: 0000:01:00.1 chip-ID: 10de:228e
  Device-3: ASUSTek C-Media Audio driver: hid-generic,snd-usb-audio,usbhid
    type: USB rev: 2.0 speed: 12 Mb/s lanes: 1 bus-ID: 3-9:4 chip-ID: 0b05:6206
  API: ALSA v: k6.9.10-200.fc40.x86_64 status: kernel-api
  Server-1: JACK v: 1.9.22 status: off
  Server-2: PipeWire v: 1.0.7 status: active with: 1: pipewire-pulse
    status: active 2: wireplumber status: active 3: pipewire-alsa type: plugin
Network:
  Device-1: Intel Alder Lake-P PCH CNVi WiFi driver: iwlwifi v: kernel
    bus-ID: 0000:00:14.3 chip-ID: 8086:51f0
  IF: wlo1 state: down mac: <filter>
  Device-2: Intel Ethernet I219-LM vendor: ASUSTeK driver: e1000e v: kernel
    port: N/A bus-ID: 0000:00:1f.6 chip-ID: 8086:1a1e
  IF: eno2 state: up speed: 1000 Mbps duplex: full mac: <filter>
Bluetooth:
  Device-1: Intel AX201 Bluetooth driver: btusb v: 0.8 type: USB rev: 2.0
    speed: 12 Mb/s lanes: 1 bus-ID: 3-10:5 chip-ID: 8087:0026
  Report: btmgmt ID: hci0 rfk-id: 0 state: up address: <filter> bt-v: 5.2
    lmp-v: 11
RAID:
  Hardware-1: Intel Volume Management Device NVMe RAID Controller driver: vmd
    v: 0.6 bus-ID: 0000:00:0e.0 chip-ID: 8086:467f
Drives:
  Local Storage: total: 1.39 TiB used: 33.18 GiB (2.3%)
  ID-1: /dev/nvme0n1 vendor: Crucial model: CT500P5PSSD8 size: 465.76 GiB
    speed: 63.2 Gb/s lanes: 4 serial: <filter> temp: 56.9 C
  ID-2: /dev/nvme1n1 vendor: Samsung model: MZVLQ1T0HBLB-00B00
    size: 953.87 GiB speed: 31.6 Gb/s lanes: 4 serial: <filter> temp: 31.9 C
Partition:
  ID-1: / size: 464.17 GiB used: 32.71 GiB (7.0%) fs: btrfs
    dev: /dev/nvme0n1p3
  ID-2: /boot size: 973.4 MiB used: 462.6 MiB (47.5%) fs: ext4
    dev: /dev/nvme0n1p2
  ID-3: /boot/efi size: 598.8 MiB used: 19 MiB (3.2%) fs: vfat
    dev: /dev/nvme0n1p1
  ID-4: /home size: 464.17 GiB used: 32.71 GiB (7.0%) fs: btrfs
    dev: /dev/nvme0n1p3
Swap:
  ID-1: swap-1 type: zram size: 8 GiB used: 0 KiB (0.0%) priority: 100
    dev: /dev/zram0
Sensors:
  System Temperatures: cpu: 43.0 C mobo: N/A
  Fan Speeds (rpm): cpu: 0
Info:
  Memory: total: 32 GiB note: est. available: 30.97 GiB used: 3.1 GiB (10.0%)
  Processes: 486 Power: uptime: 1h 44m wakeups: 1 Init: systemd v: 255
    target: graphical (5) default: graphical
  Packages: pm: flatpak pkgs: 28 Compilers: gcc: 14.1.1 Shell: Bash
    v: 5.2.26 running-in: gnome-terminal inxi: 3.3.34

Probably yes, I’m a mess I don’t remember exactly what I did when after installing Fedora, only now I realized that the GPU is not active, in particular I needed it to be able to use a second monitor

1 Like

I think the best practice would be to uninstall the current driver and dependencies and reinstall them with RPMFusion. So give me a moment and I’ll provide some commands for you.

Note:

  • Do you still have the .run file from the previous install ?
1 Like

Yes I found it

NVIDIA-Linux-x86_64-555.58.run

1 Like

To completely remove the files installed with that .run file the command would be something like sudo /path/to/NVIDIA-Linux-x86-x64_64-555.58.run --uninstall.

Once that completes then install the drivers from rpmfusion.

  1. Verify that you have the rpmfusion-nonfree-nvidia-driver repo enabled with the command
    dnf repolist.
    If it is not enabled then it can be enabled by opening the gnome software app and using the ‘hamburger’ menu in the upper right corner then selecting the repos option and enable that repo.
  2. install the drivers with sudo dnf install akmod-nvidia xorg-x11-drv-nvidia-cuda
  3. Wait at least 5 minutes then reboot and the newer drivers from rpmfusion should now be active.

Note that the drivers installed with the nvidia .run file are compiled with dkms, so using akmods will not work to update the drivers and that is why the error in the OP occurred.

3 Likes

Clockwork :+1:t5: :fedora:

2 Likes

Well, everything seems ok, the second monitor is now up and running.
In the system menu I find the following situation:

Citazione
#Rapporto sui dettagli del sistema
Modello hardware:** ASUSTeK COMPUTER INC. ASUS TUF Dash F15 FX517ZM_FX517ZM
Memoria: 32,0 GiB
Processore: 12th Gen Intel® Core™ i7-12650H × 16
Scheda grafica: Intel® Graphics (ADL GT2)
Scheda grafica 1: NVIDIA GeForce RTX™ 3060 Laptop GPU
Capacità del disco: 1,5 TB
Informazioni sul software:
Versione del firmware: FX517ZM.318
Nome del sistema operativo Fedora Linux 40 (Workstation Edition)
Build del sistema operativo (null)
Tipo di sistema operativo 64-bit
Versione di GNOME: 46
Gestore grafico: Wayland
Versione del kernel: Linux 6.9.10-200.fc40.x86_64

It’s correct?
Because before the graphics manager was x11, now it is Wayland.

2 Likes

Wayland is definitely preferred over X11 unless you have some specific legacy or 3rd party need for it. If you’re not sure, I would stick with wayland.

1 Like

Here is a wild and off topic question. What’s the viability of using XWayland to launch some of these legacy/3rd party apps. If you know we can split the conversation here and continue anew.

The short answer is very good for most things. The long answer is that there are numerous topics about this here. RHEL10 is planning on dropping X11 entirely for DEs and falling back to XWayland. There are a bunch of caveats to that, many of which are DE and specialty specific. For most users, this is the way to go.

1 Like