Skip to content

Support Termux in ansible.builtin.package#81547

Open
cilki wants to merge 1 commit intoansible:develfrom
cilki:termux_pkg_mgr_apt
Open

Support Termux in ansible.builtin.package#81547
cilki wants to merge 1 commit intoansible:develfrom
cilki:termux_pkg_mgr_apt

Conversation

@cilki
Copy link

@cilki cilki commented Aug 20, 2023

SUMMARY

This enables usage of ansible.builtin.package instead of ansible.builtin.apt in Termux environments (Android). Tested on Pixel Fold and Pixel 6.

ISSUE TYPE
  • Feature Pull Request
ADDITIONAL INFORMATION

Example playbook:

- hosts: example
  tasks:
    - name: Install packages
      ansible.builtin.package:
        update_cache: yes
        name:
          - gitui

Fails because it can't find apt:

TASK [Install packages] 
An exception occurred during task execution. To see the full traceback, use -vvv. The error was: NoneType: None
fatal: [example]: FAILED! => {"changed": false, "msg": "Could not find a module for unknown."}

Fixed after adding the right path:

TASK [Install packages] 
changed: [example]

@ansibot ansibot added feature This issue/PR relates to a feature request. needs_triage Needs a first human triage before being processed. needs_revision This PR fails CI tests or a maintainer has requested a review/revision of the PR. and removed needs_revision This PR fails CI tests or a maintainer has requested a review/revision of the PR. labels Aug 20, 2023
{'path': '/usr/sbin/sorcery', 'name': 'sorcery'},
{'path': '/usr/bin/installp', 'name': 'installp'},
{'path': '/QOpenSys/pkgs/bin/yum', 'name': 'yum'},
{'path': '/data/data/com.termux/files/usr/bin/apt', 'name': 'apt'},
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you know if this path is reliable, or depends on the configuration of the Android device?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I know you can move, or explicitly install apps onto other disks, such as an extra SD card. So would that make the path different, or is this some how a chrooted path inside the app that always exists?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

According to their wiki, https://github.com/termux/termux-packages/wiki/Termux-file-system-layout, it seems to be a stable path. Termux exports a ${PREFIX} variable, but it's not configurable according to this:

The root file system and user home directory are located in a private application data directory which lives on the /data partition. Paths to these directories are exposed as $PREFIX and $HOME respectively.

You cannot move $PREFIX to another location because all programs expect that $PREFIX will not be changed. Additionally, you cannot have binaries, symlinks and other files from $PREFIX on sdcard because that file system does not support unix permissions, symlinks, sockets, etc...

As an aside, thanks for all of the work on Ansible. This tool has changed my life 👍 !

Copy link
Contributor

@s-hertel s-hertel left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This will need a changelog.

@s-hertel s-hertel removed the needs_triage Needs a first human triage before being processed. label Aug 22, 2023
@ansibot ansibot added the needs_revision This PR fails CI tests or a maintainer has requested a review/revision of the PR. label Aug 22, 2023
@cilki
Copy link
Author

cilki commented Aug 23, 2023

This will need a changelog.

Let me know if I did that changelog wrong. Thanks

@ansibot ansibot added stale_review Updates were made after the last review and the last review is more than 7 days old. and removed needs_revision This PR fails CI tests or a maintainer has requested a review/revision of the PR. labels Aug 23, 2023
@ansibot ansibot added the stale_ci This PR has been tested by CI more than one week ago. Close and re-open this PR to get it retested. label Sep 7, 2023
@ansibot ansibot added the needs_rebase https://docs.ansible.com/ansible/devel/dev_guide/developing_rebasing.html label Jan 30, 2024
@ansibot ansibot added the stale_pr This PR has not been pushed to for more than one year. label Jan 28, 2025
@Akasurde
Copy link
Member

@cilki Could you please rebase this branch? Thanks,

@Akasurde Akasurde added the needs_info This issue requires further information. Please answer any outstanding questions. label Feb 19, 2026
@cilki cilki force-pushed the termux_pkg_mgr_apt branch from 7b79357 to 9e3d7e2 Compare February 22, 2026 20:55
@ansibot ansibot removed needs_rebase https://docs.ansible.com/ansible/devel/dev_guide/developing_rebasing.html stale_pr This PR has not been pushed to for more than one year. labels Feb 22, 2026
This enables usage of `ansible.builtin.package` instead of `ansible.builtin.apt`
in Termux environments (Android). Tested on Pixel Fold and Pixel 6.
@cilki cilki force-pushed the termux_pkg_mgr_apt branch from 9e3d7e2 to 956c158 Compare February 22, 2026 20:58
@cilki
Copy link
Author

cilki commented Feb 22, 2026

@Akasurde rebased.

@ansibot ansibot removed needs_info This issue requires further information. Please answer any outstanding questions. stale_ci This PR has been tested by CI more than one week ago. Close and re-open this PR to get it retested. labels Feb 22, 2026
@ansibot ansibot added the stale_ci This PR has been tested by CI more than one week ago. Close and re-open this PR to get it retested. label Mar 8, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

feature This issue/PR relates to a feature request. stale_ci This PR has been tested by CI more than one week ago. Close and re-open this PR to get it retested. stale_review Updates were made after the last review and the last review is more than 7 days old.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants