How to reinstall missing libraries to repair ubuntu 20.10 after stupidly purging some libraries and shutting down

I'm fairly new to linux and I was trying ti install samba in order to use to share files with a Windows 10 qemu/kvm virtual machine. Samba though wouldn't be installed and I couldn't figure out why. Searching through the forum I stupidly followed some guy's instructions where he would autoremove some library but with the --purge flag.

Almost immediately I realized that wasn't a wise move since it had started removing libs like pulse audio and gnome. I wasn't worried because I found in the logs the libraries that had been removed and I was in the process of writing a mini C++ program to take the log file as input and generate a bash file to re-install thise libraries.

Meanwhile though I had to move to a different location, so I closed the lid of the laptop. And from there things went south. When I reopened the lid, the screen wouldn't let me authenticate (keyboard was inaccessible and the login couldn't receive any input), so I had to reboot, hoping for a miracle.

Needless to say that the miracle didn't came. I'm in the process of taking a backup through the SupportAssist OS Recocery that Dell ships with. I also have access to grub.

Is there any way to save the situation without freshly reinstalling the OS?


What may help is to boot into a recovery prompt with network support, and then reinstall the "ubuntu-desktop" metapackage. That metapackage is a package that has as dependency everything deemed part of the standard Ubuntu desktop. Installing it back will pull back in all required packages that were removed.

This question details how to boot into a recovery prompt. Once you are at the prompt, issue the command

sudo apt install ubuntu-desktop

When done, sudo reboot will cause a reboot.