Cannot get nvidia gpu to render graphics on ubuntu

Recently my Ubuntu has updated the nvidia drivers from 390 to 470.82.00. Probably after this my external monitor is not able to receive the signal from my computer. My laptop has dual gpu, intel + nvidia. The graphics can never pick nvidia gpu as the graphics provider no matter what solution I try. I have tried the following solutions, nothing helped.

Laptop unable to display on external monitors on Ubuntu 20.04 (My problem is very similar to this)
ubuntu 18.04+headless_390+intel iGPU after prime-select intel lost contact to GeFORCE 1050ti
Linux Mint Nvidia Driver loads with startx but not on initial startup - #2 by generix
Black screen after install of nvidia driver ubuntu - #6 by davy.blavette

None of the above solutions worked, despite seemingly very close to what I’m encountering.
The following are my system details (output of inxi -Fxxxrz, truncated)

System:    Kernel: 5.8.5-050805-generic x86_64 bits: 64 compiler: N/A Desktop: Xfce 4.14.2 tk: Gtk 3.24.13 info: xfce4-panel 
           wm: xfwm4 dm: GDM3 3.36.3, LightDM 1.30.0 Distro: Ubuntu 20.04.3 LTS (Focal Fossa) 
Machine:   Type: Laptop System: Acer product: Predator PH315-51 v: V1.19 serial: <filter> 
           Mobo: CFL model: Sienta_CFS v: V1.19 serial: <filter> UEFI: Insyde v: 1.19 date: 07/13/2018 
Battery:   ID-1: BAT1 charge: 34.0 Wh condition: 34.0/48.9 Wh (69%) volts: 16.6/15.2 model: LG PABAS0241231 type: Li-ion 
           serial: <filter> status: Full 
CPU:       Topology: Quad Core model: Intel Core i5-8300H bits: 64 type: MT MCP arch: Kaby Lake rev: A L2 cache: 8192 KiB 
           flags: avx avx2 lm nx pae sse sse2 sse3 sse4_1 sse4_2 ssse3 vmx bogomips: 36799 
           Speed: 900 MHz min/max: 800/4000 MHz Core speeds (MHz): 1: 900 2: 900 3: 900 4: 900 5: 900 6: 901 7: 900 8: 900 
Graphics:  Device-1: Intel UHD Graphics 630 vendor: Acer Incorporated ALI driver: i915 v: kernel bus ID: 00:02.0 
           chip ID: 8086:3e9b 
           Device-2: NVIDIA GP107M [GeForce GTX 1050 Ti Mobile] vendor: Acer Incorporated ALI driver: nvidia v: 470.82.00 
           bus ID: 01:00.0 chip ID: 10de:1c8c 
           Display: x11 server: X.Org 1.20.11 driver: modesetting,nvidia unloaded: fbdev,nouveau,vesa alternate: intel 
           resolution: 1920x1080~60Hz 
           OpenGL: renderer: Mesa Intel UHD Graphics 630 (CFL GT2) v: 4.6 Mesa 21.0.3 direct render: Yes
lshw -c display
  *-display                 
       description: VGA compatible controller
       product: GP107M [GeForce GTX 1050 Ti Mobile]
       vendor: NVIDIA Corporation
       physical id: 0
       bus info: pci@0000:01:00.0
       version: a1
       width: 64 bits
       clock: 33MHz
       capabilities: pm msi pciexpress vga_controller bus_master cap_list rom
       configuration: driver=nvidia latency=0
       resources: irq:142 memory:a3000000-a3ffffff memory:90000000-9fffffff memory:a0000000-a1ffffff ioport:4000(size=128) memory:a4080000-a40fffff
  *-display
       description: VGA compatible controller
       product: UHD Graphics 630 (Mobile)
       vendor: Intel Corporation
       physical id: 2
       bus info: pci@0000:00:02.0
       version: 00
       width: 64 bits
       clock: 33MHz
       capabilities: pciexpress msi pm vga_controller bus_master cap_list rom
       configuration: driver=i915 latency=0
       resources: irq:140 memory:a2000000-a2ffffff memory:b0000000-bfffffff ioport:5000(size=64) memory:c0000-dffff

At this point I have uninstalled xserver-xorg-video-intel and magically the external monitor started working great!, but the graphics are still driven by Intel gpu and not nvidia gpu. Because of this applications are still not able to use the power of nvidia gpu.
To give little context, this laptop is a dual boot, on windows 10, the nvidia gpu can be used to render 4k video at 60 fps without issues smooth display.
But when switched to ubuntu, the same video has so much of dropped frames, literally not watchable.

Also the prime-select is in nvidia mode as seen by the below command

sudo prime-select query
nvidia

Ouput of nvidia-smi

nvidia-smi
Mon Nov 15 14:22:28 2021       
+-----------------------------------------------------------------------------+
| NVIDIA-SMI 470.82.00    Driver Version: 470.82.00    CUDA Version: 11.4     |
|-------------------------------+----------------------+----------------------+
| 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:01:00.0 Off |                  N/A |
| N/A   47C    P8    N/A /  N/A |      6MiB /  4040MiB |      0%      Default |
|                               |                      |                  N/A |
+-------------------------------+----------------------+----------------------+
                                                                               
+-----------------------------------------------------------------------------+
| Processes:                                                                  |
|  GPU   GI   CI        PID   Type   Process name                  GPU Memory |
|        ID   ID                                                   Usage      |
|=============================================================================|
|    0   N/A  N/A      1200      G   /usr/lib/xorg/Xorg                  4MiB |
+-----------------------------------------------------------------------------+

One way I could get the nvidia gpu to render graphics is to create /etc/X11/xorg.conf for nvidia gpu, this I generated with the command nvidia-xconfig. It is well known this is not the right way and in my specific case, the laptop display couldn’t wake up, black screen on boot, I entered cmd prompt and executed startx, that started display on my external monitor, graphics of which were rendered using nvidia gpu.
This I checked with the command glxinfo|egrep "OpenGL vendor|OpenGL renderer" which showed nvidia gpu as the OpenGL renderer.

So I would really appreciate if somebody can help me get the nvidia gpu to render the grpahics, instead of intel.

I’m not able to upload nvidia-bug-report.log.gz, tried multiple extensions, with no success, can you please suggest how I should upload the bug report? The editor just doesn’t accept my bug report, it there a limit on file size? because I tried uploading a random smaller size file and upload was successful. My bug report size is 300KB.

Thanks for the help in advance!

Did you use the upload button in the editor window? horizontal bar with upward arrow.

Yes I used that button, and I always get a could not upload error.
On a side note I’m glad you replied, seeing all the posts here, looks like if you reply problem will be solved. :)

Please run

sudo journalctl -b0 |grep gdm-x-session >xorg.log
find /etc/X11 /etc/X11/xorg.conf.d /usr/share/X11/xorg.conf.d -name "*.conf" -print -exec cat '{}' \; >allconfig.txt

and try attaching the files.

Ran those commands, first command generated an empty file jfyi. So attaching only second command’s output.
allconfig.txt (9.7 KB)

Are you running gnome or a different DE?

I have multiple DEs, currently I’m running Gnome on Xorg. I have Xubuntu, xfce, Ubuntu unity along with this. But I mostly use either Xubuntu or Gnome DEs. The issue could be because of these?

No, I’m just asking because the first command created an empty log, which shouldn’t happen if gnome is run on xorg. Is /var/log/Xorg.0.log created?

Yes it is generated, attaching the file. Xorg.0.log (56.9 KB)

Please delete
/usr/share/X11/xorg.conf.d/20-intel.conf

Wow! You are rockstar! the graphics use Nvidia GPU now. Thanks!
Can you elaborate how this is interfering with prime-select and not letting nvidia gpu take control of graphics? Just for my information and knowledge.

Thanks a lot again!!

That config file sets a fixed config with intel as primary, using a “Device Section” which is not overridable by prime-select’s conditional config using “OutputClass Sections”

2 Likes

Okay. Got it. Thanks again for resolving the issue. Cheers!