So I was trying to use Django, which of course was broken out-of-the-box, and so in trying to correct it, I made the stupid decision to try and upgrade my Python from 2.x to 3.5...
Stupid me...
I foolishly followed a link to sudo apt-get install pythonsomethingorother
and of course, because the link was not an "official" distribution, it too was broken. In an attempt to fix it, I decided to uninstall python 3.5 via sudo apt-get remove python3.5
, which as you may be guessing, started to mess things up, bad. I saw Unity and gnome being clobbered and did my best to ctrl C (did nothing) and eventually managed to close the terminal by fanatically click the 'x' and such (it was a blur, I felt like I was dying).
But now things are... messed up, potentially pretty bad. The icon for firefox just came back as I am typing this, but was not there a moment ago. The regular terminal will not open, though I can open xterm. Every word I type has the red squiggly line underneath (dictionary got clobbered?) which is more annoying than anything, but a bunch of application icons seem to have gotten clobbered as well. I can still type up this question in firefox, and spotify is running, which is/are good news I think, but I am worried that if I close my laptop and come back, I will not be able to boot up the OS again. What can I do to salvage the situation? (other than reinstall python 3.5).
I should note that I am using Ubuntu 16.04, and installed using full-disk encryption. Having had problems booting and decrypting the disk prior, I was afraid to reboot the system (into windows dual boot or otherwise).
EDIT: I managed to more or less return my OS to its original state. I'll post what I did in case anyone else finds themselves in the same unfortunate position...
First, try using XTerm, since the gnome ("regular") terminal is probably broken. If you cant find or use XTerm, you can do the following:
MAKE SURE TO READ THE FULL SENTENCE/PARAGRAPH BELOW BEFORE ATTEMPTING
You can type ctrl + alt + f3 to open a virtual terminal. You will have to type in your username and password to log in, but then you can do sudo apt-get commands. You need to press ctrl + alt + f7 to get back to the graphical terminal. This is the default but if this does not work, try f4-f6.
Then:
sudo apt-get install build-essential checkinstall
sudo apt-get install libreadline-gplv2-dev libssl-dev libsqlite3-dev tk-dev libgdbm-dev libc6-dev libbz2-dev
cd ~/Downloads
wget https://www.python.org/ftp/python/3.5.0/Python-3.5.0.tgz
tar -xvf Python-3.5.0.tgz
cd Python-3.5.0
./configure
sudo make install
sudo apt-get install gnome-terminal
(You can now use the "old" terminal)
and then:
sudo apt-get install gnome
sudo apt-get install unity
sudo apt-get install ubuntu-standard
sudo apt-get install ubuntu-desktop
sudo apt-get autoremove
Some of these may be a little overkill, but overall, I think I may have used 1 or 2 extra GB than I did before this whole catastrophe, which is a rather minimal cost for keeping my data and setup, in my opinion. I needed to reset a handful of settings, but another rather small price to pay. The system boots fine, and save for the settings, I have not noticed any other changes. Best of luck if you find yourself in the same position!
PS If you get any errors on the command with "libreadline" and the like, try the command without the packages that are causing problems.
ubuntu-desktop
package; this should bring in any packages you inadvertently removed. Runsudo apt update
followed bysudo apt install ubuntu-desktop