Ubuntu – Best way to Reinstall Ubuntu 14.04 Without Deleting the Files


I deleted python from Ubuntu 14.04 and now my unity desktop is gone. I can't close any files I have open. The only way I can run commands is by using xterm. I still have access to my files, which is a good thing because I have programming assignments and other related school documents I can't afford to delete. I've tried everything to restore unity desktop. when I run apt-get install ubuntu-desktop I'm always receiving

Could not find Platform independent libraries prefix
Could not find Platform dependent libraries exec-prefix
E: sub-process /usr/bin/dpkg returned an error code (1)".

I don't have much time to invest in finding a fix. What is the best alternative in getting my system up and running again, considering I don't want to delete my school files?

Best Answer

2 possible ways. The 1st is a generic method that will take the same time as a normal install and will always work.

Boot a live DVD. During the partition setup do NOT tick ANY of the "format" checkboxes and have the system install. Mount the partitions to the names you currently have and set it up with the same username.

This will overwrite any system related file, leave all your configuration files and leave your /home/ as it is.

Mind though: making a backup is always the preferred method. You can do that from a live DVD too (take a blank DVD and use Brasero to burn your files or use a stick to copy files over to it).

You might like to try this first: "Could not find Platform independent libraries prefix" will show up when you are missing /usr/lib/python2.7.

This should be a fix for that:

cd ~/Downloads/
apt-get download python2.7 python2.7-minimal libpython2.7
sudo dpkg -i python2.7_*.deb python2.7-minimal_*.deb libpython2.7_*.deb

After that you should also be able to do a sudo apt-get install -f ubuntu-desktop to get a working desktop. Just to be sure that you installed the most up to date python packages, run sudo apt-get update && sudo apt-get dist-upgrade.

You can do the commands on another Ubuntu machine or download the files using a browser and then copy them over to the system you want them installed. The 3rd command installs it.