Why yum update fails with "Plugins can't be imported" error ?
Environment
- Red Hat Enterprise Linux 5.7 and onwards
- Red Hat Subscription Management (RHSM)
Issue
- yum update fails with the following error :-
# yum update
Plugin "product-id" can't be imported
Plugin "subscription-manager" can't be imported
Unable to find Subscription Manager module.
Error: cannot import name init_dep_injection
Resolution
- Install missing
m2cryptopackage on system and upgradedyum-rhn-pluginpackage on affected system. - Re install
yumandsubscription-managerpackage. - Remove all the duplicate packages (if present) as mentioned in the
Diagnostic Steps.
Root Cause
- Red Hat supplied
m2cryptopackage missing on system which caused this error. - Presense of duplicate packages on the system.
- Subscription manager-related files are modified.
Diagnostic Steps
- Collect following details from affected system:
$ strace -fxvto /tmp/strace.out yum update
- Check whether there are any files listed as modified or missing in the output of the following command:
# rpm -V yum subscription-manager
- If so, then download the
yumandsubscription-managerpackages from RHN and reinstall them manually :
# rpm --replacepkgs -vh yum-x.x.x.y.y.noarch.rpm subscription-manager-x.x.yy-x.x.x.rpm
- Run the following command to scan the rpm database for any other duplicates as well:
# package-cleanup --dupes
- If the output looks correct, then remove the old versions of these duplicates with:
# package-cleanup --cleandupes
This solution is part of Red Hat’s fast-track publication program, providing a huge library of solutions that Red Hat engineers have created while supporting our customers. To give you the knowledge you need the instant it becomes available, these articles may be presented in a raw and unedited form.
Welcome! Check out the Getting Started with Red Hat page for quick tours and guides for common tasks.
