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 accidentally ran rm -rf /* on my Ubuntu 10.10 and canceled the command quickly then. Although I was not sudo but a lot of my files were deleted. The system has become less responsive and I am not sure how to fix it. For instance, I reinstalled firefox and it solved many firefox issues but right click is very sluggish. Deluge keeps on pulling up CPU usage (1 core) to 100%. Shutter is also a bit weird in terms of responsiveness.

Is there anything I could do to repair everything? Like reinstalling every installed package and Ubuntu files.

share|improve this question
4  
I would suggest making a backup and a fresh install :S –  shroff Jan 23 '11 at 15:07
3  
How do you even accidentally run such a command? –  Ward Muylaert Jan 23 '11 at 15:12
    
@shroff Thats my last resort! I am trying to avoid it as it would mean GBs of data being downloaded from Dropbox again and not to mention the time it would take to doing a fresh install –  Ashfame Jan 23 '11 at 15:39
    
@Ward I was editing the path and accidentally made it run –  Ashfame Jan 23 '11 at 15:40
1  
@Alin Andrei rm -rf /* ran fine for me on 10.10 –  Ashfame Mar 20 '11 at 22:51
show 1 more comment

4 Answers 4

I noted : *"Although I was not sudo but a lot of my files were deleted" , you most probably have deleted it only "your settings". create a new user login as him and check if its all OK, it should be.

If this is the scenario you can move your files and not-missing-config-files to the new user folder

share|improve this answer
    
I agree. The command probably deleted files in your /home directory, as /* expands to /bin /boot /dev /etc /file.img /home /initrd.img /initrd.img.old /lib .... –  arrange Jan 23 '11 at 16:00
    
Yes all settings and configurations were gone. I don't understand why would that mess up with even reinstalled firefox and deluge. The whole system lacks speedy responsiveness, like it was before this incident. –  Ashfame Jan 23 '11 at 16:59
    
@arrange my files deep under several directories in my home were deleted too n I don't recall if I had the -r switch –  Ashfame Jan 23 '11 at 17:00
add comment

You can use this script to reinstall all your packages, it's a little hackish as I couldn't find the dpkg control mechanism without hacking around in python:

#!/bin/bash

for PACKAGE in `dpkg --get-selections | grep install | awk '{ print $1; }'`; do
  sudo apt-get --reinstall install $PACKAGE
done

Save that to the file reinstall.sh, then execute by running bash reinstall.sh fromt he command line. This will take a while, but it will reinstall everything.

share|improve this answer
    
I can install things again if I am doing a fresh install. They were not too many. I understand your idea though. –  Ashfame Jan 23 '11 at 17:03
add comment
up vote 0 down vote accepted

I fixed the issues by doing a fresh install. Like @d4n13l suggested, my system hot a hit in responsiveness and more than just my files were gone. And I feel like @Martin approach is something one should go after doing a fresh install for installing previous packages that you had. I had very few of them, so I installed them again from the Ubuntu Software Center. Thanks to everyone for looking into this. :)

Edit: I am not sure of what to do with marking the answer in such a case.

share|improve this answer
    
you can mark your answer as the accepted answer since that's what you ended up doing; however if Martin's answer was useful to you the vote it up! –  Jorge Castro Jan 25 '11 at 3:00
    
ok I have marked my answer as the accepted answer because I ended up doing that. But answers of Martin and hhlp will be more helpful for someone in need. –  Ashfame Jan 25 '11 at 17:49
add comment

you can do a backup of all your package installed, follow this method and then a clean install and then a restore process follow this guide too.

Here’s a simple tutorial on how to backup a list of all your installed repository applications, and restore them to another machine, perhaps even the same machine after a clean installation.  This can save you an incredible amount of time, especially when this task must be repeated often.  First, from a computer with all the applications preinstalled, retrieve your installed package list and redirect the output to a file called packages.txt.  Save this package list somewhere so that you can use it for the restore process.

sudo dpkg --get-selections > packages.txt

To restore all the applications from your list, you must follow a three step process very carefully.

sudo dpkg --clear-selections

sudo dpkg --set-selections < packages.txt

sudo aptitude install

You will be prompted to install all the new applications in the list. Another example of what this process allows you to do is create a baseline of all the applications after a clean installation of Ubuntu.  Let’s say you would like to remove any applications installed since the clean install, perform the exact same process, and any package not defined in that list will be removed.

sudo dpkg --get-selections > clean-install-package-list.txt

sudo dpkg --clear-selections

sudo dpkg --set-selections < clean-install-package-list.txt

sudo aptitude install

The very first command of “–clear-selections” marks all currently installed packages to the state “deinstall”.  When you restore the list of applications using “–set-selections”, only packages ommited from the list will remain in the “deinstall” state.  Aptitude will honor the deinstall state and remove the extra packages, leaving you only with packages from the list.

share|improve this answer
1  
Thats probably what I was looking for. If I understand it correctly, then --clear-selections mark that packages are not needed and should be removed but then we imort our package list, so almost the same configuration we had when we export the list is to marked to be installed. Some packages are already there (which were marked earlier for removal are now again marked for need to have them) and then sudo aptitude install finally do what is pending i.e. what new packages are needed. Right? –  Ashfame Jan 24 '11 at 22:24
add comment

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.