Reinstall packages from a specific repository

Latest response

Today, I looked on one of my hosts to see if there are any packages installed that are not from 'rhel-7-server-rpms' or 'anaconda'. And surprise, there are for of them:

# yum list installed | grep -v "rhel-7-server-rpms\|anaconda"
Loaded plugins: product-id, search-disabled-repos, subscription-manager
Installed Packages
NetworkManager-config-server.x86_64
Red_Hat_Enterprise_Linux-Release_Notes-7-en-US.noarch
libdnet.x86_64                   1.12-13.1.el7               @rhel-7-server-eus-rpms
libicu.x86_64                    50.1.2-15.el7               @rhel-7-server-eus-rpms
libmspack.x86_64                 0.5-0.4.alpha.el7           @rhel-7-server-eus-rpms
net-tools.x86_64                 2.0-0.17.20131004git.el7    @rhel-7-server-eus-rpms
sed.x86_64                       4.2.2-5.el7.sjis.1          @rhel-sjis-for-rhel-7-server-eus-rpms
# yum repolist enabled
Loaded plugins: product-id, search-disabled-repos, subscription-manager
repo id                                                                                      repo name                                                                                            status
rhel-7-server-rpms/7Server/x86_64                                                            Red Hat Enterprise Linux 7 Server (RPMs)                                                             14,280
repolist: 14,280

I would like to use packages from 'rhel-7-server-rpms' only. Is it a problem that there are packages from other repos installed that are not available anymore?

If there is an update for one of these packages available in 'rhel-7-server-rpms', will the packages from 'rhel-7-server-eus-rpms' or 'rhel-sjis-for-rhel-7-server-eus-rpms' be updated automatically? Is there any way to reinstall these packages from 'rhel-7-server-rpms'? The reinstall subcommand exits with an error:

# yum reinstall sed
Loaded plugins: product-id, search-disabled-repos, subscription-manager
rhel-7-server-rpms                                                                                                                                                               | 3.5 kB  00:00:00
Installed package sed-4.2.2-5.el7.sjis.1.x86_64 (from rhel-sjis-for-rhel-7-server-eus-rpms) not available.
Error: Nothing to do

Thanks in advance for your thoughts and advice.

Regards,
Joerg

Responses

The eus packages are apparently from Extended Update Support repositories: if it's important to keep your systems stay as RHEL 7.1 or 7.2 systems rather than automatically getting updated to 7.3 and above, then you might have a reason to use the EUS repositories, as they include backported bug fixes but no enhancements nor new features. Access to them requires either a premium RedHat subscription or an add-on subscription, so it can be an extra cost item.

The sjis packages, on the other hand, are related to Shift-JIS character set support. You only need them if you are processing text using the Japanese Shift-JIS character set.

Apparently some RedHat SKUs include access to the sjis repositories, and they may have been erroneously auto-activated at some point:

https://access.redhat.com/solutions/2768371

You also seem to have the "search-disabled-repos" Yum plugin, which seems to have some pitfalls according to the System Administrators Guide. You might want to disable it, or edit the /etc/yum/pluginconf.d/search-disabled-repos.conf configuration file to ignore the eus and sjis repositories entirely.

Hi Jörg,

If you want to use packages from rhel-7-server-rpms only, this is the way you will have to reinstall the packages.
First remove the currently installed packages : sudo yum remove libdnet libicu libmspack net-tools sed
Then reinstall the wanted package versions : sudo yum install libdnet libicu libmspack net-tools sed
When you use the yum reinstall command it doesn't work - because packages from disabled repos are installed.

Hello Christian,

In case of sed this approach doesn't work. Running yum remove sed starts a dependency resolution which results in the following error:

--> Finished Dependency Resolution
Error: Trying to remove "systemd", which is protected
Error: Trying to remove "yum", which is protected

This host used a developer subscription in the past due to it had access to the repos the mentioned five packages were installed from. But how could I get rid of them, now?

Well, I think I was able to reproduce the issue on another host.

Here, sed-4.2.2-5.el7.x86_64 was installed from 'rhel-7-server-rpms'. So I've run the following commands to reproduce the situation:

# subscription-manager repos --enable=rhel-sjis-for-rhel-7-server-eus-rpms
Repository 'rhel-sjis-for-rhel-7-server-eus-rpms' is enabled for this system.
# yum install sed-4.2.2-5.el7.sjis.1.x86_64
Loaded plugins: langpacks, product-id, search-disabled-repos, subscription-manager
Resolving Dependencies
--> Running transaction check
---> Package sed.x86_64 0:4.2.2-5.el7 will be updated
---> Package sed.x86_64 0:4.2.2-5.el7.sjis.1 will be an update
--> Finished Dependency Resolution

Dependencies Resolved

===============================================================================================================================================================
 Package                  Arch                        Version                                  Repository                                                 Size
===============================================================================================================================================================
Updating:
 sed                      x86_64                      4.2.2-5.el7.sjis.1                       rhel-sjis-for-rhel-7-server-eus-rpms                      232 k

Transaction Summary
===============================================================================================================================================================
Upgrade  1 Package

Total download size: 232 k
Is this ok [y/d/N]: y
Downloading packages:
No Presto metadata available for rhel-sjis-for-rhel-7-server-eus-rpms
sed-4.2.2-5.el7.sjis.1.x86_64.rpm                                                                                                       | 232 kB  00:00:00     
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
  Updating   : sed-4.2.2-5.el7.sjis.1.x86_64                                                                                                               1/2 
  Cleanup    : sed-4.2.2-5.el7.x86_64                                                                                                                      2/2 
rhel-sjis-for-rhel-7-server-eus-rpms/7Server/x86_64/productid                                                                           | 2.2 kB  00:00:00     
  Verifying  : sed-4.2.2-5.el7.sjis.1.x86_64                                                                                                               1/2 
  Verifying  : sed-4.2.2-5.el7.x86_64                                                                                                                      2/2 

Updated:
  sed.x86_64 0:4.2.2-5.el7.sjis.1                                                                                                                              

Complete!
# subscription-manager repos --disable=rhel-sjis-for-rhel-7-server-eus-rpms
Repository 'rhel-sjis-for-rhel-7-server-eus-rpms' is disabled for this system.

And here comes the reproduced issue which seems to be the same from my initial post:

# yum reinstall sed
Loaded plugins: langpacks, product-id, search-disabled-repos, subscription-manager
rhel-7-server-optional-rpms                                                                                                             | 3.5 kB  00:00:00     
rhel-7-server-rpms                                                                                                                      | 3.5 kB  00:00:00     
rhel-server-rhscl-7-rpms                                                                                                                | 3.5 kB  00:00:00     
Installed package sed-4.2.2-5.el7.sjis.1.x86_64 (from rhel-sjis-for-rhel-7-server-eus-rpms) not available.
Error: Nothing to do

Because sed.x86_64 0:4.2.2-5.el7.sjis.1 was an update to sed.x86_64 0:4.2.2-5.el7 it comes to mind to try a downgrade of the package sed.x86_64 0:4.2.2-5.el7.sjis.1:

# yum downgrade sed-4.2.2-5.el7.x86_64
Loaded plugins: langpacks, product-id, search-disabled-repos, subscription-manager
Resolving Dependencies
--> Running transaction check
---> Package sed.x86_64 0:4.2.2-5.el7 will be a downgrade
---> Package sed.x86_64 0:4.2.2-5.el7.sjis.1 will be erased
--> Finished Dependency Resolution

Dependencies Resolved

===============================================================================================================================================================
 Package                        Arch                              Version                                  Repository                                     Size
===============================================================================================================================================================
Downgrading:
 sed                            x86_64                            4.2.2-5.el7                              rhel-7-server-rpms                            231 k

Transaction Summary
===============================================================================================================================================================
Downgrade  1 Package

Total download size: 231 k
Is this ok [y/d/N]: y
Downloading packages:
sed-4.2.2-5.el7.x86_64.rpm                                                                                                              | 231 kB  00:00:00     
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
  Installing : sed-4.2.2-5.el7.x86_64                                                                                                                      1/2 
  Cleanup    : sed-4.2.2-5.el7.sjis.1.x86_64                                                                                                               2/2 
  Verifying  : sed-4.2.2-5.el7.x86_64                                                                                                                      1/2 
  Verifying  : sed-4.2.2-5.el7.sjis.1.x86_64                                                                                                               2/2 

Removed:
  sed.x86_64 0:4.2.2-5.el7.sjis.1                                                                                                                              

Installed:
  sed.x86_64 0:4.2.2-5.el7                                                                                                                                     

Complete!
# yum list installed | grep sed
sed.x86_64                           4.2.2-5.el7             @rhel-7-server-rpms

And the issue seems to be solved. Fixing the first system will be the first thing in the morning. I will come back to you to tell you if it worked.

Ciao, Joerg

Ok, today I was able to clean up the mess as describted above. The packages installed from 'rhel-7-server-eus-rpms' were reinstalled with the yum reinstall PACKAGENAME command.

Now I have all packages installed from repos which are being covered by my subscriptions.

Cool Jörg, well done ! :) That was a good idea to cancel the removal action after you got the warning that systemd and yum would be removed as a dependency and to check the downgrade option. I'm glad that you could achieve what you wanted !