yum update experience - the most reliable way

Latest response

I realized that sometimes the yum tool does not offer all new package versions being available for upgrade when running sudo yum update.
So I tried several methods to optimize the upgrade process and thought, it can be a good idea to share the one with the highest success rate.
It is recommended to perform every update and upgrade action from a virtual console by pressing Ctrl+Alt+F3 after booting on login screen.

It turned out that rebuilding the package cache from scratch by executing sudo yum clean all and sudo yum update is an advantage.
Even though it is not necessary ... after successfully upgrading the packages I always reboot the system to restart all processes and services.
The benefit : a perfectly stable running operating system ! I am curious to know if there are alternative ways to achieve the same reliability ?

Responses

The yum package management tool maintains a cache of its metadata to improve response time and reduce network traffic. By default the metadata will expire after 6 hours (see "man yum.conf"). This can result in a situation where a package has been updated in a repository, but yum's metadata refers to an older version of the package.

To update packages, ensuring that the very latest metadata is current, you can use the following command:

yum update --refresh

Your other suggestions are also good, thank you.

Thank you for the useful information, Russell. So, if I understand correctly, yum update --refresh is an excellent equivalent to the clean cache method I am performing. I will try this out with the next update processes coming ! :)

Hi Russell ! :)

I ran sudo yum update --refresh as you suggested, but surprisingly this message was returned from the terminal : Command line error: no such option: --refresh. I tried it on two systems three times, but every time the same.
What is that ? What am I doing wrong ? Am I "too blind to see . . ." ? Did I miss or oversee something important here ?

Christian,

Apologies. I stupidly gave you instructions applicable only to Fedora 23 and later.

For Red Hat Enterprise Linux, I recommend the following command:

sudo yum clean expire-cache && sudo yum update

This is actually two commands, with the && between them. The && syntax is specific to Bash and runs the second command only if the first command returns a non-zero state. In other words, the second command is run only if the first is successful.

The yum clean expire-cache removes yum's record of when metadata was downloaded , so the next time yum is run, it will download the repositories' metadata again. The yum clean all method will achieve the same result, but the yum clean expire-cache method is slightly faster and in almost all cases achieves the same result.

Thanks for your response, Russell ! :) Well explained, I will give this a try and report back the results later. The point that the yum clean expire-cache method is a little bit faster than the yum clean all method makes me curious mostly.

The command yum clean expire-cache is faster because it it just one of the tasks that yum clean can be told to do:

   yum clean expire-cache
   yum clean packages
   yum clean headers
   yum clean metadata
   yum clean dbcache
   yum clean rpmdb
   yum clean plugins

If you read the man page for yum, you will see:

   yum clean all
          Does all of the above.

Thank you for adding these details, Terje ! :) I think that it is more an advantage of saving a bit time in theory, in reality I can't feel a difference compared to the clean all variant, nevertheless, good to know.

Hi Russell ! :)

So I followed your instructions and this time it worked exactly as you said ... though the time it takes is nearly the same.

Close

Welcome! Check out the Getting Started with Red Hat page for quick tours and guides for common tasks.