Fixing a Broken Ubuntu GUI. Lessons learned from bad driver... | by Normaler Mensch | Towards Data Science

I switch between Windows and Flavors of Ubuntu a lot. I recently noticed that I haven’t used my Kubuntu PC in a while during which it gathered dust. I decided to bring it up to speed. Having had enough of Kubuntu, I switched to Ubuntu 20.04, which wasn’t all so much a pain to install, you know... the GUI support, and all.
The trouble came afterward when the installation was slower than the economy during the pandemic. In the process of fixing these errors, I went through the all-too-familiar NVIDIA, light-dm issues that I had to go through a couple of times as a Ubuntu newbie. I decided to document it once and for all, for everybody suffering from new installations of Ubuntu like me.
This is probably because Ubuntu defaults to the XOrg drivers with a new Installation. You can see that in your Software updates application under “Additional Drivers”. If Xorg is selected (Third option in the screenshot), it’s probably not the best. (Used up the majority of CPU in my case).
In order to fix this, you now either have to:
Install Proprietary drivers of your graphics card (Mine was NVIDIA GeForce GT)Find the latest stable version of drivers for your graphics card and install them
Install Proprietary drivers of your graphics card (Mine was NVIDIA GeForce GT)
Find the latest stable version of drivers for your graphics card and install them
(You will know you have to do 2 when you try 1 and it fails on your face(!)
So, if 1 worked for you, awesome, do a
sudo reboot
and you are good to go!
If your GUI hung up for some reason, or the process didn’t finish successfully, you are better off switching back to Xorg and reinstalling stable drivers. If you don’t do this, your GUI gets all messed up on reboot. In my case, the reboot failed. It took me to a sad blinking cursor on a blank screen like so:
In order to get out of this abyss, press ctrl + F1 (Or F2,3,4,5,6,7) until one of those works.
ctrl + F1
you will enter a regular command-line interface from there. Log in with your user name and password. Then, execute these:
sudo apt-get purge lightdmsudo apt-get updatesudo apt-get install lightdmdpkg-reconfigure lightdmsudo reboot
This is because Ubuntu’s display is managed by lightdm package, which failed. You are purging it and reinstalling it to fix these issues. when you reconfigure lightdm, you will be asked if you want to stay with lightdm or change to GDM3. I stayed with lightdm because I was more familiar (And a lot of ppl on the internet complained about gdm as a manager with NVIDIA drivers)
At this point, I was overjoyed because on rebooting, everything seemed to work and I came to my sign-in screen. While I typed my credentials with joy in my heart and spring in my step, my computer decided to just keep asking me for my credentials again and again. I WAS STUCK IN A LOGIN LOOP!!
Note: If your dpkg reconfigure fails in this line,
dpkg-reconfigure lightdm
run this and you should be fine:
sudo dpkg --configure -a
If you cannot login to your account but the GUI is back, you have to fix your drivers from the command line (Ofcourse you have to! you broke them in step 1!!!)
So now, Press Ctrl+F3 to get back control over your command line. (with Alt+arrow keys, you can switch between screens: Login, command line etc.). Login with your credentials.
Ctrl+F3
There are 2 possible sources of failure here, Failure of configuration of
.Xauthority permissons are messed upNVIDIA drivers are messed up
.Xauthority permissons are messed up
NVIDIA drivers are messed up
In our case, we know it’s the drivers. If you want to check your Xauthority permissions, do this:
ls -lA
Now look for the line:
-rw — — — — 1 user user 79 Sep 3 19:56 .Xauthority
If instead of where your username has to be, you see:
-rw — — — — 1 root root 79 Sep 3 19:56 .Xauthority
You have to:
chown username:username .Xauthority
And you have your authority and you can log in!
If that wasn’t the problem in the first place, get to reinstalling the drivers:
sudo add-apt-repository ppa:graphics-drivers/ppasudo apt update
Now look for what drivers are available:
I used the third party free recommended driver. Install it (replace the last your-Nvidia-driver-here with the actual name of it from the above result):
sudo apt install your-nvidia-driver-here
If this worked, not only is your GUI back but also you have better drivers for your graphics card hardware!
do a:
sudo reboot
This should do it!
My computer now works like a good regular computer should and doesn’t take forever to startup. If you have had a similar problem, hope this helps!