Stuck with the ubuntu login loop and failed to start session 20.04

Recently I had to face a serious issue with the ubuntu login loop and failed to start a session with my 20.04 desktop. How did the problem start? When I searched google found that this problem started with the NVIDIA driver missing.

In order to make my ubuntu more lightweight, I started deleting unnecessary software from my machine. Unfortunately, I deleted the audio driver named PulseAudio also. I can not increase or decrease volume as I do not have an audio driver though I can hear the sound properly. I wanted to fix the problem by installing the broken package update command but failed. I tried to install the latest version of PulseAudio but had no luck. The main issue started after installing PulseAudio because it did not match its version with ubuntu.

What are the consequences? I have lost my graphical interface, am stuck with a black login screen and I am forcefully logged out though I have provided the correct login credentials. Let's discuss a Solution path

  1. need to access ubuntu with single user mode
  2. create a new user and add this user to sudo group
  3. install gdm3 / lightdm using the command line
  4. install ubuntu-session using the command line
  5. install ubuntu-desktop using the command line

Access Ubuntu/Linux with single user mode

You should follow these steps properly:

  1. reboot
  2. enter the GRUB console by pressing shift (left, right, or both?) during the boot splash
  3. select the regular kernel image you always boot from (this wasn't in the top-level menu but in a menu 1 level deep)
  4. press e
  5. go to the line that starts with linux and move the cursor to the end
  6. remove the part that says ro quiet splash (or something like that) and add this at the end of the line: 
rw init=/bin/bash

press Ctrl-x to boot into that image with these boot parameters

Create a new user and add this user to sudo group

sudo useradd zahid -m -s /bin/bash -g sudo 
passwd zahid 

Install gdm3 / lightdm using the command line

sudo apt-get install gdm3

or 

sudo apt-get install lightdm

Install ubuntu-session using the command line

sudo apt-get install -y ubuntu-session

Install ubuntu-desktop using the command line

sudo apt-get install -y ubuntu-desktop

I think this will solve your problem.