AIX Open Source

  • 1.  Issues with Ansible DNF module and python3

    Posted Thu October 14, 2021 12:52 PM
    Hello,

    We are in the midst of performing a rollout of migrating our yum client to DNF.
    This is the page we've referred to concerning the migration :

    https://community.ibm.com/community/user/power/communities/community-home/digestviewer/viewthread?GroupId=6211&MessageKey=8c7b2f79-929d-47f2-999e-91e41188fce3&CommunityKey=10c1d831-47ee-4d92-a138-b03f7896f7c9&tab=digestviewer#bm8c7b2f79-929d-47f2-999e-91e41188fce3

    But after switching the package manager client, all Ansible playbooks and roles using either the yum module with a yum4/dnf backend or the dnf module return the following error :

    included: /opt/ansible/roles/shared-install_ips_pkg/tasks/install_dnf_ips_pkg.yml for admin-xt02-lp
    Using module file /opt/freeware/lib/python3.7/site-packages/ansible/modules/packaging/os/dnf.py
    Pipelining is enabled.
    <admin-xt02-lp> ESTABLISH SSH CONNECTION FOR USER: None
    <admin-xt02-lp> SSH: EXEC ssh -C -o ControlMaster=auto -o ControlPersist=yes -o ServerAliveInterval=60 -o ServerAliveCountMax=3 -o StrictHostKeyChecking=no -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o ConnectTimeout=10 -o ControlPath=/home/acom/.ssh/cp-%h-%r-%u-%p admin-xt02-lp '/bin/sh -c '"'"'sudo -H -S -n  -u root /bin/sh -c '"'"'"'"'"'"'"'"'echo BECOME-SUCCESS-cbqfkhqbbabiuosgmwwtltyrehbvgeoi ; /opt/freeware/bin/python3'"'"'"'"'"'"'"'"' && sleep 0'"'"''
    Escalation succeeded
    <admin-xt02-lp> (1, b'\n{"msg": "Could not import the dnf python module using /opt/freeware/bin/python3 (3.7.11 (default, Sep  6 2021, 10:46:05) [GCC 8.3.0]). Please install `python3-dnf` package or ensure you have specified the correct ansible_python_interpreter.", "results": [], "cmd": "dnf install -y python3-dnf", "rc": 255, "stdout": "", "stderr": "Could not load program /opt/freeware/bin/python3_32:\\nrtld: 0712-001 Symbol _GLOBAL__AIXI_libsqlite3_so was referenced\\n      from module python3_32(), but a runtime definition\\n\\t    of the symbol was not found.\\nrtld: 0712-001 Symbol _GLOBAL__AIXD_libsqlite3_so was referenced\\n      from module python3_32(), but a runtime definition\\n\\t    of the symbol was not found.\\n", "failed": true, "exception": "  File \\"/tmp/ansible_ansible.builtin.dnf_payload_f2f2v3p1/ansible_ansible.builtin.dnf_payload.zip/ansible/modules/packaging/os/dnf.py\\", line 523, in _ensure_dnf\\n  File \\"/opt/freeware/lib/python3.7/site-packages/dnf/__init__.py\\", line 32, in <module>\\n    import dnf.base\\n  File \\"/opt/freeware/lib/python3.7/site-packages/dnf/base.py\\", line 29, in <module>\\n    import libdnf.transaction\\n  File \\"/opt/freeware/lib/python3.7/site-packages/libdnf/__init__.py\\", line 3, in <module>\\n    from . import common_types\\n  File \\"/opt/freeware/lib/python3.7/site-packages/libdnf/common_types.py\\", line 13, in <module>\\n    from . import _common_types\\n", "invocation": {"module_args": {"name": ["openldap"], "state": "installed", "update_cache": true, "allow_downgrade": false, "autoremove": false, "bugfix": false, "disable_gpg_check": false, "disable_plugin": [], "disablerepo": [], "download_only": false, "enable_plugin": [], "enablerepo": [], "exclude": [], "installroot": "/", "install_repoquery": true, "install_weak_deps": true, "security": false, "skip_broken": false, "update_only": false, "validate_certs": true, "lock_timeout": 30, "conf_file": null, "disable_excludes": null, "download_dir": null, "list": null, "releasever": null}}}\n', b'')
    <admin-xt02-lp> Failed to connect to the host via ssh:

    TASK [shared-install_ips_pkg : install dnf ips pkg] *****************************************************************************************************************************************************************************************
    task path: /opt/ansible/roles/shared-install_ips_pkg/tasks/install_dnf_ips_pkg.yml:2
    The full traceback is:
      File "/tmp/ansible_ansible.builtin.dnf_payload_f2f2v3p1/ansible_ansible.builtin.dnf_payload.zip/ansible/modules/packaging/os/dnf.py", line 523, in _ensure_dnf
      File "/opt/freeware/lib/python3.7/site-packages/dnf/__init__.py", line 32, in <module>
        import dnf.base
      File "/opt/freeware/lib/python3.7/site-packages/dnf/base.py", line 29, in <module>
        import libdnf.transaction
      File "/opt/freeware/lib/python3.7/site-packages/libdnf/__init__.py", line 3, in <module>
        from . import common_types
      File "/opt/freeware/lib/python3.7/site-packages/libdnf/common_types.py", line 13, in <module>
        from . import _common_types
    fatal: [admin-xt02-lp]: FAILED! => changed=false
      cmd: dnf install -y python3-dnf
      invocation:
        module_args:
          allow_downgrade: false
          autoremove: false
          bugfix: false
          conf_file: null
          disable_excludes: null
          disable_gpg_check: false
          disable_plugin: []
          disablerepo: []
          download_dir: null
          download_only: false
          enable_plugin: []
          enablerepo: []
          exclude: []
          install_repoquery: true
          install_weak_deps: true
          installroot: /
          list: null
          lock_timeout: 30
          name:
          - openldap
          releasever: null
          security: false
          skip_broken: false
          state: installed
          update_cache: true
          update_only: false
          validate_certs: true
      msg: Could not import the dnf python module using /opt/freeware/bin/python3 (3.7.11 (default, Sep  6 2021, 10:46:05) [GCC 8.3.0]). Please install `python3-dnf` package or ensure you have specified the correct ansible_python_interpreter.
      rc: 255
      results: []
      stderr: |-
        Could not load program /opt/freeware/bin/python3_32:
        rtld: 0712-001 Symbol _GLOBAL__AIXI_libsqlite3_so was referenced
              from module python3_32(), but a runtime definition
                    of the symbol was not found.
        rtld: 0712-001 Symbol _GLOBAL__AIXD_libsqlite3_so was referenced
              from module python3_32(), but a runtime definition
                    of the symbol was not found.

      stderr_lines: <omitted>
      stdout: ''
      stdout_lines: <omitted>

    PLAY RECAP **********************************************************************************************************************************************************************************************************************************
    admin-xt02-lp              : ok=4    changed=1    unreachable=0    failed=1    skipped=2    rescued=0    ignored=0

    When looking into this, i've found multiple threads such as this one :

    https://community.ibm.com/community/user/power/communities/community-home/digestviewer/viewthread?GroupId=6211&MID=143335&CommunityKey=10c1d831-47ee-4d92-a138-b03f7896f7c9&tab=digestviewer

    I've tried reinstalling sqlite and bzip2, but the error remains
    This server has been upgraded to 7200-05-03-2136, so not the same level as mentioned in the thread but the problem is the same.
    The package manager works fine outside Ansible.
    Output of lslpp -Lc rpm.rte :

    #Package Name:Fileset:Level:State:PTF Id:Fix State:Type:Description:Destination Dir.:Uninstaller:Message Catalog:Message Set:Message Number:Parent:Automatic:EFIX Locked:Install Path:Build Date
    rpm.rte:rpm.rte:4.15.1.3: : :C: :RPM Package Manager: : : : : : :0:0:/:


    Davy Keppens

    ------------------------------
    Davy Keppens
    ------------------------------


  • 2.  RE: Issues with Ansible DNF module and python3

    Posted Thu October 14, 2021 01:24 PM
    Btw, python3-dnf is installed as part of the Yum->DNF migration

    ------------------------------
    Davy Keppens
    ------------------------------



  • 3.  RE: Issues with Ansible DNF module and python3

    Posted Mon October 18, 2021 02:38 AM
    Hi Davy,

    Were you able to run /opt/freeware/bin/python3_32 in the managed node where it is failing ?
    What is the the managed node output of ls -l /opt/freeware/lib/libsqlite3.so and rpm -qa | grep sqlite ?

    ------------------------------
    SANGAMESH
    ------------------------------



  • 4.  RE: Issues with Ansible DNF module and python3

    Posted Mon October 18, 2021 03:25 AM
    Hi Sangamesh,

    I can run /opt/freeware/bin/python3_32 and even import dnf on the managed node  :

    Python 3.7.11 (default, Sep 6 2021, 11:05:26)
    [GCC 8.3.0] on aix6
    Type "help", "copyright", "credits" or "license" for more information.
    >>> import dnf
    >>>

    But when running ansible :

    TASK [shared-install_ips_pkg : install dnf ips pkg] *****************************************************************************************************************************************************************************************
    fatal: [admin-xt02-lp]: FAILED! => changed=false
    cmd: dnf install -y python3-dnf
    msg: Could not import the dnf python module using /opt/freeware/bin/python3 (3.7.11 (default, Sep 6 2021, 10:46:05) [GCC 8.3.0]). Please install `python3-dnf` package or ensure you have specified the correct ansible_python_interpreter.
    rc: 255
    results: []
    stderr: |-
    Could not load program /opt/freeware/bin/python3_32:
    rtld: 0712-001 Symbol _GLOBAL__AIXI_libsqlite3_so was referenced
    from module python3_32(), but a runtime definition
    of the symbol was not found.
    rtld: 0712-001 Symbol _GLOBAL__AIXD_libsqlite3_so was referenced
    from module python3_32(), but a runtime definition
    of the symbol was not found.
    stderr_lines: <omitted>
    stdout: ''
    stdout_lines: <omitted>

    PLAY RECAP **********************************************************************************************************************************************************************************************************************************
    admin-xt02-lp : ok=4 changed=1 unreachable=0 failed=1 skipped=2 rescued=0 ignored=0

    Output of requested commands :

    root@admin-xt02-lp:~# ls -l /opt/freeware/lib/libsqlite3.so
    -rwxr-xr-x 1 root system 4596463 Apr 23 08:47 /opt/freeware/lib/libsqlite3.so
    root@admin-xt02-lp:~# rpm -qa | grep sqlite
    pysqlite-2.8.3-2.ppc
    sqlite-3.35.5-1.ppc
    root@admin-xt02-lp:~#







    ------------------------------
    Davy Keppens
    ------------------------------



  • 5.  RE: Issues with Ansible DNF module and python3

    Posted Mon October 18, 2021 04:45 AM
    Hello Sangamesh,

    Due to the fact i could import the dnf module manually, i looked into which python interpreter was being used by ansible.
    That was /opt/freeware/bin/python3 which was linked to /opt/freeware/bin/python3_64.
    When i unlink python3 and relink it to python3_32, it works. So there's an issue there with 64bit lib compatibility.

    ------------------------------
    Davy Keppens
    ------------------------------



  • 6.  RE: Issues with Ansible DNF module and python3

    Posted Mon October 18, 2021 01:49 PM
    Hello Sangamesh,

    Are you aware of any actions we can take to make this work with the 64_bit python3 client ? Reverting to 32_bit is fine as a temporary solution but should not be required in my opinion...

    Davy

    ------------------------------
    Davy Keppens
    ------------------------------



  • 7.  RE: Issues with Ansible DNF module and python3

    Posted Fri October 22, 2021 11:28 AM
    Hi Davy, 
    AIX 7.1 and 7.2 has 32bit rpm and its libraries and hence a 32bit dnf module can work.
    That is the reason we need to use 32bit python3. 
    Instead of changing the python3 link in /opt/freeware/bin you should change ansible module to use /opt/freeware/bin/python3_32.

    ------------------------------
    SANKET RATHI
    ------------------------------



  • 8.  RE: Issues with Ansible DNF module and python3

    Posted Wed October 27, 2021 04:01 AM
    Hi Sanket.

    Ok. Thanks. That's pretty clear. One last question. Can we safely run the yum to dnf migration script provided by you

    https://community.ibm.com/community/user/power/blogs/sangamesh-mallayya1/2021/05/28/dnf-is-now-available-on-aix-toolbox?CommunityKey=10c1d831-47ee-4d92-a138-b03f7896f7c9&tab=recentcommunityblogsdashboard

    on our internal yum replica server of AIXToolbox or will this only work correctly on servers that are strictly yum clients ?
    Also, i was surprised to notice that dnf gets sets up using the yum-like repository.d directories and not a directory of it's own. Is this normal ?

    Davy

    ------------------------------
    Davy Keppens
    ------------------------------



  • 9.  RE: Issues with Ansible DNF module and python3

    Posted Wed October 27, 2021 07:16 AM
    Hi Davy,

    Migrate script works if yum3(3.4.3) is installed and dnf history file is not yet created.
    The script is meant to migrate yum history and database to dnf.
    This part we handle it in our dnf install script itself while updating yum3 to yum4(dnf) along with dnf install with "-y" option.
    Still "dnf migrate" can be run separately if both yum3 and dnf is installed in a machine.

    yum-like repository is provided to have compatibility and familiar paths.
    When we move from yum to dnf and repository files present in those path can still be recognised by dnf.

    ------------------------------
    SANGAMESH
    ------------------------------