How to undo accidental yum update from command line

actived

Well-Known Member
Mar 30, 2012
51
0
56
cPanel Access Level
Website Owner
Hi,

well, duh, I accidentally copy-pasted a few yum commands that were supposed to run on my local centos machine, into an open root console on our cpanel server. (Stuff happens, as they say :( )

The resulting chaos, it seems, is limited to me having done the following:

1. added a repo to /etc/yum.repos.d/

2. yum update -y

3. resulting installation of following packages:
* yum-utils
* kernel-xen.x86_64 2.6.18-308.13.1.el5

4. Luckily, I havent installed anything from the new repo, so I guess I can safely delete the repo file. Is that right?

Current config (before this event):
WHM 11.32.3 (build 23) , RELEASE build
CENTOS 5.8 x86_64 xenpv on server2
kernel-xen.x86_64 already had 2.6.18-308.el5, 2.6.18-308.1.1.el5, 2.6.18-308.4.1.el5

Do I need to rollback the latest version (from 'updates' repo) of kernel-xen 2.6.18-308.13.1.el5 ?

Thanks in advance!
Dave
 

actived

Well-Known Member
Mar 30, 2012
51
0
56
cPanel Access Level
Website Owner
Thanks for the reply!

Well actually, I'd like to get something clarified before doing something drastic:
1.
Do I really need to uninstall the 308.13.1.el5 version considering that I already have 308.el5, 308.1.1.el5, 308.4.1.el5 as part of standard automatic updates?

2.
If I do have to uninstall it, isnt it a single instruction to uninstall that package?
What I didnt get is this:
You could grab the old version of the rpm from a repro and RPM them into place. You might have to use the --force a lot too.
Why would I need to get an old version of the rpm - I probably will have to just tell it to use the older version - 308.4.1 - that too if it doesnt pick it up automatically after I uninstall 308.13.1, no?

Since 4.1 is already installed.

I didnt get the --force part or the part where I would have to install an rpm...

A bit confused, to be honest.

Thanks in advance!
 

cPanelTristan

Quality Assurance Analyst
Staff member
Oct 2, 2010
7,607
38
248
somewhere over the rainbow
cPanel Access Level
Root Administrator
You haven't booted into the new kernel right? If that's the case, then simply remove the new kernel and ensure to pick --nodeps when removing it, and ensure that /boot contains the current kernel you are using.

If you did boot into the new kernel, you'll have to reboot into an old kernel (change /etc/grub.conf to boot into 2 or whatever isn't the new kernel), then revise /etc/grub.conf and remove the new kernel.
 

actived

Well-Known Member
Mar 30, 2012
51
0
56
cPanel Access Level
Website Owner
[solved] Re: How to undo accidental yum update from command line

No, I hadn't booted into the new kernel :)
So it was a simple uninstall command to remove it:
Code:
rpm -e --nodeps kernel-xen-2.6.18-308.13.1.el5
I've only ever used ubuntu until recently, so I thought it better to ask before doing something drastic on a production CentOS server - I wouldnt have thought of "--nodeps" myself.
So thanks a ton!
CPanel is a nice system, although for obvious stability reasons, a bit too restrictive for experimenting - but then the uptime for our server is currently 82 days without a reboot :)
Thanks for that too!
 
Last edited: