Skip to content

doas on Alpine 3.21 fails with "a tty is required" #9977

@Spiffyk

Description

@Spiffyk

Summary

When I try to use Ansible with an Alpine 3.21 machine (installed with setup-alpine, which installs doas by default), I get doas: a tty is required in stderr.

use_tty is set to the default true value, and even if I reset it to true explicitly, this still happens.

Issue Type

Bug Report

Component Name

doas

Ansible Version

$ ansible --version
ansible [core 2.18.4]
  config file = None
  configured module search path = ['/home/spiffyk/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /usr/lib/python3.13/site-packages/ansible
  ansible collection location = /home/spiffyk/.ansible/collections:/usr/share/ansible/collections
  executable location = /usr/bin/ansible
  python version = 3.13.2 (main, Feb  5 2025, 08:05:21) [GCC 14.2.1 20250128] (/usr/bin/python)
  jinja version = 3.1.5
  libyaml = True

Community.general Version

$ ansible-galaxy collection list community.general

# /usr/lib/python3.13/site-packages/ansible_collections
Collection        Version
----------------- -------
community.general 10.5.0 

Configuration

$ ansible-config dump --only-changed

ANSIBLE_NOCOWS(/home/spiffyk/Projects/<project>/ansible.cfg) = True
ANSIBLE_PIPELINING(/home/spiffyk/Projects/<project>/ansible.cfg) = True
CONFIG_FILE() = /home/spiffyk/Projects/<project>/ansible.cfg
DEFAULT_HOST_LIST(/home/spiffyk/Projects/<project>/ansible.cfg) = ['/home/spiffyk/Projects/<project>/inventory.yaml']
EDITOR(env: EDITOR) = helix
INTERPRETER_PYTHON(/home/spiffyk/Projects/<project>/ansible.cfg) = /usr/bin/python3

GALAXY_SERVERS:

OS / Environment

On my machine: Arch Linux
The other machine: Alpine Linux 3.21

Steps to Reproduce

Any playbook with become: true and become_method: community.general.doas paired with an Alpine 3.21 remote with doas will immediately fail during Gathering Facts.

Expected Results

I expected doas to change the user to root properly.

Actual Results

fatal: [ci-test01]: FAILED! => 
    ansible_facts: {}
    changed: false
    failed_modules:
        ansible.legacy.setup:
            failed: true
            module_stderr: |-
                doas: a tty is required
            module_stdout: ''
            msg: |-
                MODULE FAILURE: No start of json char found
                See stdout/stderr for the exact error
            rc: 1
    msg: |-
        The following modules failed to execute: ansible.legacy.setup

Code of Conduct

  • I agree to follow the Ansible Code of Conduct

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugThis issue/PR relates to a bughas_prmodulemodulepluginsplugin (any type)

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions