Lanaru
Lanaru

Reputation: 9721

How do I revert GCC version from 4.8.3 to 4.8.2?

I accidentally updated the GCC version on a machine at work. We work with a very specific setup that requires GCC 4.8.2, so I must revert the GCC update. I'm running on CentOS 7.

Upvotes: 1

Views: 3091

Answers (2)

Lanaru
Lanaru

Reputation: 9721

After many hours of experimentation, this is the solution that I found:

The solution is to install gcc-4.8.2 from a .rpm file. Luckily, it looks like yum caches previous rpm files.

I went to /var/cache/yum/x86_64/7/updates/packages and I found a bunch of .rpm packages, including the gcc-4.8.2 rpm file!

I tried to run sudo yum localinstall gcc-4.8.2-16.2.el7_0.x86_64.rpm, however it said that some of its dependencies were the wrong version.

To fix this, I called sudo yum remove on the problematic dependencies, namely libgomp and cpp. I then called sudo yum localinstall for both of the packages, using their 4.8.2 .rpm files that were in the yum cache directory.

I then ran sudo yum localinstall gcc-4.8.2-16.2.el7_0.x86_64.rpm again, and it was successful!

Upvotes: 1

gomons
gomons

Reputation: 1976

Print yum history and find unnecessary update:

yum history

It prints something like:

ID     | Login user               | Date and time    | Action(s)      | Altered
-------------------------------------------------------------------------------
     8 | root <root>              | 2011-10-03 14:40 | Install        |    1   
     7 | root <root>              | 2011-09-21 04:24 | Install        |    1 ##
     6 | root <root>              | 2011-09-21 04:23 | Install        |    1 ##
     5 | root <root>              | 2011-09-16 13:35 | Install        |    1   
     4 | root <root>              | 2011-09-16 13:33 | Erase          |    1   
     3 | root <root>              | 2011-09-14 14:36 | Install        |    1   
     2 | root <root>              | 2011-09-12 15:48 | I, U           |   80   
     1 | System <unset>           | 2011-09-12 14:57 | Install        | 1025 

Than undo it:

yum history undo 8

Undo command can fail if old packages are not in repo anymore, so you can try to include archive repo.

Upvotes: 3

Related Questions