0

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.

4
  • 1
    Honestly, if you uninstall Python, I don't think there's much you can do to fix it. The best option is to backup and reinstall. Aug 7, 2016 at 23:05
  • 2
    Make a backup and then reinstall using "something else". Set up all the partitions as you have now -without using "format"- If that works you will recover your system with all your current applications, settings and data intact. Otherwise re-install with format and restore the backup.
    – Rinzwind
    Aug 7, 2016 at 23:10
  • 2
    AFAIK, Ubuntu is heavily reliant on Python. Once you take out Python, the entire system falls. And then you're left with a dead snake, which isn't pleasant. Aug 8, 2016 at 1:02
  • If I were you, I'd install (or reinstall) the ubuntu-desktop package; this should bring in any packages you inadvertently removed. Run sudo apt update followed by sudo apt install ubuntu-desktop Aug 8, 2016 at 1:14

1 Answer 1

1

sudo apt-get install ubuntu-desktop

That reinstalls Unity, and hopefully things will come back.

You could research other 'desktop enviroments for ubuntu' and see if they interest you. I use Plasma, and I really like it.

Plasma: sudo apt-get install plasma-desktop

You might want to see how far the damage went, because I once faced a problem like this and I just abandoned Ubuntu. I don't think I was even able to boot into Ubuntu. If you can boot into Ubuntu and a login screen pops up, that's good. If you log in and things are missing, try my suggestions. If you don't get a login screen but are greeted by a Ubuntu loading screen, then try Ctrl + Alt + F1 and login, and do the command sudo apt-get install lightdm ubuntu-desktop.

Hopefully those can help your problems!

If not, just let us know (the Ubuntu community is really great at these problems (I'm the person who normally gets into these problems, but still)).

Not the answer you're looking for? Browse other questions tagged .