Can not select the "default GPU" in MXLinux

I can not select the “DEFAULT GPU” in this HP-ENVY17 laptop BIOS.
Then the NVIDIA driver is not used by most of the applications in this MXLINUX21.
In case of LinuxMint21 the “Prime-select” can make the applications to better see the NVIDIA driver, but this case the NVIDIA is overheating and the laptop crashing soon after I enable the NVIDIA with the prime-select. The temperature is below 97C though.
I’m guessing the Linux can not do the GPU temperature handling properly and the
thus NVIDIA setting as default GPU is disabled from the BIOS completely.
Is there any advice how to proceed with this?

The driver is loading with Linux version 5.10.0-12-amd64 (debian-kernel@lists.debian.org) (gcc-10 (Debian 10.2.1-6) 10.2.1 20210110, GNU ld (GNU Binutils for Debian) 2.35.2) #1 SMP Debian 5.10.103-1 (2022-03-07),
but if I used linux kernel version 5.13, 5.14 or later, the driver is not loaded.

The ‘nvidia-smi’ shows me now as:
~$ nvidia-smi
Sat Mar 19 20:06:59 2022
±----------------------------------------------------------------------------+
| NVIDIA-SMI 510.47.03 Driver Version: 510.47.03 CUDA Version: 11.6 |
|-------------------------------±---------------------±---------------------+
| GPU Name Persistence-M| Bus-Id Disp.A | Volatile Uncorr. ECC |
| Fan Temp Perf Pwr:Usage/Cap| Memory-Usage | GPU-Util Compute M. |
| | | MIG M. |
|===============================+======================+======================|
| 0 NVIDIA GeForce … Off | 00000000:02:00.0 Off | N/A |
| N/A 62C P8 N/A / N/A | 4MiB / 4096MiB | 0% Default |
| | | N/A |
±------------------------------±---------------------±---------------------+

±----------------------------------------------------------------------------+
| Processes: |
| GPU GI CI PID Type Process name GPU Memory |
| ID ID Usage |
|=============================================================================|
| 0 N/A N/A 1400 G /usr/lib/xorg/Xorg 4MiB |
±----------------------------------------------------------------------------+

But this MXLinux case only the Xorg seem to find the NVIDIA driver and use only 4Mb of the memory and
does not fully utilize the MX250.

Graphics: Device-1: Intel WhiskeyLake-U GT2 [UHD Graphics 620] driver: i915 v: kernel
Device-2: NVIDIA GP108M [GeForce MX250] driver: nvidia v: 510.47.03
Display: x11 server: X.Org 1.20.13 driver: loaded: modesetting,nvidia unloaded: fbdev,nouveau,vesa
resolution: 1: 1920x1080~60Hz 2: 1920x1080~60Hz
OpenGL: renderer: Mesa Intel UHD Graphics 620 (WHL GT2) v: 4.6 Mesa 21.2.5
=> Here it can be seen that for example the OpenGL use the Intel rather than NVIDIA.

$ lsmod | grep vid
nvidia_uvm 1196032 0
nvidia_drm 73728 2
nvidia_modeset 1163264 2 nvidia_drm
nvidia 39104512 73 nvidia_uvm,nvidia_modeset
drm_kms_helper 278528 2 nvidia_drm,i915
drm 618496 12 drm_kms_helper,nvidia,nvidia_drm,i915
video 53248 1 i915

Even the NVIDIA driver is loaded it shows the video is still controlled by the i915.

The nvidia gpu is in offload aka on-demand mode.
https://download.nvidia.com/XFree86/Linux-x86_64/495.44/README/primerenderoffload.html

$ xrandr --listproviders
Providers: number : 2
Provider 0: id: 0x46 cap: 0xf, Source Output, Sink Output, Source Offload, Sink Offload crtcs: 3 outputs: 4 associated providers: 0 name:modesetting
Provider 1: id: 0x25b cap: 0x0 crtcs: 0 outputs: 0 associated providers: 0 name:NVIDIA-G0

A lot of commands as above shows NVIDIA driver is there, but I can not see any GPU-load with the nvidia-smi -command.

[ 7.912] (II) Loading sub module “glamoregl”
[ 7.912] (II) LoadModule: “glamoregl”
[ 7.913] (II) Loading /usr/lib/xorg/modules/libglamoregl.so
[ 7.919] (II) Module glamoregl: vendor=“X.Org Foundation”
[ 7.919] compiled for 1.20.13, module version = 1.0.1
[ 7.919] ABI class: X.Org ANSI C Emulation, version 0.4
[ 8.116] (II) modeset(0): glamor X acceleration enabled on Mesa Intel(R) UHD Graphics 620 (WHL GT2)
[ 8.116] (II) modeset(0): glamor initialized
[ 8.117] (II) modeset(0): Output eDP-1 has no monitor section
[ 8.163] (II) modeset(0): Output DP-1 has no monitor section
[ 8.163] (II) modeset(0): Output DP-2 has no monitor section
[ 8.173] (II) modeset(0): Output HDMI-1 has no monitor section

I don’t have the file 'Xorg.conf" here in this system. How to make this file?
$ locate xorg.conf
/etc/X11/xorg.conf.d
/etc/X11/xorg.conf.d/10-evdev.conf
/etc/X11/xorg.conf.d/20-synaptics.conf
I can try using ‘X -configure’, but it places the resulted output file as ‘/root/xorg.conf.new’, not in the /etc/X11.
xorg.conf.new (4.9 KB)
I attached the file here above.

The files listed below are probably critical for what driver is used:
/usr/share/X11/xorg.conf.d$ ls
10-amdgpu.conf 10-quirks.conf 20-thinkpad.conf 50-joystick.conf 70-wacom.conf
10-evdev.conf 10-radeon.conf 40-libinput.conf 70-synaptics.conf nvidia-drm-outputclass.conf
It looks like the ‘10-nvidia.conf’ or ‘11-nvidia-prime.conf’ is missing here…
I can’t find exactly why the configuration is not set in ‘performance mode’…

No matter what I try it didn’t start working in performance mode.
This looks difficult to be solved.

Your low-end nvidia gpu likely doesn’t support listing processes using nvidia-smi.
In offload mode, you can run applications on the nvidia gpu like given in the link:
__NV_PRIME_RENDER_OFFLOAD=1 __GLX_VENDOR_LIBRARY_NAME=nvidia glxinfo | grep vendor
If you want to set the nvidia gpu as primary, create
/etc/X11/xorg.conf.d/10-nvidia-primary.conf

Section "OutputClass"
    Identifier "nvidia"
    MatchDriver "nvidia-drm"
    Driver "nvidia"
    Option "PrimaryGpu" "yes"
EndSection

and set your DM/WM to run

xrandr --setprovideroutputsource modesetting NVIDIA-0 && xrandr --auto

on startup.

I’m not sure if the log file has anything about this, but if I make the file 10-nvidia-primary.conf,
the login window will be blank and I can not do any X-window login.
Xorg.0.log (82.6 KB)
The given Xrandr command ends with problem as well:

$ xrandr --setprovideroutputsource modesetting NVIDIA-0 && xrandr --auto
Could not find provider with name NVIDIA-0

This is the GPU came with this laptop. Can not be changed. Maybe only if I can purchase a new system.
What is your recommended model for a laptop? MX450?
Then what is the model where the drivers will work with Linux?

A different notebook model won’t fix anything if you don’t understand how hybrid graphics systems and PRIME work.

https://wiki.archlinux.org/title/NVIDIA_Optimus#Display_managers
Old prime config:

I have the “lightdm” and it doesn’t work the way as you wrote:

$ xrandr --setprovideroutputsource modesetting NVIDIA-0
Could not find provider with name NVIDIA-0
$ xrandr --auto

Here is some problem can not find the provider for NVIDIA-0.
Unfortunately this is not easily understood how this works.

This would usually mean the nvidia driver is not properly loaded. Please run nvidia-bug-report.sh as root and attach the resulting nvidia-bug-report.log.gz file to your post.

Here is the bug report:
nvidia-bug-report.log.gz (1.1 MB)

I also updated the laptop F.11 (Insyde) BIOS to F.13, but that didn’t seem to solve anything yet.

And also in another machine I think similar issue and its bug-report attached below:
nvidia-bug-report-HP.log.gz (211.4 KB)

The first log has “PrimaryGpu” commented out, so I can’t see what’s going wrong when it’s enabled. Please create a new log with PrimaryGpu option enabled.
The second log is from an nvidia-only system with a very old driver installed and no monitor connected. This needs the additional

Option "AllowEmptyInitialConfiguration" "true"

in the device section of xorg.conf. And the monitor connected to the nvidia card, of course.

ok. Tks it looks something is wrong then in the configuration…

The “PrimaryGPU” was commented out, because the Xwindow login screen would be blank (and thus no login possible at all).
But I made the nvidia-bug-report.sh with the blank login screen (using the tty text terminal login) and attached it here below:
nvidia-bug-report-ENVY.log.gz (371.7 KB)

The nvidia is coming up fine as primary gpu, you just need to set lightdm to run the xrandr commands to get a picture on the internal display.

How to set the xrandr? I think it should be at the x-windows startup before login…
I could not login it in the shell window, because the login is already not possible, so I can not open the shell window in x11-mode.
So anyway, it looks then lightdm configuration faults…
I don’t know why this configuration is not included in the system.
And it seems difficult to be found.
Should I add it possibly to the below file?
/usr/share/lightdm/lightdm.conf.d/90-nvidia.conf
I tried following:
45custom_xrandr-settings (136 Bytes)
But it didn’t work out either.