Open Source Development

 View Only

 DNF or YUM isn't working on server

Jump to  Best Answer
  • AIX Open Source
Security Team's profile image
Security Team posted Tue January 21, 2025 06:40 AM

Getting below error while running dnf or yum

(root@hostname)[/]: /opt/freeware/bin/dnf
Traceback (most recent call last):
File "/opt/freeware/bin/dnf", line 57, in <module>
from dnf.cli import main
File "/opt/freeware/lib/python3.9/site-packages/dnf/__init__.py", line 32, in <module>
import dnf.base
File "/opt/freeware/lib/python3.9/site-packages/dnf/base.py", line 31, in <module>
from dnf.comps import CompsQuery
File "/opt/freeware/lib/python3.9/site-packages/dnf/comps.py", line 36, in <module>
import libcomps
File "/opt/freeware/lib/python3.9/site-packages/libcomps/__init__.py", line 1, in <module>
from ._libpycomps import *
ImportError: 0509-022 Cannot load module /opt/freeware/lib/python3.9/site-packages/libcomps/_libpycomps.so.
0509-150 Dependent module /usr/app/oracle/OCI/lib/libexpat.a(libexpat.so.1) could not be loaded.
0509-152 Member libexpat.so.1 is not found in archive
0509-022 Cannot load module /opt/freeware/lib/python3.9/site-packages/libcomps/_libpycomps.so.
0509-150 Dependent module /opt/freeware/lib/python3.9/site-packages/libcomps/_libpycomps.so could not be loaded.
(root@hostname)[/]: yum
Traceback (most recent call last):
File "/opt/freeware/bin/yum", line 57, in <module>
from dnf.cli import main
File "/opt/freeware/lib/python3.9/site-packages/dnf/__init__.py", line 32, in <module>
import dnf.base
File "/opt/freeware/lib/python3.9/site-packages/dnf/base.py", line 31, in <module>
from dnf.comps import CompsQuery
File "/opt/freeware/lib/python3.9/site-packages/dnf/comps.py", line 36, in <module>
import libcomps
File "/opt/freeware/lib/python3.9/site-packages/libcomps/__init__.py", line 1, in <module>
from ._libpycomps import *
ImportError: 0509-022 Cannot load module /opt/freeware/lib/python3.9/site-packages/libcomps/_libpycomps.so.
0509-150 Dependent module /usr/app/oracle/OCI/lib/libexpat.a(libexpat.so.1) could not be loaded.
0509-152 Member libexpat.so.1 is not found in archive
0509-022 Cannot load module /opt/freeware/lib/python3.9/site-packages/libcomps/_libpycomps.so.
0509-150 Dependent module /opt/freeware/lib/python3.9/site-packages/libcomps/_libpycomps.so could not be loaded.
(root@hostname)[/]:


#AIXOpenSource
Ayappan P's profile image
Ayappan P  Best Answer

I think you have LIBPATH exported to "/usr/app/oracle/OCI/lib" which has a custom expat library "libexpat.a" which don't have the required shared object member for the Toolbox packages to work. This is the expected behaviour. You have to either unset the LIBPATH system-wide or invoke  LIBPATH="" /opt/freeware/bin/dnf


#AIXOpenSource
Security Team's profile image
Security Team

Issue fixed after applying fix by

(root@hostname)[/]: grep LIBPATH /etc/environment_OLD
LIBPATH=/usr/app/oracle/OCI/lib:/opt/freeware/lib:/usr/lib:/amex/lib
(root@hostname)[/]: grep LIBPATH /etc/environment
LIBPATH=/opt/freeware/lib:/usr/lib:/amex/lib:/opt/freeware/bin/dnf:/opt/freeware/bin/dnf
(root@hostname)[/]: /opt/freeware/bin/dnf update
AIX Toolbox                                                                                                                                  39 MB/s |  12 MB     00:00
Last metadata expiration check: 0:00:10 ago on Tue Jan 21 20:28:36 MST 2025.
Dependencies resolved.
============================================================================================================================================================================
 Package                                      Architecture                       Version                                   Repository                                  Size
============================================================================================================================================================================
Upgrading:
 curl                                         ppc                                8.9.1-1                                   AIX_Toolbox                                2.0 M
 curl-devel                                   ppc                                8.9.1-1                                   AIX_Toolbox                                518 k


#AIXOpenSource
Security Team's profile image
Security Team

Don't forget to logout and login again after updating environment variable.


#AIXOpenSource