Impossible to setup nvidia drivers

Hi !

I tried to re-install my nvidia drivers but it did not work. It’s been few days now and I have no more idea of how to fix that so I am asking to you all if you have an idea of what is going on…

I’m trying to install my drivers using sudo ubuntu-drivers autoinstall but I always get :

Errors were encountered while processing:
 /tmp/apt-dpkg-install-CAfh4u/49-libnvidia-gl-515_515.65.01-0ubuntu0.20.04.1_i386.deb
 /tmp/apt-dpkg-install-CAfh4u/50-libnvidia-gl-515_515.65.01-0ubuntu0.20.04.1_amd64.deb
E: Sub-process /usr/bin/dpkg returned an error code (1)

at the end.

I tried a lot of things, a lot of tips find of this forum and others but without success…
apt purge, dpkg purge, fix-broken, remove all nvidia packages manually, add repositories or remove some, update and upgrade,… and more.

I don’t know what else i can do to install these drivers to run tensorflow using cuda…
Any suggestions ? Or any questions/precision let me know :)

Have a good day :)

Try installing and using aptitude instead of apt. This likely won’t let the install succeed but chances are you get some better error messages than “doesn’t work”.

It didn’t say that much more :

update-initramfs: Generating /boot/initrd.img-5.14.0-1048-oem
Errors were encountered while processing:
 nvidia-driver-515

Go to /etc/default/grub.conf
Add the grub.conf parameters below after checking they are ok for your system.
( They should be fine - but check)

At a later stage youll need to set the correct acpi profile but 2009 will do for now.
read the links.

Exit grub.conf > now install the blacklisting and modesetting as shown below grub.

Now in terminal run.
dpkg --add-architecture i386 && update-initramfs -u
apt-get update && apt-get install --reinstall apt apt-utils aptitude ppa-purge build-essential pkg-config libglvnd0 libglvnd-dev dkms dh-modaliases linux-headers-$(uname -r) lm-sensors pciutils pci.ids vulkan-tools mesa-utils && update-pciids && update-initramfs -u

apt-get full-upgrade --allow-downgrades ( dont worry if this doesnt run. )

Now go to :
nano /usr/lib/udev/rules.d/40-vm-hotadd.rules

and comment out every line and then copy to

nano /etc/udev/rules.d/40-vm-hotadd.rules

cp -R /usr/lib/udev/rules.d/40-vm-hotadd.rules /etc/udev/rules.d/40-vm-hotadd.rules

update-initramfs -u && sudo shutdown

Now reboot into GRUB “friendly kernel recovery” for your latest kernel.
Select [ grub] > select [ network ] > select [ root ]

As root run: telinit3
Login in and then log in as root
run:
apt-get update && apt-get remove --purge nvidia* libnvidia* nvidia-driver-515 && apt-get autoremove && apt-get remove && apt-get autoclean && apt-get clean && apt-get install --reinstall --install-recommends libnvidia-gl-515 nvidia-driver-515 nvidia-utils-515 nvidia-compute-utils-515

create xorg.conf:

nvidia-xconfig && mv /etc/X11/xorg.conf /etc/X11/xorg.conf.d/20-nvidia.conf && chmod +x /usr/share/screen-resolution-extra/nvidia-polkit

sudo shutdown

ALWAYS USE THE NATIVE DISTRO PROVIDED REPACKAGED NVIDIA DRIVER.
( Unless you know how not to)

READ!!! The Official nVidia-Driver-README-515. and the Arch Linux Grub and nvidia Wiki

GRUB CONF.
Kernel Parameters Example Only!!! ( Intel / nVidia )


GRUB_TIMEOUT_STYLE=menu
GRUB_TIMEOUT=8

GRUB_CMDLINE_LINUX_DEFAULT=“acpi_osi=‘Windows 2009’ acpi_enforce_resources=lax acpi_sleep=s3_mode mem_sleep_default=deep ipcmni_extend gpio-mockup.gpio_mockup_named_lines intel_idle.max_cstate=0 apparmor=0 mitigations=off nmi_watchdog=0 numa=off iommu=memaper vmalloc=256M pci=noaer nvidia-drm.modeset=1 nouveau.modeset=0 module_blacklist=‘nouveau’ noplymouth nosplash”

GRUB_CMDLINE_LINUX=“enable_mtrr_cleanup mtrr_spare_reg_nr=4 nvidia-drm.modeset=1 nouveau.modeset=0 module_blacklist=‘nouveau’”

GRUB_TERMINAL=console

GRUB_GFXMODE=1920x1080x24,auto
GRUB_GFXPAYLOAD_LINUX=text


Blacklist and modeset.
https://askubuntu.com/questions/841876/how-to-disable-nouveau-kernel-driver

Also add
[ install nouveau /bin/false ]
to
[ nano /etc/modprobe.d/nv_blacklist_xserver-xorg-video-nouveau.conf ]


In terminal type:
man apt

man dpkg

try…
apt-get --fix-broken install
apt-get --fix-missing install
dpkg --configure -a

Please post the full output.

The file doesn’t exists. Did you mean /etc/default/grub?

And maybe you can give some explanations to all of these? Like what? how? why?

I uploaded it on a drive as it has 319 lines : log-driver.txt - Google Drive

Looks like you have blocking packages of the 340 driver installed. Please post the output of
dpkg -l |grep nvidia

Can you tell me the lines that told you that?

EDIT: I found it

And here is the output :

ii  libnvidia-cfg1-515:amd64                   515.65.01-0ubuntu0.20.04.1                    amd64        NVIDIA binary OpenGL/GLX configuration library
ii  libnvidia-common-515                       515.65.01-0ubuntu0.20.04.1                    all          Shared files used by the NVIDIA libraries
ii  libnvidia-compute-515:amd64                515.65.01-0ubuntu0.20.04.1                    amd64        NVIDIA libcompute package
ii  libnvidia-compute-515:i386                 515.65.01-0ubuntu0.20.04.1                    i386         NVIDIA libcompute package
ii  libnvidia-decode-515:amd64                 515.65.01-0ubuntu0.20.04.1                    amd64        NVIDIA Video Decoding runtime libraries
ii  libnvidia-decode-515:i386                  515.65.01-0ubuntu0.20.04.1                    i386         NVIDIA Video Decoding runtime libraries
ii  libnvidia-encode-515:amd64                 515.65.01-0ubuntu0.20.04.1                    amd64        NVENC Video Encoding runtime library
ii  libnvidia-encode-515:i386                  515.65.01-0ubuntu0.20.04.1                    i386         NVENC Video Encoding runtime library
ii  libnvidia-extra-515:amd64                  515.65.01-0ubuntu0.20.04.1                    amd64        Extra libraries for the NVIDIA driver
ii  libnvidia-fbc1-515:amd64                   515.65.01-0ubuntu0.20.04.1                    amd64        NVIDIA OpenGL-based Framebuffer Capture runtime library
ii  libnvidia-fbc1-515:i386                    515.65.01-0ubuntu0.20.04.1                    i386         NVIDIA OpenGL-based Framebuffer Capture runtime library
ii  nvidia-compute-utils-515                   515.65.01-0ubuntu0.20.04.1                    amd64        NVIDIA compute utilities
ii  nvidia-dkms-515                            515.65.01-0ubuntu0.20.04.1                    amd64        NVIDIA DKMS package
iU  nvidia-driver-515                          515.65.01-0ubuntu0.20.04.1                    amd64        NVIDIA driver metapackage
ii  nvidia-kernel-common-515                   515.65.01-0ubuntu0.20.04.1                    amd64        Shared files used with the kernel module
ii  nvidia-kernel-source-515                   515.65.01-0ubuntu0.20.04.1                    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                            470.57.01-0ubuntu0.20.04.3                    amd64        Tool for configuring the NVIDIA graphics driver
ii  nvidia-utils-515                           515.65.01-0ubuntu0.20.04.1                    amd64        NVIDIA driver support binaries
ii  screen-resolution-extra                    0.18build1                                    all          Extension for the nvidia-settings control panel
ii  xserver-xorg-video-nvidia-515              515.65.01-0ubuntu0.20.04.1                    amd64        NVIDIA binary Xorg driver

Seems the package is gone already and the diversion is only a leftover. Please remove it
sudo dpkg-divert --remove /usr/lib/x86_64-linux-gnu/libGL.so.1
sudo dpkg-divert --remove /usr/lib/i386-linux-gnu/libGL.so.1
then try again to install

actually I’ve already tried this and it doesn’t work… I tried again but same problem

Please post the output of
dpkg-divert --list

Here is the output :

diversion of /usr/lib/x86_64-linux-gnu/libEGL.so to /usr/lib/x86_64-linux-gnu/libEGL.so.distrib by nvidia-340
diversion of /usr/share/dict/words to /usr/share/dict/words.pre-dictionaries-common by dictionaries-common
diversion of /usr/lib/i386-linux-gnu/libGLESv2.so.2 to /usr/lib/i386-linux-gnu/libGLESv2.so.2.distrib by nvidia-340
diversion of /usr/lib/x86_64-linux-gnu/libGLESv2.so.2 to /usr/lib/x86_64-linux-gnu/libGLESv2.so.2.distrib by nvidia-340
diversion of /usr/lib/i386-linux-gnu/libGLESv1_CM.so.1 to /usr/lib/i386-linux-gnu/libGLESv1_CM.so.1.distrib by nvidia-340
diversion of /usr/lib/x86_64-linux-gnu/libGLESv1_CM.so to /usr/lib/x86_64-linux-gnu/libGLESv1_CM.so.distrib by nvidia-340
diversion of /usr/lib/x86_64-linux-gnu/libEGL.so.1 to /usr/lib/x86_64-linux-gnu/libEGL.so.1.distrib by nvidia-340
diversion of /usr/share/man/man1/sh.1.gz to /usr/share/man/man1/sh.distrib.1.gz by dash
diversion of /usr/lib/i386-linux-gnu/libGLESv2.so to /usr/lib/i386-linux-gnu/libGLESv2.so.distrib by nvidia-340
diversion of /usr/lib/i386-linux-gnu/libEGL.so to /usr/lib/i386-linux-gnu/libEGL.so.distrib by nvidia-340
diversion of /usr/lib/i386-linux-gnu/libGL.so to /usr/lib/i386-linux-gnu/libGL.so.distrib by nvidia-340
diversion of /usr/lib/x86_64-linux-gnu/libGL.so to /usr/lib/x86_64-linux-gnu/libGL.so.distrib by nvidia-340
diversion of /usr/lib/i386-linux-gnu/libGLESv1_CM.so to /usr/lib/i386-linux-gnu/libGLESv1_CM.so.distrib by nvidia-340
diversion of /usr/share/aisleriot/cards/bonded.svg to /usr/share/aisleriot/cards/bonded.svg.unbranded by branding-ubuntu
diversion of /usr/lib/i386-linux-gnu/libEGL.so.1 to /usr/lib/i386-linux-gnu/libEGL.so.1.distrib by nvidia-340
diversion of /usr/share/gnome-mahjongg/themes/postmodern.svg to /usr/share/gnome-mahjongg/themes/postmodern.svg.unbranded by branding-ubuntu
diversion of /bin/sh to /bin/sh.distrib by dash
diversion of /usr/lib/x86_64-linux-gnu/libGLESv1_CM.so.1 to /usr/lib/x86_64-linux-gnu/libGLESv1_CM.so.1.distrib by nvidia-340
diversion of /usr/share/aisleriot/pixmaps/baize.png to /usr/share/aisleriot/pixmaps/baize.png.unbranded by branding-ubuntu
diversion of /usr/share/aisleriot/pixmaps/slot.svg to /usr/share/aisleriot/pixmaps/slot.svg.unbranded by branding-ubuntu
diversion of /usr/lib/x86_64-linux-gnu/libGLESv2.so to /usr/lib/x86_64-linux-gnu/libGLESv2.so.distrib by nvidia-340

And this is how it looks when i’ve cleared everything :

diversion of /usr/share/dict/words to /usr/share/dict/words.pre-dictionaries-common by dictionaries-common
diversion of /usr/share/man/man1/sh.1.gz to /usr/share/man/man1/sh.distrib.1.gz by dash
diversion of /usr/share/aisleriot/cards/bonded.svg to /usr/share/aisleriot/cards/bonded.svg.unbranded by branding-ubuntu
diversion of /usr/share/gnome-mahjongg/themes/postmodern.svg to /usr/share/gnome-mahjongg/themes/postmodern.svg.unbranded by branding-ubuntu
diversion of /bin/sh to /bin/sh.distrib by dash
diversion of /usr/share/aisleriot/pixmaps/baize.png to /usr/share/aisleriot/pixmaps/baize.png.unbranded by branding-ubuntu
diversion of /usr/share/aisleriot/pixmaps/slot.svg to /usr/share/aisleriot/pixmaps/slot.svg.unbranded by branding-ubuntu

EDIT:
After 100 of clean, purge, reboot, install, … it worked… i can’t tell anything else…

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