[Bug 2150695] Re: sudo-rs won't allow root in proot in Termux in Android

Simon Johnsson 2150695 at bugs.launchpad.net
Tue May 5 07:30:21 UTC 2026


I see what you mean. The reason why I marked this as "invalid" is that
we do not support or maintain running Ubuntu in the configuration you
mention. I can as a result not reproduce or confirm whether this is a
bug or not.

The old sudo does check for that flag, here is the snippet from the
source code (sudo.c):

957:	if (prctl(PR_GET_NO_NEW_PRIVS, 0, 0, 0, 0) == 1) {
958:	    sudo_warnx("%s", U_("The \"no new privileges\" flag is set, which "
959:		"prevents sudo from running as root."));
960:	    sudo_warnx("%s", U_("If sudo is running in a container, you may need"
961:		" to adjust the container configuration to disable the flag."));
962:	    exit(EXIT_FAILURE);
963:	}

And here is the corresponding part of the code in sudo-rs
(system/audit.rs):

19: pub(crate) fn no_new_privs_enabled() -> io::Result<bool> {
20:    // SAFETY: prctl(PR_GET_NO_NEW_PRIVS) can never cause UB
21:    let no_new_privs =
22:        crate::cutils::cerr(unsafe { libc::prctl(libc::PR_GET_NO_NEW_PRIVS, 0, 0, 0, 0) })?;
23:    Ok(no_new_privs != 0)
24: }

As you can see, they are using the same call to libc (using
PR_GET_NO_NEW_PRIVS). Your problem is most likely related to your
container having the flag set.

As a final note, I refer you to proot-distro's repo instead
(https://github.com/termux/proot-distro). Their bundled Ubuntu version
is 25.10, not 26.04.

Cheers!

-- 
You received this bug notification because you are a member of Ubuntu
Foundations Bugs, which is subscribed to rust-sudo-rs in Ubuntu.
https://bugs.launchpad.net/bugs/2150695

Title:
  sudo-rs won't allow root in proot in Termux in Android

Status in rust-sudo-rs package in Ubuntu:
  Invalid

Bug description:
  Unable get root in Ubuntu using sudo-rs when running it in proot in
  Termux in Android due to the check of a flag in the kernel. That flag
  can't be changed in the kernel since I'm running Android.

  The output is:
  sudo: The "no new privileges" flag is set, which prevents sudo from running as root.
  sudo: If sudo is running in a container, you may need to adjust the container configuration to disable the flag.

  Fix:
  Login as root & purge sudo-rs:

  pd login --user root ubuntu
  apt purge sudo-rs
  apt install sudo

  Then one can login and use sudo normally as before:

  pd login --user shemgp ubuntu
  sudo apt update -y

  ProblemType: Bug
  DistroRelease: Ubuntu 26.04
  Package: sudo-rs (not installed)
  Uname: Linux 6.17.0-PRoot-Distro aarch64
  ApportVersion: 2.34.0-0ubuntu2
  Architecture: arm64
  CasperMD5CheckResult: unknown
  Date: Thu Apr 30 11:29:20 2026
  ProcEnviron:
   LANG=en_US.UTF-8
   PATH=(custom, no user)
   TERM=xterm-256color
  SourcePackage: rust-sudo-rs
  UpgradeStatus: Upgraded to resolute on 2026-04-23 (7 days ago)

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/rust-sudo-rs/+bug/2150695/+subscriptions




More information about the foundations-bugs mailing list