Ubuntu 20.04 does not use Nvidia GPU

I am running Ubuntu 20.04.5 and it seems that my system is not using the Nvidia GPU but the integrated Intel graphics.

Initially, I was using kernel 5.15.0-60-generic and nvidia-smi stated “No devices were found”. When using the boot flag nomodeset, in the Settings/About section I got llvmpipe and with other flags I just got Intel as the graphics.

After reinstalling my OS and trying almost every relevant solution I could find, I updated my kernel to the Liquorix kernel and there seems to be an improvement. However, the About section says “NVIDIA Corporation / Mesa Intel® Graphics (ADL GT2)”.

Specs:

  • ASUS M16 (2022) Laptop
  • RTX 3070 Ti 8GB
  • Intel Core i9 12th-gen
  • Dual boot (Win 11 & Ubuntu 20.04)

Other info:

  • No external monitor
  • Kernel version: 6.1.12-3-liquorix-amd64
  • Driver: nvidia-driver-525 (525.78.01)
  • Secure boot and fast boot disabled.
  • Windows Fast Startup disabled.

I also tried the latest production branch version of the driver using the .run installer but I got a black screen with a blinking cursor and couldn’t boot. So, I went back to sudo ubuntu-drivers autoinstall.

  • I have updated the initrd (sudo update-initramfs -u).
  • I have tried with both Wayland on and off. Currently: WaylandEnable=false
  • I have switched to nvidia (sudo prime-select nvidia)

$ nvidia-smi

+-----------------------------------------------------------------------------+
| NVIDIA-SMI 525.78.01    Driver Version: 525.78.01    CUDA Version: 12.0     |
|-------------------------------+----------------------+----------------------+
| 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   31C    P0    N/A /  80W |      5MiB /  8192MiB |      0%      Default |
|                               |                      |                  N/A |
+-------------------------------+----------------------+----------------------+
                                                                               
+-----------------------------------------------------------------------------+
| Processes:                                                                  |
|  GPU   GI   CI        PID   Type   Process name                  GPU Memory |
|        ID   ID                                                   Usage      |
|=============================================================================|
|    0   N/A  N/A      1192      G   /usr/lib/xorg/Xorg                  4MiB |
+-----------------------------------------------------------------------------+

Kernel:

$ uname -a

Linux Elena-Ubuntu 6.1.12-3-liquorix-amd64 #1 ZEN SMP PREEMPT_DYNAMIC liquorix 6.1-27ubuntu1~focal (2023-02 x86_64 x86_64 x86_64 GNU/Linux

Display:

$ sudo lshw -C display

  *-display                 
       description: VGA compatible controller
       product: NVIDIA Corporation
       vendor: NVIDIA Corporation
       physical id: 0
       bus info: pci@0000:01:00.0
       logical name: /dev/fb0
       version: a1
       width: 64 bits
       clock: 33MHz
       capabilities: pm msi pciexpress vga_controller bus_master cap_list rom fb
       configuration: depth=32 driver=nvidia latency=0 mode=2560x1600 visual=truecolor xres=2560 yres=1600
       resources: iomemory:600-5ff iomemory:620-61f irq:194 memory:85000000-85ffffff memory:6000000000-61ffffffff memory:6200000000-6201ffffff ioport:4000(size=128) memory:86000000-8607ffff
  *-display
       description: VGA compatible controller
       product: Intel Corporation
       vendor: Intel Corporation
       physical id: 2
       bus info: pci@0000:00:02.0
       version: 0c
       width: 64 bits
       clock: 33MHz
       capabilities: pciexpress msi pm vga_controller bus_master cap_list rom
       configuration: driver=i915 latency=0
       resources: iomemory:620-61f iomemory:400-3ff irq:193 memory:622e000000-622effffff memory:4000000000-400fffffff ioport:5000(size=64) memory:c0000-dffff memory:4010000000-4016ffffff memory:4020000000-40ffffffff
$ xrandr --listproviders

Providers: number : 2
Provider 0: id: 0x46 cap: 0x9, Source Output, Sink Offload crtcs: 4 outputs: 3 associated providers: 1 name:modesetting
Provider 1: id: 0x28b cap: 0x2, Sink Output crtcs: 4 outputs: 4 associated providers: 1 name:NVIDIA-G0

I’d really appreciate any help. I have been strugling with this for a week now.

nvidia-installer.log (1.7 KB)
nvidia-bug-report.log.gz (496.9 KB)

In general, the nvidia gpu is still in on-demand mode, to use it, prepend
__NV_PRIME_RENDER_OFFLOAD=1 __GLX_VENDOR_LIBRARY_NAME=nvidia
e.g.
__NV_PRIME_RENDER_OFFLOAD=1 __GLX_VENDOR_LIBRARY_NAME=nvidia glxgears
or right-click on an application icon and select “run on dgpu”.
Nevertheless, there’s something wrong since you selected “performance mode” in prime-select/nvidia-settings.
Please post the output of
sudo systemctl status gpu-manager

1 Like

Thank you for your quick response!

I tried running an application that requires the Nvidia GPU (Nvidia Isaac Sim) by right-clicking and selecting “run on dgpu” but still gives me the same errors which I suspect relates to it not utilizing the Nvidia GPU.

Here is the output you requested:

$ sudo systemctl status gpu-manager

● gpu-manager.service - Detect the available GPUs and deal with any system changes
     Loaded: loaded (/lib/systemd/system/gpu-manager.service; enabled; vendor preset: enabled)
     Active: inactive (dead) since Thu 2023-02-23 03:30:34 MST; 7h ago
    Process: 808 ExecStart=/usr/bin/gpu-manager --log /var/log/gpu-manager.log (code=exited, status=0/SUCCESS)
   Main PID: 808 (code=exited, status=0/SUCCESS)

Feb 23 03:30:33 Elena-Ubuntu systemd[1]: Starting Detect the available GPUs and deal with any system changes...
Feb 23 03:30:34 Elena-Ubuntu systemd[1]: gpu-manager.service: Succeeded.
Feb 23 03:30:34 Elena-Ubuntu systemd[1]: Finished Detect the available GPUs and deal with any system changes.

FWIW:my /etc/X11/xorg.conf.d/10-nvidia-drm-outputclass.conf says

Section "OutputClass"
    Identifier "intel"
    MatchDriver "i915"
    Driver "modesetting"
EndSection

Section "OutputClass"
    Identifier "nvidia"
    MatchDriver "nvidia-drm"
    Driver "nvidia"
    Option "AllowEmptyInitialConfiguration"
    Option "PrimaryGPU" "yes"
    #ModulePath "/usr/lib/nvidia/xorg"
    #ModulePath "/usr/lib/xorg/modules"
EndSection

nvidia-smi:

Sat Feb 25 22:19:42 2023       
+-----------------------------------------------------------------------------+
| NVIDIA-SMI 470.57.02    Driver Version: 470.57.02    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  Quadro M600M        Off  | 00000000:01:00.0 Off |                  N/A |
| N/A   49C    P0    N/A /  N/A |    509MiB /  2002MiB |      4%      Default |
|                               |                      |                  N/A |
+-------------------------------+----------------------+----------------------+
                                                                               
+-----------------------------------------------------------------------------+
| Processes:                                                                  |
|  GPU   GI   CI        PID   Type   Process name                  GPU Memory |
|        ID   ID                                                   Usage      |
|=============================================================================|
|    0   N/A  N/A      2592      G   /usr/lib/xorg/Xorg                285MiB |
|    0   N/A  N/A      4268      G   cinnamon                           46MiB |
|    0   N/A  N/A     99461      G   /usr/lib/firefox/firefox          170MiB |
+-----------------------------------------------------------------------------+

No gpu-manager bloat etc. is installed (Ubuntu 20.04).

I don’t have any xorg.conf.d directory in /etc/X11 but there is one in /usr/share/X11. However, the file you mentioned does not exist.

This is what I have:

Update:

I found out you can use the following command to monitor the GPU usage:

$ watch nvidia-smi

So, I wanted to test whether the prepending command from the terminal and the GUI option “Launch using the Dedicated Graphics Card” were indeed using the Nvidia GPU.

I first tried the GUI option and showed no utilization for the Nvidia Omniverse/Isaac Sim application (I also got some errors related to initializing the GPU in the app).

Then, I tried the example given above:

$ __NV_PRIME_RENDER_OFFLOAD=1 __GLX_VENDOR_LIBRARY_NAME=nvidia glxgears

which required installing mesa-utils.

After installing mesa-utils, the GPU was indeed utilized both when prepending the above command and when using the GUI option, which is great!

(I don’t really know if that was the fix because I didn’t test the prepending option with something else before installing mesa-utils but this is the only difference I made when running Isaac Sim and now I am able to run it.)

However, the issue still remains why “Performance mode” is not actually used (but it seems that I can at least now continue my work).

You don’t need to create any config files, the gpu-manager should create them on the fly. Since it ran but didn’t create the config for performance mode, please attach /var/log/gpu-manager.log

I am attaching /var/log/gpu-manager.log.

gpu-manager.log (2.1 KB)

I’m not sure but this looks like a timing issue, the i915 and nvidia modules loading in time for the Xserver but too late for the gpu manager.
Please try embedding it into the initrd, i.e.
add the lines

nvidia
nvidia-modeset
nvidia-drm
i915

to
/etc/initramfs-tools/modules
and run
sudo update-initramfs -u

I added the lines, updated initramfs and rebooted.

I am attaching the new /var/log/gpu-manager.log. It now says nvidia loaded but it is still in on-demand mode.

gpu-manager.log (2.2 KB)

To make sure, please run
sudo prime-select nvidia
then reboot and create a new nvidia-bug-report.log

I appreciate your help!

Unfortunately, the issue still remains.

nvidia-bug-report.log.gz (565.9 KB)

Odd. Which version of the packages
ubuntu-drivers-common
nvidia-prime
are installed?

I used apt-show-versions. If there is another way you want me to check the versions, please let me know.

$ apt-show-versions ubuntu-drivers-common
ubuntu-drivers-common:amd64/focal 1:0.9.0pop0~1652324490~20.04~ff3aa75~dev uptodate
$ apt-show-versions nvidia-prime
nvidia-prime:all/focal-updates 0.8.16~0.20.04.2 uptodate

Those are the correct versions. Please try this:
swich to on-demand mode
sudo prime-select on-demand
reboot
switch to nvidia mode
sudo prime-select nvidia
reboot

I tried that but it still doesn’t want to actually switch to performance mode.

I really don’t know why gpu-manager doesn’t create the necessary config, you should rather file a bugreport with Ubuntu.
Meanwhile, you could create the file yourself
/etc/X11/xorg.conf.d/nvidia-prime.conf

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

Okay, I will probably file a bug report with Ubuntu as well.

However, your suggestion to add this config file manually solved the issue of not using the “Performance mode”!

I confirmed that the GPU was utilized when running glxgears without prepending anything and the About section now lists the Nvidia GPU.

Thank you so much for all your help!

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