Ubuntu 26.04 sudo-rs Breaks Ansible become
Published 2026-11-27Category: Guides
Ubuntu 26.04 replaces sudo with sudo-rs, causing Ansible -K timeout. Fix via Ansible Core 2.22.0+, inventory ansible_become_exe=sudo.ws
Table of contents

Introduction & Key Points
Operations teams migrating servers from Ubuntu 22.04/24.04 to 26.04 have encountered a regression: running Ansible playbooks with -K (--ask-become-pass) fails during “Gathering Facts” with Timeout (12s) waiting for privilege escalation prompt. The root cause is Ubuntu 26.04 shipping sudo-rs, a Rust rewrite of sudo, as the default. sudo-rs emits an extra line before the password prompt, breaking the Ansible become plugin’s fixed prompt-matching logic. The same issue affects pyinfra and similar automation tools. This article covers three remediation paths for teams maintaining large Ubuntu fleets that rely on password-based sudo.
Core Facts & Comparison
| Symptom | Root Cause | Official Fix Version | Workaround A | Workaround B |
|---|---|---|---|---|
ansible-playbook -K errors Timeout (12s) waiting for privilege escalation prompt |
Ubuntu 26.04 defaults sudo to sudo-rs; prompt format changed |
Ansible Core 2.22.0 (backported to 2.16/2.18/2.19/2.20/2.21) | Set ansible_become_exe=sudo.ws in inventory to use legacy sudo |
Run update-alternatives --config sudo system-wide to switch back to sudo.ws |
Technical Deep Dive & Operational Details
Prompt Mismatch Mechanics
Legacy sudo outputs standard prompts such as BECOME password: directly. The Ansible become plugin waits for this pattern via regex. sudo-rs prints an additional informational line (exact string not disclosed in source) before the prompt, so Ansible’s 12-second timeout expires before the expected pattern appears, causing privilege escalation to be deemed failed. This behavioral difference stems from the upstream implementation change, not an Ansible defect.
Ansible Upgrade Fix Path
The Ansible community addressed the issue in the “validate sudo become plugin against sudo-rs” ticket. The fix shipped in Ansible Core 2.22.0 and was backported to the 2.16, 2.18, 2.19, 2.20, and 2.21 maintenance branches. Operators only need to upgrade the control node with pip install -U ansible to any version containing the fix; no changes are required on managed nodes.
Inventory-Level Workaround Without Upgrade
When the control node cannot be upgraded (e.g., managed platform lock-in), explicitly set ansible_become_exe=sudo.ws for target hosts in the inventory. Ubuntu 26.04 retains the traditional sudo binary under the name sudo.ws, coexisting via the alternatives mechanism. This parameter instructs Ansible to invoke sudo.ws directly, bypassing sudo-rs, and takes effect immediately — suitable for mixed-version clusters during transition.
Scenario-Based Selection & Pitfall Checklist
- Control node freely upgradable: Preferred — run
pip install -U ansibleto ≥2.22.0 or the latest patched micro-version of a backported branch. Resolves the issue for all managed nodes at once with minimal maintenance overhead. - Control node version frozen (e.g., platform-locked): Apply
ansible_become_exe=sudo.wsin inventory for Ubuntu 26.04 host groups only; other distributions remain unaffected. - Full-environment standardization: In base images or Ansible bootstrap tasks, execute
update-alternatives --config sudoand selectsudo.wsto eliminate the divergence at the source. Evaluate impact on any local scripts that depend onsudo-rs-specific features (not disclosed in source). - Pitfall: Do not uninstall the
sudo-rspackage; it may break Ubuntu 26.04 package dependencies.sudo.wsis Canonical’s officially retained compatibility path with guaranteed long-term availability. - Cross-tool ripple: pyinfra is similarly affected; its fix landed in version 3.11 — apply the same upgrade strategy.
FAQ
Ansible upgraded but error persists — how to troubleshoot
Verify ansible --version on the control node shows Core 2.22.0+ or the latest micro-version of 2.16/2.18/2.19/2.20/2.21. If using a virtual environment, upgrade inside that venv. Rule out SSH ControlPersist reusing stale connections that cache the old prompt behavior.
Are sudo.ws and sudo-rs functionally equivalent?
sudo.ws is the traditional C implementation, preserving existing syntax and plugin ecosystem. sudo-rs is a Rust rewrite targeting memory safety and performance; certain cutting-edge features (specific differences not disclosed in source) may exist only in sudo-rs. Before switching in production, run the full playbook suite on a test machine to validate compatibility.
Sources & References
- Lobsters DevOps/Linux: Ansible Fails waiting for privilege escalation on Ubuntu 26 (2026-11-26)
Spotted outdated pricing, stock, or expired coupons?See methodology & report an update →

