Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

I am a novice at Ubuntu and unfortunately i have deleted 3 files in the usr/bin folder

python 2.7
python
python 2.6

Now my update manager wont work and when i type in python into gnome it says that it is no longer there.

Please help me ive tried loads of different things but it just wont work.

The closest i got was the following:

I typed in sudo apt-get -f install

and i thought i had fixed it but then i got a error message -

Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following packages were automatically installed and are no longer required:
  gir1.2-folks-0.6 gir1.2-polkit-1.0 libcogl5 mutter-common gir1.2-json-1.0
  libcaribou0 gir1.2-accountsservice-1.0 gir1.2-clutter-1.0 gir1.2-gkbd-3.0
  gir1.2-networkmanager-1.0 caribou libcogl-common libmutter0
  gir1.2-mutter-3.0 gjs gir1.2-caribou-1.0 libclutter-1.0-0
  gir1.2-telepathylogger-0.2 libclutter-1.0-common cups-pk-helper
  gir1.2-upowerglib-1.0 gir1.2-cogl-1.0 libmozjs185-1.0
  gir1.2-telepathyglib-0.12 gir1.2-gee-1.0 libgjs0c gnome-shell-common
Use 'apt-get autoremove' to remove them.
The following extra packages will be installed:
  ubuntu-sso-client
The following packages will be upgraded:
  ubuntu-sso-client
1 upgraded, 0 newly installed, 0 to remove and 35 not upgraded.
2 not fully installed or removed.
Need to get 0 B/57.7 kB of archives.
After this operation, 16.4 kB of additional disk space will be used.
Do you want to continue [Y/n]? y
Setting up python-minimal (2.7.2-7ubuntu2) ...
/var/lib/dpkg/info/python-minimal.postinst: 4: python2.7: not found
dpkg: error processing python-minimal (--configure):
 subprocess installed post-installation script returned error exit status 127
Errors were encountered while processing:
 python-minimal
E: Sub-process /usr/bin/dpkg returned an error code (1)

any advice is appreciated!

share|improve this question
    
I've edited the answer, you can try the last portion. –  Anwar Shah Jun 18 '12 at 14:59

2 Answers 2

Try reinstalling the python packages via apt-get with the --reinstall option:

$ sudo apt-get install --reinstall python-support python python-minimal python2.7-minimal python2.7 python2.6-minimal python2.6
share|improve this answer
    
jwo@Dingo:~$ sudo apt-get install --reinstall python- support python [sudo] password for jwo: Reading package lists... Done Building dependency tree Reading state information... Done E: Unable to locate package support jwo@Dingo:~$ –  Plonkaa Jun 16 '12 at 20:48
    
i thought i fixed it but then i had this error Unpacking python-minimal (from .../python-minimal_2.7.2-7ubuntu2_all.deb) ... Processing triggers for man-db ... Errors were encountered while processing: /var/cache/apt/archives/ubuntu-sso-client_1.4.1-0ubuntu1.1_all.deb E: Sub-process /usr/bin/dpkg returned an error code (1) –  Plonkaa Jun 17 '12 at 1:51

I would suggest trying to run the live CD, find those files you deleted, and copy them to your installed /usr/bin folder. This should not be too hard to do. You can probably mount your installed partition using Nautilus, open it, and try copying using the GUI. If there is an error due to permissions, you may need to use the terminal to copy the files to (I believe) /media/*/usr/bin using "sudo cp", where the asterisk will be the name of the partition for your installation.

As a novice, you should not be deleting files that require root/admin authority (ie, using sudo or equivalent) without either knowing absolutely that it's OK, or at least copying it to a temporary folder for a while to make sure it's OK. That is why only certain users are allowed to do that.

Edit: More details

I booted my live CD (12.04), and I do see python 2.7 in the directory you specified. I don't think you need the previous version.

Using Nautilus, I was able to click on my real installation, and it automounted to /media, as expected. The files in /media/usr/bin are owned by root, so nautilus can't copy the files, unless it's run as root.

To reproduce the files, do this:

  1. Make sure your installation is mounted by clicking on it in Nautilus, where you should then see the symbol for mounted partitions, a sort of up-arrow with a line under it.

  2. Run the bash terminal to get a command line, and enter cd /media/*/usr/bin, where the asterisk is the name you see in Nautilus; you can press tab to autocomplete so you don't need to type in the name.

  3. Enter the command sudo cp -P /usr/bin/py* ., which will copy the python files to the current directory, and preserve the links (python links to python2.7).

This should replace the deleted files.

You might be able to reinstall it using the software center or apt-get if you were to reinstall it rather than install, or uninstall it first. I think the error may be that it thinks it is installed, so it doesn't copy a new version of the file. Then, it tries to access the file, and it's not there as expected.

share|improve this answer
    
I know i shouldn't have played about with it- trust me im paying the price now! i have just tried that and it didnt work. Any other suggestions? –  Plonkaa Jun 16 '12 at 16:24
    
I will get out my live CD and take a look, then edit my answer if I find anything. Meanwhile, can you provide some detail about what "didn't work" when you tried it, just in case? –  Marty Fried Jun 16 '12 at 16:29
    
im actually using a usb as i dont have a cd drive on netbook. I had a look at the files but i couldnt find the files i deleted this morning. I need 3 exec files which are python 2.7- python 2.6 and python. Thank you for your help –  Plonkaa Jun 16 '12 at 16:33
    
i get this a lot bash: /usr/bin/python: No such file or directory –  Plonkaa Jun 16 '12 at 16:40
1  
tried everything and still no luck –  Plonkaa Jun 17 '12 at 3:28

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.