Loop Login problem with NVIDIA driver 470.57.02

What I am enchanting is the Login Loop problem and I couldn’t enter the desktop. This happens after the installation of the NVIDIA driver (470.57.02) on Ubuntu 20.04 LTS

I tried the methods from google but not worked for me.

Replace GRUB_CMDLINE_LINUX_DEFAUT=“quiet splash” with GRUB_CMDLINE_LINUX_DEFAUT=“quiet” (i.e. delete splash).

set sudo nano /etc/gdm3/custom.conf

Check ls -ld /tmp

remove /etc/X11/xorg.conf

rm -rf ~/.cache

(After adding a new user, the error is still there)


Can you please tell me how to solve the problem?

You install the 460 driver again in this way from the terminal:


I got a new error when installing 460.

“Errors were encountered while processing:
E: Sub-process /usr/bin/dpkg returned an error code (1)”

I tried -f for install, but still got the same issue.

Could you please tell me how to solve it?

From where did you install the nvidia 470 driver? From .run file? From official Ubuntu repos? From some external PPA repository?

from the official Nvidia webpage, and it is a run. file. my computer was with 450. after installation, everything is fine, such as CUDA and pytorch. But i can only use ssh as i can’t enter the desktop. now even i run sudo apt-get purge “nvidia*”, i can’t enter the system after deleting the nvidia driver.

I never install the driver from the .run file because I have always had problems doing so.
If you want to try uninstalling the driver from the .run file you could try:
sudo /usr/bin/nvidia-uninstall

And follow the steps indicated there in the terminal

Then to try to remove whatever rest of the nvidia package:
sudo apt-get --purge remove "*nvidia*"

If you get the error you mentioned above try what it is recommend here:

You should be careful what you type if you cannot Copy & Paste.

If you have internet access and you want to install 460 drivers from ubuntu repositories:
sudo apt-get update


sudo apt-get install nvidia-driver-460

Hi, i followed your steps until nvidia-driver-460
i got the same error
update-initramfs: Generating /boot/initrd.img-5.11.0-25-generic

Errors were encountered while processing:



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

I also tried the run. file of 460 from the official webpage and it works fine with ssh, but still can’t show the desktop

As i mentioned, it works fine with 450 (it is also installed by run. file with a same way) and became wrong after installing 470. i think the reason should be something change made by the 470. Do you think there are any possible factors?

There are many reports of problems with the 470 driver. You should try installing the latest driver that worked well for you.

But I also see that in the first message you mentioned that you manually made a lot of changes in different configuration files, so I’m not sure if any of the problems are due to it. You should also try to reverse those changes that you made.

they will have no influence as when i checked them and confirm the method didnt work for my situation, i set them back as same as before

i checked them one by one instead of trying them at the same time

when i run sudo apt --fix-broken install
the same error occured:

Errors were encountered while processing:…]



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

In the link they recommend this (not easy if you have to type it manually)

sudo apt-get -o Dpkg::Options::="--force-overwrite" install --fix-broken

i saw it and had tried but it didn’t work
after running, it showed the same message in the end:

Errors were encountered while processing:



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

it seems that the apt has stuck with nvidia-driver-460

no matter i try apt install or apt update/upgrade, i got the same message in the end

I don’t know what to say, this problem usually occurs when there has been a problem with the installation process and something has been corrupted. You try searching the internet with the error message, for example:

Hi, thank you for your help. I fixed the sub process problem and install the 460 driver but it showed as that at the beginning – working fine with ssh but cannot enter the desktop.

by checking and solving the new errors after that, I still couldn’t solve the problem.

I should have checked this problem step by step to find the real problem, but due to the time limitation, finally, I did these at the same time, so that i don’t know what exactly the problem was.

delete all related files of nvidia
delete all related files of Cuda
delete all possible blacklist files
update the ubuntu kernel
reinstall the Nvidia driver
reinstall the Cuda through the run. file

and finally it works. Anyway, thank you very much for your time and help!