Cannot detect nvidia driver and use xrandr for Debian on Macbook (Intel/Nvidia)

Hi there:
I am trying to get xrandr detect Nvidia driver by default, on my macbook and ubuntu (debian).

$ lspci | grep VGA
00:02.0 VGA compatible controller [0300]: Intel Corporation 3rd Gen Core processor Graphics Controller [8086:0166] (rev 09) (prog-if 00 [VGA controller])
01:00.0 VGA compatible controller [0300]: NVIDIA Corporation GK107M [GeForce GT 650M Mac Edition] [10de:0fd5] (rev a1) (prog-if 00 [VGA controller])

I ran nvidia-detect and was told to install nvidia-legacy-390xx drivers along with smi and nvidia-setting-legacy

libegl-nvidia-legacy-390xx0/stable,now 390.144-1 amd64 [installed,automatic]
libgl1-nvidia-legacy-390xx-glvnd-glx/stable,now 390.144-1 amd64 [installed,automatic]
libglx-nvidia-legacy-390xx0/stable,now 390.144-1 amd64 [installed,automatic]
libnvidia-legacy-390xx-compiler/stable,now 390.144-1 amd64 [installed,automatic]
libnvidia-legacy-390xx-cuda1/stable,now 390.144-1 amd64 [installed,automatic]
libnvidia-legacy-390xx-eglcore/stable,now 390.144-1 amd64 [installed,automatic]
libnvidia-legacy-390xx-fatbinaryloader/stable,now 390.144-1 amd64 [installed,automatic]
libnvidia-legacy-390xx-glcore/stable,now 390.144-1 amd64 [installed,automatic]
libnvidia-legacy-390xx-ml1/stable,now 390.144-1 amd64 [installed,automatic]
libnvidia-legacy-390xx-ptxjitcompiler1/stable,now 390.144-1 amd64 [installed,automatic]
nvidia-legacy-390xx-alternative/stable,now 390.144-1 amd64 [installed,automatic]
nvidia-legacy-390xx-driver-bin/stable,now 390.144-1 amd64 [installed,automatic]
nvidia-legacy-390xx-driver-libs/stable,now 390.144-1 amd64 [installed,automatic]
nvidia-legacy-390xx-driver/stable,now 390.144-1 amd64 [installed]
nvidia-legacy-390xx-egl-icd/stable,now 390.144-1 amd64 [installed,automatic]
nvidia-legacy-390xx-kernel-dkms/stable,now 390.144-1 amd64 [installed,automatic]
nvidia-legacy-390xx-kernel-support/stable,now 390.144-1 amd64 [installed,automatic]
nvidia-legacy-390xx-opencl-icd/stable,now 390.144-1 amd64 [installed]
nvidia-legacy-390xx-smi/stable,now 390.144-1 amd64 [installed]
nvidia-legacy-390xx-vdpau-driver/stable,now 390.144-1 amd64 [installed,automatic]
nvidia-settings-legacy-390xx/stable,now 390.144-1 amd64 [installed]
volumeicon-alsa-legacy/bullseye,now 0.4.6-2.4 amd64 [installed]
xserver-xorg-video-nvidia-legacy-390xx/stable,now 390.144-1 amd64 [installed,automatic]

To check whether correct driver is installed (390.144)

$ inxi -Fxz
Graphics:  Device-1: Intel 3rd Gen Core processor Graphics vendor: Apple driver: N/A bus-ID: 00:02.0 
           Device-2: NVIDIA GK107M [GeForce GT 650M Mac Edition] vendor: Apple driver: nvidia v: 390.144 bus-ID: 01:00.0 
           Device-3: Apple FaceTime HD Camera (Built-in) type: USB driver: uvcvideo bus-ID: 1-1.1:3 
           Display: server: X.Org 1.20.11 driver: loaded: nvidia note: n/a (using device driver) unloaded: fbdev
  =========  Symptoms  =========

1. I find for some reason my nvidia card is not working properly:

$ nvidia-smi 
Wed May 25 05:20:51 2022       
+-----------------------------------------------------------------------------+
| NVIDIA-SMI 390.144                Driver Version: 390.144                   |
|-------------------------------+----------------------+----------------------+
| GPU  Name        Persistence-M| Bus-Id        Disp.A | Volatile Uncorr. ECC |
| Fan  Temp  Perf  Pwr:Usage/Cap|         Memory-Usage | GPU-Util  Compute M. |
|===============================+======================+======================|
|   0  GeForce GT 650M     Off  | 00000000:01:00.0 N/A |                  N/A |
| N/A   54C    P0    N/A /  N/A |      0MiB /   981MiB |     N/A      Default |
+-------------------------------+----------------------+----------------------+
                                                                               
+-----------------------------------------------------------------------------+
| Processes:                                                       GPU Memory |
|  GPU       PID   Type   Process name                             Usage      |
|=============================================================================|
|    0                    Not Supported                                       |
+-----------------------------------------------------------------------------+

2. also my xrandr cannot detect nvidia as a provider

$ xrandr --listproviders 
Providers: number : 0

I tried to walk through the following two posts and set up PRIME

With my new /etc/X11/xorg.conf (xorg.conf.new) and old one **(xorg.conf.bak)**attached
xorg.conf.bak (523 Bytes)
xorg.conf.new (2.7 KB)
While the nvidia-xconfig --prime does not work because of the missing file libnvidia-cfg.so.1

# nvidia-xconfig --prime

Using X configuration file: "/etc/X11/xorg.conf".

WARNING: error opening libnvidia-cfg.so.1: libnvidia-cfg.so.1: cannot open shared object file: No such file or directory.


ERROR: Unable to find any GPUs in the system.

Backed up file '/etc/X11/xorg.conf' as '/etc/X11/xorg.conf.backup'
New X configuration file written to '/etc/X11/xorg.conf'

3. This might due to the persistent mode (https://forums.developer.nvidia.com/t/nvidia-persistenced-not-running/74338) becasue from my nvidia-smi output the persistent mode is off:

| GPU  Name        Persistence-M| Bus-Id        Disp.A | Volatile Uncorr. ECC |
| Fan  Temp  Perf  Pwr:Usage/Cap|         Memory-Usage | GPU-Util  Compute M. |
|===============================+======================+======================|
|   0  GeForce GT 650M     Off  | 00000000:01:00.0 N/A |                  N/A 

But when I tried the ENABLE persistent mode the suggested command from the documentation halts my screen : nvidia-smi -i 0 -pm ENABLED (https://docs.nvidia.com/deploy/driver-persistence/index.html)

Anyone knows how to verify whether my driver is installed property , what is persistent mode? how to setup PRIME xrandr?

I found in order to fix the missing libnvidia-cfg.so.1 file issue, I need to libnvidia-legacy-390xx-cfg1
So the following command fix the issue.
sudo apt install libnvidia-legacy-390xx-cfg1

# nvidia-xconfig --prime

Using X configuration file: "/etc/X11/xorg.conf".

WARNING: error opening libnvidia-cfg.so.1: libnvidia-cfg.so.1: cannot open shared object file: No such file or directory.

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