5

I have a dual-boot machine with Windows8 and Ubuntu 20.04.3 LTS.

It worked fine up until I pressed Yes (install) to some automatic updates from Ubuntu via the GUI pop-up window. These updates failed at around 70%. The problem is with nVidia drivers.

My motherboard is GT216 (GeForce GT 220). Running ubuntu-drivers devices I get:

driver: nvidia-340 - distro non-free recommended

driver: xserver-xorg-video-nouveau -distro free builtin.

After I shut down the computer after that failed update, at restart I got a login-infinite loop at the login screen (entered password, no login into Gnome Desktop, asked for password again, entered it again, no login into Gnome Desktop, repeat). I researched online and I found out that the nvidia-340 drivers are not compatible with my current kernel version.

Using tty terminals I worked through this tutorial https://www.if-not-true-then-false.com/2020/inttf-nvidia-patcher/ and then I installed nvidia-340 by running the executable I got via the tutorial. I followed the steps from here: https://www.if-not-true-then-false.com/2021/debian-ubuntu-linux-mint-nvidia-guide/#before-installation. I can now login into Gnome.

Problem:

All my graphics programs are destroyed. In the past when my machine was functioning properly, I had installed Qt5 and linked against a framework I use for work. Now that framework doesn't function anymore, I cannot compile programs against the visualization drivers anymore.

I tried to reinstall the visualization drivers again, as I did 3-4 months ago on the same machine (when I successfully set up that framework I use for work): but I fail at the very first step: sudo apt install qt5-default

Removing nvidia-340 (340.108-0ubuntu5.20.04.2)... /var/lib/dpkg/info/nvidia-340.postrm: 59: /usr/sbin/update-initramfs: not found

dpkg: error processing package nvidia-340 (--remove):

installed nvidia-340 package post-removal script subprocess returned error exit status 127

dpkg: too many errors, stopping

Errors were encountered while processing:

nvidia-340

Processing was halted because there were too many errorrs.

E: Sub-process /usr/bin/dpkg reurned an error code (1).

Attemtps I did:

  1. I have tried to do what it's written in here Ubuntu 18.10 problem with Nvidia 340 drivers

  2. I have tried to run sudo apt-get install nvidia-current : E : Package 'nvidia-current' has no installation candidate

  3. I have tried to switch to Nouveau from the Applications -> Software & Updates -> Additional Drivers, but it doesn't work. When I click to switch to that, Error while applying changes: pk-client-error-quark: Error while installing package: installed nvidia-340 package post-removal script subprocess returned error exit status 127 (313)

  4. I have tried to run nvidia-settings -> this pops up a new window with various information, which I can provide if needed.

  5. I have tried to run sudo apt-ache policy nvidia-340 -> this returns nvidia -340 : Installed : 340-108-0ubuntu5.20.04.2 candidate : 340-108-0ubuntu5.20.04.2 ... etc

  6. I have tried to run which nvidia-smi -> this returns nothing

6') I have tried to run nvidia-smi -> returns 'nvidia-smi' command nout found, can be installed with: and here appears a list of nvidia drivers it recommends installing via sudo apt install nvidia-XYZ or sudo apt install nvidia-utils-XYZ.

  1. I have tried to run sudo ubuntu-drivers autoinstall -> this returns the same thing as before: The following packages will be removed: nvidia-340 Removing nvidia-340 ... dpkg: error processing package nvidia-340 (--remove): installed nvidia-340 package post-removal script subprocess returned error exit status 127 dpkg: too many errors, stopping Errors were encountered while processing: nvidia-340 ...

  2. I have tried to run sudo apt-get install nvidia-340 -> this returns that nvidida-340 is already the newest version (340.108-0ubuntu5.20.04.2) 0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded. 1 not fully installed or removed. Need to get 52,0 MB of archives. After this operation, 0B of additional disk space will be used. Do you want to continue ? Yes Y Get: 1 ... Fetched 52,0 MB in 2 s Processing triggers for libc-bin (2.31-0ubuntu9.2) ... and here I don't get any more returned statements and I just get a new line on the terminal to enter a new command as in $ > ... (so process exits alright and I can just continue doing stuff).

When writing (to configure my framework again) sudo apt install qt5-default I again get the same errors as above (in the Problem section)

Do you know what is happening or what shall I do? I really want to be able to compile applications again and run them on my machine.

I can provide any necessary info which might be useful to solve my problem.

Thank you in advance!

Edit (new info):

My current kernel version which appears as output when running uname -r is:

5.11.0-36-generic

5
  • 1
    ...and what is "my current kernel version"? Nvidia-340 is only compatible with 5.4 kernel Ubuntu 20.04 was originally released with. If you happen to have 5.11, it would break things. Sep 24 at 21:12
  • @mikewhatever, thanks. My current kernel version is uname -r 5.11.0-36-generic. If the last Software Update made the kernel to arrive at this version, do you know what could I do, I don't know, to have a lower version of the kernel? I just want everything to work as before, it was all good.
    – velenos14
    Sep 24 at 21:25
  • At the grub menu, look under the Advanced choice, and you should have choices of the older kernels, with a hopefully working Nvidia driver.
    – ubfan1
    Sep 24 at 21:41
  • @ubfan1, thanks. When doing that, I can only choose from 4 alternatives: with Linux 5.11.0-36-generic, 5.11.0-36-generic (recovery mode), 5.11.0-34-generic, 5.11.0-34-generic (recovery mode) ...
    – velenos14
    Sep 24 at 21:52
  • 1
    You'll need to go back to 5.4 wiki.ubuntu.com/Kernel/… Sep 24 at 23:08
7

You'll need to install the 5.4 kernel, and uninstall 5.11.

  1. sudo apt purge nvidia*

  2. sudo apt install --install-recommends linux-generic

  3. Now reboot, and select kernel 5.4 at grub menu.

  4. sudo apt remove --purge linux-generic-hwe-20.04 linux-hwe-* linux-modules-5.11* linux-modules-extra-5.11*

  5. If everything worked so far, run sudo ubuntu-drivers autoinstall to install Nvidia driver.

13
  • thank you! just to check before I write these commands, from the link wiki.ubuntu.com/Kernel/…, I read that one step is as following: "And then install appropriate NNN version of the drivers: sudo apt install --install-recommends linux-modules-nvidia-NNN-generic " . Do I need to do this after sudo apt install --install-recommends linux-generic and before rebooting?
    – velenos14
    Sep 25 at 7:27
  • does Ubuntu install automatically all the necessary nVidia drivers when I log-in onto the kernel 5.4? Or do I need to manually install them after booting onto this kernel 5.4? so I am asking whether do I need to perform additional steps after booting onto kernel 5.4 in order to have correctly installed nVidia drivers
    – velenos14
    Sep 25 at 7:28
  • You'll need to install it. The ubuntu-drivers autoinstall should work for kernel 5.4. ...and yes, you need to install the 5.4 kernel first. Whether you reboot or not is less important, but if kernel 5.11 is still present, the Nvidia module will also build for it, and will fail. Sep 25 at 9:16
  • sorry, but sudo apt install --install-recommends fails! It reads: Fetched 75,5 MB in 4s ... Removing nvidia-340 (340.108-0ubuntu5.20.04.2) ... /var/lib/dpkg/info/nvidia-340.postrm: 59: /usr/sbin/update-initramfs: not found dpkg: error processing package nvidia-340 (--remove): installed nvidia-340 package post-removal script subprocess returned error exit status 127 dpkg: too many errors, stopping. Errors were encountered while processing: nvidia-340. E: Sub-process /usr/bin/dpkg returned an error code (1). Just to make sure: Do I need to run that command in my actual ubuntu terminal?
    – velenos14
    Sep 25 at 11:36
  • 1
    Alright, I've added step 0, according to your suggestion. Try and see if it works. For whatever reason, I have no access to chat, so can't join you there. Sorry about that. Sep 25 at 17:46

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.