AIX Open Source

 View Only

 dnf installation from bundle and 'dnf update' fails with 'No module named 'rpm'

Jump to  Best Answer
Douglas Irvine's profile image
Douglas Irvine posted Wed May 14, 2025 11:41 PM

Hi,

I'm trying to install DNF from the ISO or the bundle on AIX 7.2. After running the install_dnf.sh, running 'dnf update' throws:

$ dnf update
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 30, 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 27, in <module>
    from dnf.exceptions import CompsError
  File "/opt/freeware/lib/python3.9/site-packages/dnf/exceptions.py", line 22, in <module>
    import dnf.util
  File "/opt/freeware/lib/python3.9/site-packages/dnf/util.py", line 30, in <module>
    import dnf.callback
  File "/opt/freeware/lib/python3.9/site-packages/dnf/callback.py", line 22, in <module>
    import dnf.yum.rpmtrans
  File "/opt/freeware/lib/python3.9/site-packages/dnf/yum/rpmtrans.py", line 26, in <module>
    import rpm
ModuleNotFoundError: No module named 'rpm'

If I run python3 and try to import rpm it gives the same message:

$ python3
Python 3.9.16 (main, Jun 28 2023, 12:45:03) 
[GCC 8.3.0] on aix
Type "help", "copyright", "credits" or "license" for more information.
>>> import rpm
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ModuleNotFoundError: No module named 'rpm'
>>> 

The updating/installing shows:

Updating / installing...
   1:python3.9-3.9.16-0               ################################# [  3%]
   2:python3-3.9.16-0                 ################################# [  7%]
   3:libzstd-1.4.4-32_1               ################################# [ 10%]
   4:libmodulemd-1.5.2-32_2           ################################# [ 13%]
   5:libsolv-0.7.9-32_3               ################################# [ 17%]
uname: invalid option -- 'W'
Try 'uname --help' for more information.
uname: invalid option -- 'W'
Try 'uname --help' for more information.
uname: invalid option -- 'W'
Try 'uname --help' for more information.
uname: invalid option -- 'W'
Try 'uname --help' for more information.
uname: invalid option -- 'W'
Try 'uname --help' for more information.
uname: invalid option -- 'W'
Try 'uname --help' for more information.
uname: invalid option -- 'W'
Try 'uname --help' for more information.
uname: invalid option -- 'W'
Try 'uname --help' for more information.
uname: invalid option -- 'W'
Try 'uname --help' for more information.
uname: invalid option -- 'W'
Try 'uname --help' for more information.
uname: invalid option -- 'W'
Try 'uname --help' for more information.
uname: invalid option -- 'W'
Try 'uname --help' for more information.
uname: invalid option -- 'W'
Try 'uname --help' for more information.
uname: invalid option -- 'W'
Try 'uname --help' for more information.
uname: invalid option -- 'W'
Try 'uname --help' for more information.
   6:rpm-python3.9-4.15.1-32_2        ################################# [ 20%]
   7:libsmartcols-2.34-32_1           ################################# [ 23%]
   8:zchunk-libs-1.1.4-32_2           ################################# [ 27%]
   9:librepo-1.11.0-32_2              ################################# [ 30%]
  10:libdnf-0.39.1-32_3               ################################# [ 33%]
  11:python3.9-libdnf-0.39.1-32_3     ################################# [ 37%]
  12:python3.9-hawkey-0.39.1-32_3     ################################# [ 40%]
  13:python3.9-gpg-1.13.1-32_3        ################################# [ 43%]
  14:dnf-data-4.2.17-32_5             ################################# [ 47%]
  15:python3.9-librepo-1.11.0-32_2    ################################# [ 50%]

  16:libcomps-0.1.15-32_1             ################################# [ 53%]
  17:python3.9-libcomps-0.1.15-32_1   ################################# [ 57%]
  18:python3.9-dnf-4.2.17-32_5        ################################# [ 60%]
  19:python3-dnf-4.2.17-32_5          ################################# [ 63%]
  20:dnf-4.2.17-32_5                  ################################# [ 67%]
  21:dnf-automatic-4.2.17-32_5        ################################# [ 70%]
  22:yum-4.2.17-32_5                  ################################# [ 73%]
  23:python3-libcomps-0.1.15-32_1     ################################# [ 77%]
  24:python3-librepo-1.11.0-32_2      ################################# [ 80%]
  25:python3-gpg-1.13.1-32_3          ################################# [ 83%]
  26:python3-hawkey-0.39.1-32_3       ################################# [ 87%]
  27:python3-libdnf-0.39.1-32_3       ################################# [ 90%]
  28:rpm-python3-4.15.1-32_2          ################################# [ 93%]
  29:gnupg2-2.2.35-0                  ################################# [ 97%]
  30:ca-certificates-2023.2.60-0      ################################# [100%]

dnf installed successfully. 
Please run 'dnf update' to update packages to the latest level. 

Please note, RPM packages are downloaded in dnf cache /var/cache/dnf.
RPM packages install files go under the path /opt.
Hence it is recommended to always keep at least 512MB of free space in /var & /opt
to avoid any download and installation/update failures.

Python 2  from /opt/freeware/bin also fails importing rpm, but for different  reasons. I think this is irrelevant as it seems dnf uses python 3.

Here's environment info:

$ oslevel
7.2.0.0

$ uname -a
AIX snoopy 2 7 00CFA2A74C00 powerpc AIX

I attached rpm-qa and rpm -Va output.

I'm stumped.

Attachments  View in library
Douglas Irvine's profile image
Douglas Irvine  Best Answer

Wow this turned out to be so simple as to be hard to figure out. So Python 3.9 packages for rpm install a symlink to the /opt/rpm tree.

[26346020]dirvine@snoopy:/opt/freeware/lib/python3.9/site-packages>
$ ls -ltr rpm
lrwxrwxrwx    1 root     system           59 May 15 15:57 rpm -> ../../../../..//usr/opt/rpm/lib/python3.9/site-packages/rpm

and there is stuff there installed by the rpm.rte:

$ ls -l /usr/opt/rpm/lib/python3.9/site-packages/rpm
total 632
-rw-r--r--    1 root     system         3070 Mar 06 2023  __init__.py
-rwxr-xr-x    1 root     system         1070 Mar 06 2023  _rpm.la
-rwxr-xr-x    1 root     system       306082 Mar 06 2023  _rpm.so
-rw-r--r--    1 root     system         5861 Mar 06 2023  transaction.py

But the sym link was bad - even though it looks odd using a relative path it looks ok...but it's not!

$ cd  /opt/freeware/lib/python3.9/site-packages/rpm
ksh: /opt/freeware/lib/python3.9/site-packages/rpm:  not found.

Removing and creating the sym link fixed our issue. dnf runs fine now.

SANGAMESH MALLAYYA's profile image
SANGAMESH MALLAYYA

Hi Douglas,

Can you please let me know the output echo $PATH.

I guess some coreutils uname is used instead of /usr/bin/uname during the install.

Also, we need to use 32-bit python when we try to import rpm module.

# /opt/freeware/libexec/python3.9_32 -c 'import rpm'

(0) : /