Score:0

20.04: nvidia-smi failed but drivers are installed

dj flag

Problem: The Nvidia-drivers are installed but the nvidia-smi command fails.

Output of the command dkms status:

nvidia, 520.61.05: added

Output of the command lsmod | grep nvidia:

nvidiafb               61440  0
vgastate               20480  1 nvidiafb
fb_ddc                 16384  1 nvidiafb
i2c_algo_bit           16384  2 nvidiafb,i915

Output of the command nvidia-settings:

ERROR: NVIDIA driver is not loaded


(nvidia-settings:8427): GLib-GObject-CRITICAL **: 15:16:13.799: g_object_unref: assertion 'G_IS_OBJECT (object)' failed

** (nvidia-settings:8427): CRITICAL **: 15:16:13.800: ctk_powermode_new: assertion '(ctrl_target != NULL) && (ctrl_target->h != NULL)' failed

ERROR: nvidia-settings could not find the registry key file or the X server is not accessible. This file should have been installed along with this driver at
       /usr/share/nvidia/nvidia-application-profiles-key-documentation. The application profiles will continue to work, but values cannot be prepopulated or validated, and will not be listed in the help
       text. Please see the README for possible values and descriptions.

Distribution: Ubuntu 20.04

kernel version: 5.19.0-051900-generic

graphics card: Nvidia RTX 3050

Drivers were installed with the command: sudo apt install nvidia-driver-520

Output of the command dpkg -l | grep nvidia:

ii  libnvidia-cfg1-520:amd64                   520.61.05-0ubuntu1                  amd64        NVIDIA binary OpenGL/GLX configuration library
ii  libnvidia-common-520                       520.61.05-0ubuntu1                  all          Shared files used by the NVIDIA libraries
ii  libnvidia-compute-520:amd64                520.61.05-0ubuntu1                  amd64        NVIDIA libcompute package
ii  libnvidia-compute-520:i386                 520.61.05-0ubuntu1                  i386         NVIDIA libcompute package
ii  libnvidia-decode-520:amd64                 520.61.05-0ubuntu1                  amd64        NVIDIA Video Decoding runtime libraries
ii  libnvidia-decode-520:i386                  520.61.05-0ubuntu1                  i386         NVIDIA Video Decoding runtime libraries
ii  libnvidia-encode-520:amd64                 520.61.05-0ubuntu1                  amd64        NVENC Video Encoding runtime library
ii  libnvidia-encode-520:i386                  520.61.05-0ubuntu1                  i386         NVENC Video Encoding runtime library
ii  libnvidia-extra-520:amd64                  520.61.05-0ubuntu1                  amd64        Extra libraries for the NVIDIA driver
ii  libnvidia-fbc1-520:amd64                   520.61.05-0ubuntu1                  amd64        NVIDIA OpenGL-based Framebuffer Capture runtime library
ii  libnvidia-fbc1-520:i386                    520.61.05-0ubuntu1                  i386         NVIDIA OpenGL-based Framebuffer Capture runtime library
ii  libnvidia-gl-520:amd64                     520.61.05-0ubuntu1                  amd64        NVIDIA OpenGL/GLX/EGL/GLES GLVND libraries and Vulkan ICD
ii  libnvidia-gl-520:i386                      520.61.05-0ubuntu1                  i386         NVIDIA OpenGL/GLX/EGL/GLES GLVND libraries and Vulkan ICD
ii  nvidia-compute-utils-520                   520.61.05-0ubuntu1                  amd64        NVIDIA compute utilities
ii  nvidia-dkms-520                            520.61.05-0ubuntu1                  amd64        NVIDIA DKMS package
ii  nvidia-driver-520                          520.61.05-0ubuntu1                  amd64        NVIDIA driver metapackage
ii  nvidia-kernel-common-520                   520.61.05-0ubuntu1                  amd64        Shared files used with the kernel module
ii  nvidia-kernel-source-520                   520.61.05-0ubuntu1                  amd64        NVIDIA kernel source package
ii  nvidia-prime                               0.8.16~0.20.04.2                    all          Tools to enable NVIDIA's Prime
ii  nvidia-settings                            520.61.05-0ubuntu1                  amd64        Tool for configuring the NVIDIA graphics driver
ii  nvidia-utils-520                           520.61.05-0ubuntu1                  amd64        NVIDIA driver support binaries
ii  screen-resolution-extra                    0.18build1                          all          Extension for the nvidia-settings control panel
ii  xserver-xorg-video-nvidia-520              520.61.05-0ubuntu1                  amd64        NVIDIA binary Xorg driver

Terrance avatar
id flag
DKMS should say `installed`, not `added`, for the driver to be good. You might need to run `sudo dkms install -m nvidia -v 520.61.05 -k 5.19.0-051900-generic`. However, that may not work with the kernel that you presently have installed if it doesn't contain the source headers. Sometimes mainstream kernels are missing them.
Ukias avatar
dj flag
The output of `dkms install -m nvidia -v 520.61.05 -k 5.19.0-051900-generic` is: ```Error! Your kernel headers for kernel 5.19.0-051900-generic cannot be found. Please install the linux-headers-5.19.0-051900-generic package, or use the --kernelsourcedir option to tell DKMS where it's located ```
Terrance avatar
id flag
Go ahead and download and install the `headers` from https://kernel.ubuntu.com/~kernel-ppa/mainline/v5.19/ And I am sorry about the term, I meant mainline and not mainstream.
Ukias avatar
dj flag
When I try to install linux headers with `sudo apt install ./linux-headers-5.19.0-051900-generic_5.19.0-051900.202207312230_amd64.deb`, the output is: `Depends on: libssl3 (>= 3.0.0) which is not installable`. Maybe, I will try to reinstall the kernel or use a different kernel version again. However, I had troubles rebooting my computer after driver installation with earlier kernel versions. For this reason, I am currently using kernel version 5.19.
Terrance avatar
id flag
Have you thought about upgrading to 22.04 LTS? It uses the 5.15 Kernel. Or was that a kernel version that you are having issues with as well? You can also use the [HWE kernels for the LTS releases](https://ubuntu.com/about/release-cycle#ubuntu-kernel-release-cycle) where 20.04.5 LTS is using 5.15 Kernel.
Ukias avatar
dj flag
Kernel version 5.11 worked for me. The Nvidia drivers are working now. For later kernels, there are dependency issues when I try to install header libraries. Thank you @Terrance
Score:0
cn flag

In my case rebooting helped. There was also some time where I had do downgrade the driver version by one/several versions. I haven't found any way to restart the GPU without rebooting unfortunately. For now, try with 515 version of the drivers if you don't have to absolutely depend on the most recent version. Linux has recurring problems with power management of hardware, and some devices just... don't properly wake up after boot, hibernate, sleep etc. I had the same problems with my network card for example, but in this case removing a kernel module helped.

Also you seem to be running kernel 5.19 on ubuntu 20... Unstable behavior is something I would expect from something like that.

Ukias avatar
dj flag
I already tried with different kernel versions and different driver versions. The problem does not disappear with different kernels, driver versions or after reboot.
Tooster avatar
cn flag
@Ukias Do you use nvidia drivers, or do you maybe have them installed, but the default is Noveau? You could follow the thread of the source code: https://github.com/NVIDIA/nvidia-settings/blob/76b10f1b028cdccfa1b524955d9b8ca719c206c6/src/gtk+-2.x/ctkwindow.c#L730, as well as checking out if disabling secure boot helps (if it's even enabled): https://forums.developer.nvidia.com/t/nvidia-settings-7578-glib-gobject-critical-1243-745-g-object-unref-assertion-g-is-object-object-failed/194647 Also: check out your dmesg and investigate if there are any nvidia errors there.
Ukias avatar
dj flag
The problem disappears with kernel 5.11. Thx @Tooster
I sit in a Tesla and translated this thread with Ai:

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.