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.

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
1  
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
add comment

1 Answer

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
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.