0

I have dual graphics Intel 520 integrated and nVidia 930MX dedicated. I'm running 20.04.2 and installed nvidia-driver-460 through Additional Drivers, and intel-media-va-driver-non-free through terminal. Currently I'm only getting display (and successful boot) on intel GPU. After I run sudo prime-select nvidia and reboot, I'm no longer able to boot, and have to revert to intel through TTY. Running nvidia-smi gives following error:

NVIDIA-SMI has failed because it couldn't communicate with the NVIDIA driver. Make sure that the latest NVIDIA driver is installed and running.

The nvidia-xconfig generates a xorg.conf in which the 'Files' section is empty.

nvidia-settings gives error:

ERROR: NVIDIA driver is not loaded
ERROR: Unable to load info from any available system
(nvidia-settings:10549): GLib-GObject-CRITICAL **: 18:16:11.739: g_object_unref: assertion 
'G_IS_OBJECT (object)' failed
** Message: 18:16:11.749: PRIME: Requires offloading
** Message: 18:16:11.749: PRIME: is it supported? yes
** Message: 18:16:11.857: PRIME: Usage: /usr/bin/prime-select nvidia|intel|on-demand|query
** Message: 18:16:11.857: PRIME: on-demand mode: "1"
** Message: 18:16:11.857: PRIME: is "on-demand" mode supported? yes

Running whereis nvidia gives:

nvidia: /usr/lib/x86_64-linux-gnu/nvidia /usr/lib/nvidia /usr/share/nvidia /usr/src/nvidia-460.73.01/nvidia

So driver is installed but not loading. How to get the driver working? I'd like to retain intel as well.

EDIT: running sudo prime-select nvidia, reboot with nomodeset, then running nvidia-smi from TTY (because there is no GUI) gives following output:

Tue May 25 18:33:17 2021       
+-----------------------------------------------------------------------------+
| NVIDIA-SMI 460.73.01    Driver Version: 460.73.01    CUDA Version: 11.2     |
|-------------------------------+----------------------+----------------------+
| 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  GeForce 930MX       Off  | 00000000:01:00.0 Off |                  N/A |
| N/A   39C    P8    N/A /  N/A |     10MiB /  2004MiB |      0%      Default |
|                               |                      |                  N/A |
+-------------------------------+----------------------+----------------------+
                                                                               
+-----------------------------------------------------------------------------+
| Processes:                                                                  |
|  GPU   GI   CI        PID   Type   Process name                  GPU Memory |
|        ID   ID                                                   Usage      |
|=============================================================================|
|    0   N/A  N/A      1063      G   /usr/lib/xorg/Xorg                  6MiB |
|    0   N/A  N/A      1292      G   /usr/bin/gnome-shell                2MiB |
+-----------------------------------------------------------------------------+

That shows nvidia driver is loading and working, but why the GUI isn't working is beyond me.

EDIT 2: running nvidia-settings and selecting any graphics from PRIME profiles results in Segmentation fault.

Adnan
  • 1,252
  • 1
  • 10
  • 26
  • Have you disabled Secure Boot in your BIOS? – Terrance May 25 '21 at 13:09
  • This article contains a section about adding a list of modules to /etc/modules. https://itsfoss.com/nvidia-linux-mint/ It is a solution for mint but the error sounds very similar to yours. – PonJar May 25 '21 at 13:15
  • Yes Secure Boot is disabled. – Adnan May 25 '21 at 13:16
  • @PonJar adding modules didn't work either. – Adnan May 25 '21 at 13:35
  • Did you check the UEFI settings for any video hardware options? – ubfan1 May 25 '21 at 15:43
  • 1
    @Adnan this is an issue I have dealt with in the past. This link {https://www.linuxbabe.com/desktop-linux/switch-intel-nvidia-graphics-card-ubuntu} and this one {https://askubuntu.com/questions/1232541/how-is-nvidia-prime-render-offloading-configured-in-ubuntu-20-04/1233606?noredirect=1#comment2082876_1233606} helped me, though I may have had to search even more. Good luck! – JJGabe May 25 '21 at 18:27
  • @JJGabe Your second link seemed to work at first, I was actually able to get all three modes working, but suddenly stopped automatically. – Adnan May 26 '21 at 10:01
  • Does this answer your question? [How to use "prime-select on-demand" in latest Kubuntu 19.10](https://askubuntu.com/questions/1188458/how-to-use-prime-select-on-demand-in-latest-kubuntu-19-10) – karel May 26 '21 at 12:33
  • @karel The accepted answer in that question didn't solve my problem, but one of the comments in that thread did. – Adnan May 26 '21 at 12:37

2 Answers2

0

The answer posted by Celebre Asm worked for me.

First remove all the occurrences of xorg.conf and xorg.conf.old from /etc/X11/.

Then run inxi -Fxzc0 and note down the BusID of your GPUs. In my case intel was 00:02.0 = 0:2:0 and nvidia was 01:00.0 = 1:0:0.

Then create a xorg.conf.d folder, make 20-intel.conf file inside it with following content:

Section "Device"
    Identifier  "Intel Graphics"
    Driver "intel"
    Option "AccelMethod" "sna"
EndSection 

And 90-nvidia.conf file with following content:

Section "ServerLayout"
    Identifier "layout"
    Screen 0 "iGPU"
    Option "AllowNVIDIAGPUScreens"
EndSection
    
Section "Device"
    Identifier "iGPU"
    Driver "modesetting"
    BusID "PCI:0:2:0"  
EndSection
    
Section "Screen"
    Identifier "iGPU"
    Device "iGPU"
EndSection

Section "Device"
    Identifier "dGPU"
    Driver "nvidia"
    BusID "PCI:1:0:0"  
EndSection

Additionally I removed xserver-xorg-video-intel because somehow I was getting rectangles diagonally drawn on desktop and unreadable fonts, and removing it solved that.

Reboot.

**Footnote: This mess happened because I tried to boot my laptop using nvidia to use VDPAU. As of now, GM108 series of nvidia GPU doesn't have decoding support, and offloads decoding to intel counterpart. Everything was smooth as long as I didn't change "on-demand" option which was default since I first installed Ubuntu.

Adnan
  • 1,252
  • 1
  • 10
  • 26
-1

hesitate to ask this but... you probably have two different slots on the back of your computer if it is a desktop, one for the intel graphics on your motherboard, and another where your nvicia card is slotted in. You cannot run the nvidia one if you are only plugged into the one on your motherboard. Does this make sense to you?

Thomas Byers
  • 158
  • 6
  • It's a laptop actually. – Adnan May 25 '21 at 22:09
  • @Adnan Just as an FYI, I'm also running a laptop and so have only one HDMI port, which means I can't adjust my monitor settings through nvidia Prime without the use of an "external RandR tool", which I have yet to find a good answer on how to do this. Moral of the story, you will probably have to control the settings through Ubuntu, rather than Nvidia – JJGabe May 26 '21 at 17:53
  • @JJGabe I'm not using external monitor, but the laptop display right now. When things worked perfectly in the past, I was able to control my external monitor resolution and refresh rate using Ubuntu's settings. Didn't use nvidia's settings but now that the problem is sorted and I can see resolution settings in nvidia's settings manager, maybe I'll be able to control external monitor's resolution using that too. – Adnan May 27 '21 at 20:22