Ansible Fails waiting for privilege escalation on Ubuntu 26
16 points by ema-pe
16 points by ema-pe
I tell people I generally don't use Linux because it's messy and changes gratuitously, and when people ask me to explain what I mean, I tell them as an example that any how-to, book, manual, or script that's meant for one version of Ubuntu is often likely to not work with the next version, unless or until the how-to, book, manual or script is updated.
This is a perfect example.
It is a prefect example of how parsing output intended for humans is fragile.
If other distros plan on moving to sudo-rs that's one thing, but if it's just Ubuntu, maybe I should hop back to Debian for everything, and not just my cloud servers.
Speaking as a long-time Debian user, is there a compelling reason to switch to Ubuntu? In my casual (and possibly cynical) understanding, Ubuntu is just Debian plus a bunch of failed experiments like Unity, Snap, and whatever that proprietary init system was. There must be something about it, though, because it seems so much more popular than Debian.
So i really want to like Ubuntu, they push alternative CPUs, seem to have big input into RV32 for RiscV... actually, thats it. I can't think of any other reason to like them.
Mir, snap, upstart, coreutils to rust. Just a stench of not invented here. No, I can't think of any reason to use Ubuntu other than 'nothing else is available'
oh, come on. Upstart predated systemd (it's quoted in the initial docs so much btw), and Mir might have had better design than wayland. Snapd is indeed utter shite, though.
Agreed, but they also dragged their feet trying to keep upstart going. And there was already plenty of System V init but in parallel projects going when they started. OpenRC for example.
They used to have their own version control system (Bazaar), Juju instead of ansible, own container setup LXD.
Their decision making is broken. Shouldn't be trying to own the world. Using ubuntu, imho is no longer like using linux, but some mutant off to the side.
LXD/incus are still alive and preferred enough by some people to this day that they forked off when Canonical did their thing. I think Docker mostly won over LXD because of registry and Dockerfile, not for implementation merits. Then Red Hat reimplemented Docker anyway, and k8s ate their lunch too, anyway.
But yeah, I don't want to disagree on the overall, I just wanted to give credit where it's due. They sometimes were right. Less often than they should have.
I used Ubuntu twenty years ago because it "just worked", giving me working WiFi for my laptop in college with minimal fuss. I remember trying Debian at the time and being bothered that all the software used some older versions.
Around ten years ago I switched to Debian, wanting something that was more stable. My WiFi still doesn't work out of the box but I know how to compile the driver and get DKMS working. I'm much more likely to be bothered these days by new features versus wanting to run the latest version of everything.
I briefly used Linux Mint for a desktop computer my kids use, but as long as I was managing it there was no usability benefit over Debian. I also used Ubuntu in a Docker container for a while, but only because I needed a newer version of a package and that was the path of least resistance. I switched that to Debian when debian:latest caught up.
I think there is a strong need for a distro that is easy for new users, but anyone who gets hooked on Linux will gravitate towards stable projects like Debian.
Vendor support. Many hardware vendors only provide ubuntu drivers and immediately drop support cases if running something else
My personal take is that many years ago Ubuntu made more sense if you didn't want to touch your LTS server. Like, install when the Ubuntu release is fresh, and be fine. Debian wasn't so good at providing >3y (iirc) and with their release cycles... "Debian stale" was not named that for nothing. (This was also the time I ran testing on my daily workhorse, no problems.)
These days I actually see zero reason unless you have some contract (and most people are not in the place to decide that).
From the article:
Apparently Ubuntu's been rewriting system utilities in Rust, and the sudo-rs version that ships on Ubuntu 26.04 has some incompatiblities with the sudo I've used on servers for 20+ years.
It prints an extra string before the password prompt, which sudo doesn't do, and that can confuse automation tools like Ansible that wait for a specific prompt.
This reminds me a lot of this xkcd comic: https://xkcd.com/1172/
Yeah no. I read the issue and it seems pretty reasonable. Ansible makes sudo's prompt into a string which contains a key, and then match on that string; meaning they use the --prompt option to turn Sudo's prompt into something like:
[sudo via ansible, key=spnnznrgscgdxdontsjkwrlyghiiglxk] password:
and then look for a line which matches that.
So when sudo-rs instead prints the line:
[sudo: [sudo via ansible, key=spnnznrgscgdxdontsjkwrlyghiiglxk] password:] Password:
then Ansible intentionally doesn't match that, because it doesn't match the intended, explicitly provided output.
And Ansible looks for the expected string at the start of the line, because some configurations cause every command that's executed to be printed, and they don't want to match a line like:
+sudo --prompt '[sudo via ansible, key=spnnznrgscgdxdontsjkwrlyghiiglxk] password:'
which you would get with e.g set -x.
So it's that extra "[sudo: " prefix which messes up the match; that's the "extra string" that sudo-rs prints before the prompt.
When I first read the part you quoted I assumed that Ansible just got confused by an extra line that sudo-rs prints, and I would've agreed, that's not very robust. But to me, it seems like Ansible has implemented this "wait for the sudo prompt" logic in a way that's impressively robust. I probably would've either done it in the same way or found a worse solution.
Yep, reading the issue, it's much more complex than I thought. The only thing left is why sudo-rs changed how prompts are handled
The issue seems to hint at an answer:
sudo implemented this by capturing the pam password prompt, and rewriting it, which the sudo-rs maintainers did not implement.
I don't know anything about the pam API, but it wouldn't surprise me if this "capturing and rewriting the pam password prompt" stuff is pretty messy.
PAM allows an application to control the IO of the authentication conversation with pam_conv and suppress other messages with PAM_SILENT so it’s possible to rewrite the password prompt without grievous hacking around the PAM API. But it’s still pretty messy.
Except that the output format of an established command is seldom a bug.
If you want to make a drop-in replacement for a utility, ensuring it responds in the same way is essential. You can do all you want to improve the internals, the documentation etc but why mess with the output?