Skip to content

fix: correct sudo-rs detection and centralize Ansible workaround#68

Open
salverius-tech wants to merge 1 commit intomainfrom
fix/sudo-rs-ansible-compatibility
Open

fix: correct sudo-rs detection and centralize Ansible workaround#68
salverius-tech wants to merge 1 commit intomainfrom
fix/sudo-rs-ansible-compatibility

Conversation

@salverius-tech
Copy link
Copy Markdown
Contributor

Problem

Ubuntu 25+ ships sudo-rs (Rust reimplementation) as the default sudo provider. It changes the password prompt format, which breaks Ansible's become plugin — the prompt parser never recognises the sudo-rs format and times out:

[sudo: [sudo via ansible, key=...] password:] Password:
fatal: [localhost]: UNREACHABLE! => "Task failed: Timed out waiting for become success or become password prompt."

Tracked upstream as ansible/ansible#85837. The upstream fix (PR #86175) is still a draft.

What was wrong with the previous fix (cc65bc8)

  1. Broken detection -- sudo-rs --version is not a real command. sudo-rs installs itself as /usr/bin/sudo via update-alternatives; there is no sudo-rs binary.
  2. Limited scope -- The workaround only ran inside bootstrap.sh. Direct make targets (make install-docker, make nuke-snaps, etc.) bypassed it entirely.
  3. Silent failure -- If sudo.ws (traditional sudo) was not installed, the block did nothing and Ansible would still fail.

Changes

bootstrap.sh

  • Fixed detection: sudo --version 2>&1 | grep -qi sudo-rs
  • Added two-tier fallback:
    • Prefer sudo.ws if available: export ANSIBLE_BECOME_EXE=sudo.ws
    • Otherwise: create /etc/sudoers.d/onramp-nopasswd with NOPASSWD:ALL for the current user (bypasses the prompt entirely)

make.d/install.mk

  • Added SUDO_IS_RS detection at Makefile parse time using the same sudo --version check
  • When sudo-rs detected + sudo.ws available: export ANSIBLE_BECOME_EXE = sudo.ws
  • When sudo-rs detected + no sudo.ws: NEEDS_NOPASSWD = yes
  • Added fix-sudo-rs target that creates the NOPASSWD sudoers file when needed (no-op otherwise)
  • Wired fix-sudo-rs as a prerequisite of nuke-snaps, install-docker, install-node-exporter, and install-nvidia-drivers

Removal

All sudo-rs workaround blocks are commented with the upstream issue reference. They can be removed once Ansible merges PR #86175 and ships a release.

Ubuntu 25+ ships sudo-rs which changes the password prompt format,
breaking Ansible's become plugin (ansible/ansible#85837).

The previous fix (cc65bc8) used `sudo-rs --version` which doesn't
exist as a binary (sudo-rs installs as /usr/bin/sudo), and only
applied inside bootstrap.sh — direct make targets were unaffected.

Changes:
- Fix detection: `sudo --version | grep sudo-rs` instead of
  the non-existent `sudo-rs --version` command
- Centralize workaround in make.d/install.mk so all Ansible
  targets (install-docker, nuke-snaps, etc.) are covered
- Add NOPASSWD sudoers fallback when sudo.ws is unavailable,
  since Ubuntu 25.10+ plans to drop traditional sudo entirely
- Wire fix-sudo-rs as prerequisite for all Ansible make targets
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants