Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I removed all the packages in CentOS by chance using yum remove mktemp removed almost all the bin packages including rpm and openssh. The terminal that I'm connected is the only one which is the gate for me. If I disconnect I can't do ssh too. Any way to roll it back and get the packages installed.? Please help!!

share|improve this question
This is going to be way harder to fix than it's worth. I'd suggest just recovering from a backup. – David Schwartz Aug 8 '12 at 7:34

How did you manage to do that? I can't reproduce this on CentOS 6; the following error occurs (after several seconds of listing all the packages it's going to remove, which should have been a clue):

Error: Trying to remove "yum", which is protected

Anyway, on with the answer...

If you somehow still have yum on your system, and it somehow still works, you can view the history and undo the most recent transaction:

yum history

will show your most recent transactions, each with a number, and then

yum history undo ###

will undo the transaction listed.

If you don't have a working yum on your system, then you've damaged it beyond reasonable repair and should restore from backup.

share|improve this answer
He removed rpm. There's no way yum can fix things without rpm. – David Schwartz Aug 8 '12 at 7:33
Oh, well, in that case it's "restore from backup" time. Somebody else who reads this in the future may be able to undo their own yum disaster, though. – Michael Hampton Aug 8 '12 at 7:35
Yeah, it's still something worth knowing. Sadly, his case is too badly screwed up. – David Schwartz Aug 8 '12 at 7:36

Your Answer


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.