6

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

Wesley
  • 32,320
  • 9
  • 80
  • 116
Michael C
  • 63
  • 4
  • 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: http://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
  • yup. I guess @hyppy is right. reinstall and restore from back up looks to be your only choice. – egorgry Mar 19 '11 at 01:13
  • Doesn't `yum` confirm a remove? – Belmin Fernandez Mar 19 '11 at 04:42
  • 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
  • So the op must of accidentally confirmed it with a keypress? – Belmin Fernandez Mar 19 '11 at 22:50

2 Answers2

11

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.

Scott Pack
  • 14,717
  • 10
  • 51
  • 83
  • 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
3

What can I do?

Restore from backups.

fianchetto
  • 196
  • 3