You can always reinstall the same Ubuntu version without reformatting the system directory. In that case, all you user files and settings will stay in place. At most, you may need to reinstall some applications you installed yourself.
To recover your system this way, boot up an installation medium of the same Ubuntu version. In the Installer, on the "Installation type" dialog, select "Something else". Indicate your current system partition as the partition to be used as root ("/") and uncheck the "format" checkbox. If you had a home folder or any other part of the system on another partition, reassign the same partitions, making sure "format" is unchecked.
This will repair your system while leaving your setup largely in place, except from some applications you may need to reinstall. After reinstall, also these applications will continue to be configured as before, because your user preferences are still in place.
Needless to say, even if this preserves all your date, make sure that the back up of all your personal user data is updated before proceeding.
sudo apt update
). You mention rebuilding 'sources.list'; how did you 'rebuild' it? – guiverc Feb 01 '20 at 12:14sudo apt autoremove
only removes packages that were installed to satisfy certain other packages you installed. They'll only get removed if you removed the reason they were installed (eg. by removing the packages that caused their install).apt autoremove
only cleans up some space from commands you'd executed earlier, so any errors of removal were actuallyapt remove
commands performed before theautoremove
– guiverc Feb 01 '20 at 12:19sudo apt update
to update your software lists &apt install
should find ubuntu software again. For the broken packages, trysudo apt -f install
and read any error messages there (they're the answer to fixing any problems it can't auto fix) – guiverc Feb 01 '20 at 12:29sudo apt-get update
and it is updating sources. I will try installing ubuntu-desktop after that. thanks for the help :) – omer Feb 01 '20 at 12:32apt install
it (ubuntu-desktop for 16.04,
ubuntu-unity-desktopfor 18.04 or later). If you have errors, add them to your question or package isn't found,
apt-cache policy ubuntu-desktop` (if sources.lists is correct you'll see results) – guiverc Feb 01 '20 at 12:33deb http://archive.ubuntu.com/ubuntu/ bionic main restricted universe multiverse deb http://archive.ubuntu.com/ubuntu/ bionic-updates main restricted universe multiverse deb http://archive.ubuntu.com/ubuntu/ bionic-backports main restricted universe multiverse deb http://security.ubuntu.com/ubuntu bionic-security main restricted universe multiverse deb http://archive.canonical.com/ubuntu bionic partner
– karel Feb 01 '20 at 13:33source.list
but that went in vain as well. Somehow I was able to get UI back usingapt install -f
command. it installed some libs. But System was totally broken. no apps. no settings. So I will recover the system the normal way without apps. – omer Feb 01 '20 at 16:33