Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

What can I do? Even "yum" is not available.

share|improve this question
    
Are you sure you didn't run yum remove pcre * with a space? Did you get a list of what pcre depends on? I suspect something bigger is going on here. Post logs if you can. –  egorgry Mar 18 '11 at 19:23
    
I am afraid I really just ran yum remove pcre* (without a space).. Ok, now I realize there was exactly a list of dependents. So may be I have just removed hundreds of dependents? –  Michael C Mar 18 '11 at 19:30
    
The log is too long to trace, but the end looks like this: img812.imageshack.us/i/sshlog.jpg –  Michael C Mar 18 '11 at 19:34
6  
"yum remove pcre*"... the new "rm -rf /"? –  Hyppy Mar 18 '11 at 20:13
1  
@Nimmy It does ask you (with the default being No), unless you pass the -y command line option. Point of interest, newer versions of yum (only tested with yum-3.2.28) will attempt to prevent you from uninstalling yum with a big scary error unless you pass yet another option. –  Scott Pack Mar 19 '11 at 19:33
show 3 more comments

2 Answers

up vote 11 down vote accepted

You really have two options at this point:

  1. Attempt to Repair
  2. Restore from Backups/Rebuild

Repairing can be a very tricky thing to do. You will first need to pull down the rpms for yum and install them manually, assuming rpm will still work. From there look through your yum log and figure out what all packages to reinstall. It could be very labor intensive, and most likely not worth doing. However, with that disclaimer, this might help you get started. The dependency list for yum consists of:

python-elementtree python python-iniparse python-sqlite python-urlgrabber rpm rpm-python yum-metadata-parser yum

You may need to get the additional packages for those to install, but as I said, this was a starting point. Once you have yum working you need to build out the list of packages that were removed. Since all yum operations are logged, this should actually be fairly easy. By going through /var/log/yum.log looking for the string "Erased:" you can determine what was uninstalled. Try running this command to make things easier:

cat /var/log/yum.log* | awk '/Erased:/ {print $NF}' > removed_packages.txt

Now that you have your package list, you can start building out your re-install list by doing something like:

cat removed_packages.txt | xargs -n 100 yum install

Although, in the end, a fresh install may be the easiest way to go, particularly if you're in a rush.

share|improve this answer
    
Thanks. You have made it very clear. This is a very expensive lesson. Hope no one makes such mistake again. –  Michael C Mar 18 '11 at 20:01
1  
@Michael C You should accept @packs solution. –  egorgry Mar 19 '11 at 1:14
add comment

What can I do?

Restore from backups.

share|improve this answer
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.