Rolling back updates and patches, so as a system administrator or system engineer, one of your responsibility
is that you need to update your system or install patches that are vulnerable to the system and keep
your system updated.
So we often run system updates, command youm updates and upgrades to apply those patches to keep the
system updated.
But sometimes what happens is when you do the updates, there are or there could be some compatibility
issues.
Those compatibility issues could occur with your database or your application that you're running.
May be the new updates are not compatible with the application where you are running.
So that time you need to find a way to roll back.
And in this lecture, this is what I'm going to cover, how we could get into that problem and how we
could fix it.
Now, first thing first is if you are using a virtual machine, which I think you are, most likely
you are, and most of the corporate environment platform is now run on virtual machine.
So the best thing and the best practice to have a virtual machine and do the updates is that you create
a virtual machine snapshot before you apply any updates or patches or or download any packages from
from the repositories or even third party vendors.
So if you have a virtual machine, what do you need to do?
You create as you take a snapshot of the existing machine and if something goes wrong, you could always
report back.
So that's the best option you have if you are running a virtual machine.
Now, if you are running a physical machine, then of course, you do not have the option to create
a snapshot and you are out of luck most of the time.
And developers are testing their code.
They also rely heavily on snapshots.
And of course, snapshots happen on virtual machines, not in physical machine.
So now coming down to physical machine, if you have a physical machine, then you're going to have
that problem to not revert back to anything, then what do you do?
Well, roll back a package or patch is that you first install Jum, install a package name.
That's how you install a new package and then you can run Jume history undo, followed by the ID of
that package name that was installed.
So this is mostly you will do when you have a physical machine.
So you run a rollback on update, meaning when you want to roll back an update instead of just a package.
So there is one package, let's say A.P. package.
You install that package, but you want to remove that package or you updated that package, but now
you want to downgrade that update.
That is very easy to do it on one specific package or one specific patch.
But now when you are talking about rolling back an update, this is a huge thing because update could
include hundreds to thousand updates to your packages that you have installed.
So based on the recommendation, this is exactly the entire recommendation from RedHat or sent to us
on many Linux flavors, and that is downgrading a system to a minor version.
When you do the update, for example, rels seven one two seven oh, it is not recommended at all as
this might leave the system in undesired or unstable state.
So if you want to read that statement again, please read it again, that doing the downgrade from seven
point one or five seven five to an older version, definitely not recommended.
You could do the downgrade if you have a washing machine.
If you have taken a snapshot, then you could definitely go back and report back to the older snapshot.
That is perfectly fine.
But if you have already updated your system and your system has an updated version, then please, I
would definitely recommend it.
Do not touch it.
And at that point, I would say just go ahead and install fresh to the version that you want to have
a compatible with your application.
So if you still decide to roll back an update or an upgrade, then here are a step.
Now, there are two things that you also have to keep in mind right here.
One is two.
There are two type of.
System update you have you could do one is actually update and one is the upgrade, you could do update
what exactly this command do, this command actually update and will preserve the old updates, whereas
upgrade upgrade will delete obsolete packages.
So when you run them update, it will keep the older packages with the system is not going to remove
them.
When you run upgrade, you will upgrade to the newer version and it will actually remove old packages.
So then when if you have already ran the upgrade, then most likely you're now going to have the option
to roll back at all at this point.
So let's see if you have done the update.
Great.
Now, what's the next step?
Next step is you will do the same thing as if you were doing this for one specific package is that you
run some history space, undo space, the ID of that specific task that you did and that specific task
is youm update.
And it will actually remove all those updates that it has applied and it will report back to the old
version.
And of course, hopefully this works, but there is no guarantee that it will actually be or leave the
system in the stable condition.
Anyway, good luck with that.
But let's try on a Linux machine how we could go and roll back a patch or package and how we could roll
back and update.
So before you start doing any downloads or updates or upgrades to your system, I would recommend you
take a snapshot of your Warshel machine if you are using a special machine.
My virtual environment is running on Oracle Virtual Box platform.
So what I'm going to do is this is my machine that is running.
So I'm going to take a snapshot by clicking here and I'm going to name the snapshot most of the time.
I name the date when it was taken and I click, OK, this is going to take the exact same snapshot at
the exact same the state of the machine that it is right now.
So if I wanted to change anything after words from this point on, I could always come back to this
state by clicking here and go to revert to snapshot to this one.
So now I have taken a snapshot.
Now let's move on to doing our package install and let's move on to doing the R.G. update or upgrade
whatever that we have to do.
So let me log in to my Linux machine.
Had the links machine right here.
And I will go over each of this command to show you how you could roll back and a package or patch or
you could roll back an entire update.
So I logged in as root.
And I am going to install a package as an example in my Linux machine.
And that package I will use a screen.
A screen is just a package that allows you to record session or do certain functions on while you are
putting in to your machine anyway.
So when we run this command, you install screen, it will go online and check for any dependency upon
the package.
And it says the total download size is five five two K install sizes nine one K.
Is this OK?
You want to go and install it?
Yes, I want to go ahead, install it.
All right.
It's going in to it's actually going to the repository, checking if there are any dependencies.
OK, so it is installed so I could verify if it has installed by running command R.P.M. minus Kuai and
grep for screen.
And it came up with the exactly the the package that it has installed, this is the one.
OK, so now now we we have downloaded the package perfect.
But now we wanted to downgrade or remove that package or if the package already exists, then, of course,
downgrade because it doesn't it isn't compatible with the application that we're running.
So at this point, I will run AJAM History Command and this command will tell me that the latest one,
the command that I ran, is right here as I ran at this time at this date, and I had used to install
and it altered one package.
So the ID is 17.
So if I were to downgrade or remove it, I would do some history, undo and process sorry, the, the
id that the task id so hit enter and it's saying that it's going to remove this package screen, remove
one package and then you go ahead and hit.
Yes.
And now it is completed.
Now you could go ahead and r.p.m. minus keyway and grep for screen to see if it's still there.
It is not there, it has a gene on screen which is not exactly one that I'm looking for anyway.
So if you had an older version of the package, then it would not have removed it.
It would have downgraded it to the older version.
OK, so now this is about a single package or a single patch that you apply.
Now let's talk about when you when you perform an update to your system.
Then, of course, as I said before, this is not recommended.
I wouldn't recommend you guys try that unless you actually have a proper support from RedHat or whichever
the Linux operating system you're using.
OK, so if I'm doing update, so let's run the update.
Youm update, as I said, always use youm update instead of upgrade because upgrade will remove the
obsolete packages or delete off packages the older packages.
So you cannot roll back anymore.
So let's do some update.
Hit enter.
This is going to get a list of everything that needs to be updated, I have a total updates and needs
to be updated as 159 packages.
The size is there.
Is it OK?
Yes.
Go ahead and install.
So I hit why?
And it is going through the entire list of packages.
There needs to be updated.
Now, at this point, I am going to fast forward this because this might take a little longer, depending
on your system and depending on your Ethernet or Internet speed.
OK, so the updates have been completed, we could verified by running Jume history and Lyster all,
but for now, just put your history and you'll see right up there on the top that number 19, the task
19 is to install or update and test the date.
And at the time that was done.
Now, if you want to undo anything like that, I would recommend you that you take a snapshot of your
virtual machine if you are running a virtual machine, if you are not, then of course, then you will
have to have a support from any enterprise level support in the Linux platform you're running.
OK, so as we have this list or the history of our Jume command, we noticed that the number 19 is the
one that we wanted to undo.
So we will do the same command as if you are doing to undo a package youm history undo.
And the task number is number 19.
So let's run 19 here.
OK, we are getting that downgrades of total packages of one hundred fifty nine.
You could go ahead and hit why it will downgrade and remove any packages that were installed there.
But I'm not going to do that.
But if you really have to do because of the compatibility issue, go ahead and hit.
Why?
And it will go through the entire process of downgrading or removing and clean up a process.
So if you run into issue the good things that you do have, um, you do have the snapshot.
So you could always revert to that snapshot that you take and if things go wrong, so that's how you
do the roll back.
I hope this lecture serves as purpose.
If you have any question, please send me a message and good luck.