The output of sudo systemctl status gdm
:
Unit gdm.service could not be found.
Suggests that gdm3
the graphical login manager is missing ( probably removed by mistake ).
Installing ubuntu-desktop
like so:
sudo apt install ubuntu-desktop
or if it the above tells you ubuntu-desktop
is already installed, try reinstalling it like so:
sudo apt install --reinstall ubuntu-desktop
Should solve this problem.
As to what caused this, the answer is in your grep -E "remove|purge" /var/log/dpkg.log
output:
2020-04-10 19:24:11 remove ubuntu-desktop:amd64 1.417.4
2020-04-10 19:24:27 remove gdm3:amd64 3.28.3-0ubuntu18.04.4
ubuntu-desktop
the Ubuntu desktop environment and gdm3
the graphical login manager which is part of ubuntu-desktop
were removed along with many other packages.
The reason they were removed although you might have not removed them in particular is one of two reasons:
You tried to remove or install a package while you have not ran sudo apt update
in a long time and you did not pay attention to APT prompting you to accept the removal of packages and you just typed yes and pressed Enter. Yes you don't only need update to install, but you also need it to correctly remove packages.
They were removed as a parts of another package you tried to remove and again you did not pay attention to APT prompting you to accept the removal of packages and you just typed yes and pressed Enter
Best of luck.
sudo dpkg --configure -a && sudo apt update --fix-missing -y && sudo apt install -f -y && sudo apt full-upgrade -y
and see if it restores it. – Raffa Apr 10 '20 at 18:53sudo apt purge nvidia-*
then runsudo ubuntu-drivers autoinstall
then reboot – Raffa Apr 10 '20 at 19:08sudo systemctl status gdm
– Raffa Apr 10 '20 at 19:21sudo apt install ubuntu-desktop
– Raffa Apr 10 '20 at 19:28grep -E "remove|purge" /var/log/dpkg.log
to investigate what went wrong. – Raffa Apr 10 '20 at 19:58sudo systemctl status gdm
so that it helps people diagnose the problem. I will also update my answer later when you add the output ofgrep -E "remove|purge" /var/log/dpkg.log
to indicate the cause. – Raffa Apr 10 '20 at 20:34