2

I posted this question a few days ago.
I tried to reinstall the driver by downloading it from official NVIDIA website and also reinstalling it from Additional Driver app or ubuntu-driver autoinstall command but none of them solved the problem. I can install them without any error but after reboot I face some problems (whem PRIME profile is on-demand). Now nvidia-smi doesn't work:

┌──(rootubuntu)-[~]
└─$ nvidia-smi 
NVIDIA-SMI has failed because it couldn't communicate with the NVIDIA driver. Make sure that the latest NVIDIA driver is installed and running.

nvidia-persistenced.service has beed failed to start and I get this message:

Failed to query NVIDIA devices. Please ensure that the NVIDIA device files (/dev/nvidia*) exist, and that user 127 has read and write permissions for those files.

And there is no nvidia in /dev/:

┌──(rootubuntu)-[~]
└─# ls /dev
acpi_thermal_rel  cuse         hidraw0    i2c-6    loop12  loop9         nvme0      pts       snd        tty11  tty21  tty31  tty41  tty51  tty61      ttyS12  ttyS22  ttyS4    v4l    vcsa3  vfio
autofs            disk         hidraw1    i2c-7    loop13  loop-control  nvme0n1    random    spidev0.0  tty12  tty22  tty32  tty42  tty52  tty62      ttyS13  ttyS23  ttyS5    vcs    vcsa4  vga_arbiter
block             dma_heap     hpet       initctl  loop14  mapper        nvme0n1p1  rfkill    stderr     tty13  tty23  tty33  tty43  tty53  tty63      ttyS14  ttyS24  ttyS6    vcs1   vcsa5  vhci
bsg               dri          hugepages  input    loop15  mcelog        nvme0n1p2  rtc       stdin      tty14  tty24  tty34  tty44  tty54  tty7       ttyS15  ttyS25  ttyS7    vcs2   vcsa6  vhost-net
btrfs-control     drm_dp_aux0  hwrng      kmsg     loop2   media0        nvme0n1p4  rtc0      stdout     tty15  tty25  tty35  tty45  tty55  tty8       ttyS16  ttyS26  ttyS8    vcs3   vcsu   vhost-vsock
bus               ecryptfs     i2c-0      kvm      loop3   mei0          nvme0n1p5  sda       tpm0       tty16  tty26  tty36  tty46  tty56  tty9       ttyS17  ttyS27  ttyS9    vcs4   vcsu1  video0
char              fb0          i2c-1      log      loop4   mem           nvram      sda1      tpmrm0     tty17  tty27  tty37  tty47  tty57  ttyprintk  ttyS18  ttyS28  udmabuf  vcs5   vcsu2  video1
console           fd           i2c-2      loop0    loop5   mqueue        port       sda3      tty        tty18  tty28  tty38  tty48  tty58  ttyS0      ttyS19  ttyS29  uhid     vcs6   vcsu3  zero
core              full         i2c-3      loop1    loop6   net           ppp        sg0       tty0       tty19  tty29  tty39  tty49  tty59  ttyS1      ttyS2   ttyS3   uinput   vcsa   vcsu4  zfs
cpu               fuse         i2c-4      loop10   loop7   ng0n1         psaux      shm       tty1       tty2   tty3   tty4   tty5   tty6   ttyS10     ttyS20  ttyS30  urandom  vcsa1  vcsu5
cpu_dma_latency   gpiochip0    i2c-5      loop11   loop8   null          ptmx       snapshot  tty10      tty20  tty30  tty40  tty50  tty60  ttyS11     ttyS21  ttyS31  userio   vcsa2  vcsu6

please help if you can.

2 Answers2

3

I had the similar symptoms, /dev/nvidia didn't exist, lsmod | grep nvidia returned nothing. And nvidia-persistenced failed to start.

Failed to query NVIDIA devices. Please ensure that the NVIDIA device files (/dev/nvidia*) exist, and that user 119 has read and write permissions for those files.

I tried to reinstall my nvidia-driver package using --reinstall option. I was asked to reconfigure dpkg. Then this happened:

$ sudo apt-get install --reinstall nvidia-driver
E: dpkg was interrupted, you must manually run 'sudo dpkg --configure -a' to correct the problem. 
$ sudo dpkg --configure -a
Setting up nvidia-driver-bin (470.182.03-1) ...
Setting up libcuda1:amd64 (470.182.03-1) ...
Setting up libnvidia-cfg1:amd64 (470.182.03-1) ...
Setting up nvidia-egl-icd:amd64 (470.182.03-1) ...
Setting up libglx-nvidia0:amd64 (470.182.03-1) ...
Setting up nvidia-kernel-support (470.182.03-1) ...
Setting up xserver-xorg-video-nvidia (470.182.03-1) ...
Setting up nvidia-vulkan-icd:amd64 (470.182.03-1) ...
Setting up nvidia-vdpau-driver:amd64 (470.182.03-1) ...
Setting up libgl1-nvidia-glvnd-glx:amd64 (470.182.03-1) ...
Setting up nvidia-kernel-dkms (470.182.03-1) ...
Loading new nvidia-current-470.182.03 DKMS files...
Building for 5.10.0-22-amd64
Building initial module for 5.10.0-22-amd64
Done.

nvidia-current.ko: Running module version sanity check.

  • Original module
    • No original module exists within this kernel
  • Installation
    • Installing to /lib/modules/5.10.0-22-amd64/updates/dkms/

nvidia-current-modeset.ko: Running module version sanity check.

  • Original module
    • No original module exists within this kernel
  • Installation
    • Installing to /lib/modules/5.10.0-22-amd64/updates/dkms/

nvidia-current-drm.ko: Running module version sanity check.

  • Original module
    • No original module exists within this kernel
  • Installation
    • Installing to /lib/modules/5.10.0-22-amd64/updates/dkms/

nvidia-current-uvm.ko: Running module version sanity check.

  • Original module
    • No original module exists within this kernel
  • Installation
    • Installing to /lib/modules/5.10.0-22-amd64/updates/dkms/

nvidia-current-peermem.ko: Running module version sanity check.

  • Original module
    • No original module exists within this kernel
  • Installation
    • Installing to /lib/modules/5.10.0-22-amd64/updates/dkms/

depmod...

DKMS: install completed. Setting up nvidia-smi (470.182.03-1) ... Setting up nvidia-driver-libs:amd64 (470.182.03-1) ... Setting up libnvcuvid1:amd64 (470.182.03-1) ... Setting up nvidia-driver (470.182.03-1) ... Setting up libnvidia-encode1:amd64 (470.182.03-1) ... Processing triggers for glx-alternative-mesa (1.2.1~deb11u1) ... Processing triggers for glx-alternative-nvidia (1.2.1~deb11u1) ... Processing triggers for libc-bin (2.31-13+deb11u6) ... Processing triggers for update-glx (1.2.1~deb11u1) ... Processing triggers for glx-alternative-nvidia (1.2.1~deb11u1) ... update-alternatives: warning: forcing reinstallation of alternative /usr/lib/nvidia because link group glx is broken Processing triggers for libc-bin (2.31-13+deb11u6) ... Processing triggers for initramfs-tools (0.140) ... update-initramfs: Generating /boot/initrd.img-5.10.0-22-amd64

After reboot nvidia was working properly. One note though: I did this on Debian, but the nature of the solution is expected to work on Ubuntu systems too.

I personally don't recommend manually installing drivers *.run files as suggested here because you will miss the driver update.

-1

Please disable Secure Boot. It worked for me on Debian Bookworm. nvidia-persistenced.service is not starting because Secure Boot is turned on on the device, so disable Secure Boot and remove and purge NVIDIA driver with:

sudo apt autoremove nvidia* --purge

and reinstall NVIDIA driver with the below command.

sudo apt install nvidia-driver

Reboot your computer with sudo reboot.

karel
  • 122,292
  • 133
  • 301
  • 332