How to switch from integrated GPU to NVIDIA?

my laptop has 2 GPUS, an intel HD and and NVIDIA card. i read somewhere that to figure out which is being used you run glxinfo | grep OpenGL and that gives me the following output:

OpenGL vendor string: Intel
OpenGL renderer string: Mesa Intel(R) UHD Graphics 630 (CFL GT2)
OpenGL core profile version string: 4.6 (Core Profile) Mesa 21.3.2
OpenGL core profile shading language version string: 4.60
OpenGL core profile context flags: (none)
OpenGL core profile profile mask: core profile
OpenGL core profile extensions:
OpenGL version string: 4.6 (Compatibility Profile) Mesa 21.3.2
OpenGL shading language version string: 4.60
OpenGL context flags: (none)
OpenGL profile mask: compatibility profile
OpenGL extensions:
OpenGL ES profile version string: OpenGL ES 3.2 Mesa 21.3.2
OpenGL ES profile shading language version string: OpenGL ES GLSL ES 3.20
OpenGL ES profile extensions:

i have nvidia-dkms installed but apparently just having it installed is not enough. what must i do to switch to my NVIDA GPU? i’m currently using i3 as my WM.

If you can connect an external monitor via HDMI it should switch on Nvidia on that monitor. Else you would have to install optimus-manager via AUR. If you run kde they also have a version for plasma showing an icon in the system tray to switch cards on your laptop.

A third option would be to turn off hybrid mode in UEFI/bios but then you need to make sure to blacklist nouveau in grub so you don’t get a black screen and can boot straight into Nvidia for maximum performance.

More infos on your hardware and installed drivers would be appropriate to get better support.

https://discovery.endeavouros.com/forum-log-tool-options/how-to-include-systemlogs-in-your-post/2021/03/

You can use optimus manager to completely switch back and forth easily, but you should also be able to use prime-run to offload a program as well. See if this works:
prime-run glxinfo | grep -i opengl

1 Like

I installed optimus-manager but I keep getting an error. I think I would like @Zircon34 's suggestion to add the kernel param to boot directly into nvidia but i might do that some other time. I’m afraid to brick my computer and that’s the last thing i need right now lol

[9] INFO: # Xorg pre-start hook
[9] INFO: Previous state was: {'type': 'pending_pre_xorg_start', 'requested_mode': 'integrated', 'current_mode': None}
[9] INFO: Requested mode is: integrated
[118] INFO: Available modules: ['nouveau', 'nvidia', 'nvidia_drm', 'nvidia_modeset', 'nvidia_uvm']
[118] INFO: Unloading modules ['nvidia_drm', 'nvidia_modeset', 'nvidia_uvm', 'nvidia'] (if loaded)
[121] INFO: Cannot unload modules: None
[121] INFO: Waiting 1s and retrying.
[1126] INFO: Cannot unload modules: None
[1126] INFO: Waiting 1s and retrying.
[2135] INFO: Cannot unload modules: None
[2135] INFO: Waiting 1s and retrying.
[3141] INFO: Cannot unload modules: None
[3141] INFO: Waiting 1s and retrying.
[4145] INFO: Cannot unload modules: None
[4145] INFO: Waiting 1s and retrying.
[5155] INFO: Max tries (6) exceeded
[5155] ERROR: Xorg pre-start setup error
Traceback (most recent call last):
  File "/usr/lib/python3.10/site-packages/optimus_manager/kernel.py", line 269, in _unload_modules
    subprocess.check_call(
  File "/usr/lib/python3.10/subprocess.py", line 369, in check_call
    raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command 'modprobe -r nvidia_drm nvidia_modeset nvidia_uvm nvidia' returned non-zero exit status 1.

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/usr/lib/python3.10/site-packages/optimus_manager/hooks/pre_xorg_start.py", line 51, in main
    setup_kernel_state(config, prev_state, requested_mode)
  File "/usr/lib/python3.10/site-packages/optimus_manager/kernel.py", line 25, in setup_kernel_state
    _nvidia_down(config)
  File "/usr/lib/python3.10/site-packages/optimus_manager/kernel.py", line 104, in _nvidia_down
    _unload_nvidia_modules(available_modules)
  File "/usr/lib/python3.10/site-packages/optimus_manager/kernel.py", line 214, in _unload_nvidia_modules
    _unload_modules(available_modules, ["nvidia_drm", "nvidia_modeset", "nvidia_uvm", "nvidia"])
  File "/usr/lib/python3.10/site-packages/optimus_manager/kernel.py", line 277, in _unload_modules
    raise KernelSetupError(f"Cannot unload modules {modules_to_unload}: {e.stderr}") from e
optimus_manager.kernel.KernelSetupError: Cannot unload modules ['nvidia_drm', 'nvidia_modeset', 'nvidia_uvm', 'nvidia']: None
[5155] INFO: Removing /etc/X11/xorg.conf.d/10-optimus-manager.conf (if present)
[5155] INFO: Writing state {'type': 'pre_xorg_start_failed', 'switch_id': '20211230T235412', 'requested_mode': 'integrated'}

What command did you enter in your terminal to get that output? Please post always input and output so it’s easier to follow. Perhaps we can make Optimus work.

I do always install the Nvidia driver plus nvidia-settings first and connect an external monitor to see if it works and switches on. Then when the drivers are properly working, I try installing optimus-manager, just fyi.

I did not have good experience with prime but that was about a year ago and abandoned this method. I rather switch off the Intel in the bios/UEFI and only run my Nvidia. But that is personal preference.

Edit: just in case you missed this info…

my bad. so, i installed the optimus-manger and then had to manually start the service (though the docs say that the service should start automaticall after installation) with systemctl start optimus-manager.service and then i ran optimus-manager --switch nvidia. that’s what produced the previous error.
i do have the nvidia drivers and nvidia-settings installed but i haven’t tried connecting it to an external monitor. i’ll give it a try.

sudo pacman -S nvidia-prime --needed
prime-run glxinfo | grep OpenGL

Or, without optimus-manager:

https://wiki.archlinux.org/title/PRIME#Discrete_card_as_primary_GPU

Post output of inxi -Ga to check which driver and which Nvidia card you have…

Also which kernel are you running? inxi -F shows you full info. We need to check first if and which Nvidia drivers have been installed and if they are for the right card.

To check which driver is supported by your card.

nvidia-installer-check

Just in case you missed it.

hey everyone. so i had decided to go back to pop os since it just worked out of the box. HOWEVER, with the new EOS Apollo I decided to give it another shot and the optimus manager now works without any issues and i’m able to switch GPUs with ease. thanks for your help, everybody!

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.