[Bug 2127766] Re: snap run --strace doesn't work with sudo-rs [sudo -E not supported]

Maciej Borzecki 2127766 at bugs.launchpad.net
Tue Dec 9 11:05:36 UTC 2025


Noble still works.

ubuntu at u1:~$ snap version
snap          2.73+ubuntu24.04
snapd         2.73+ubuntu24.04
series        16
ubuntu        24.04
kernel        6.8.0-88-generic
architecture  amd64
ubuntu at u1:~$ snap run --strace hello
/usr/bin/strace: Process 2957 attached
--- stopped by SIGSTOP ---
--- SIGCONT {si_signo=SIGCONT, si_code=SI_USER, si_pid=2949, si_uid=1000} ---
[pid  2957] execve("/snap/hello/42/snap/command-chain/snapcraft-runner", ["/snap/hello/42/snap/command-chai"..., "/snap/hello/42/bin/hello"], 0xc0000c8c60 /* 40 vars */ <unfinished ...>
[pid  2965] epoll_pwait(4, [], 128, 0, NULL, 0) = 0
[pid  2965] getpid()                    = 2957
[pid  2965] tgkill(2957, 2957, SIGURG)  = 0
[pid  2965] +++ exited with 0 +++
[pid  2966] <... futex resumed>)        = ?
[pid  2966] +++ exited with 0 +++
...
openat(AT_FDCWD, "/usr/share/locale-langpack/C.utf8/LC_MESSAGES/hello.mo", O_RDONLY) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/usr/share/locale-langpack/C/LC_MESSAGES/hello.mo", O_RDONLY) = -1 ENOENT (No such file or directory)
fstat(1, {st_mode=S_IFCHR|0600, st_rdev=makedev(0x88, 0), ...}) = 0
write(1, "Hello, world!\n", 14Hello, world!
)         = 14
close(1)                                = 0
close(2)                                = 0
exit_group(0)                           = ?
+++ exited with 0 +++

** Tags removed: verification-needed-noble
** Tags added: verification-done-noble

-- 
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/2127766

Title:
  snap run --strace doesn't work with sudo-rs [sudo -E not supported]

Status in snapd:
  Fix Committed
Status in rust-sudo-rs package in Ubuntu:
  Won't Fix
Status in snapd package in Ubuntu:
  New
Status in snapd source package in Jammy:
  Fix Committed
Status in snapd source package in Noble:
  Fix Committed
Status in snapd source package in Plucky:
  Fix Committed
Status in snapd source package in Questing:
  Fix Committed

Bug description:
  [SRU] 2.73:
  https://bugs.launchpad.net/ubuntu/+source/snapd/+bug/2132084

  [ Impact ]

  Only impacts Ubuntu 25.10+
  With sudo-rs, -E` is ignored, which breaks snapd run --strace.

  [ Test Plan ]

  1. Reproduce with snapd deb < 2.73

  - Ensure sudo-rs installed
  - Run: snap run --strace <snap>.<app>
  - Expect: warning: preserving the entire environment is not supported, `-E` is ignored

  2. Prove fixed with snapd deb 2.73

  - Ensure sudo-rs installed
  - Run: snap run --strace <snap>.<app>
  - Expect: No warning

  ---original---

  sudo-rs became the default sudo in 25.10, which broke this snap run
  --strace,

  $ snap run --strace <snap>.<app>
  warning: preserving the entire environment is not supported, `-E` is ignored
  [sudo: authenticate] Password:
  error: exit status 1

  It does work if I switch back to GNU Coreutils' sudo. The reason being
  many required environment variables are no longer passed through, and
  the strace fails due to SNAP_INSTANCE_NAME not being set, before we
  get to execve'ing the snap application itself.

  I commented on this use case in the sudo-rs issue tracker:
  https://github.com/trifectatechfoundation/sudo-rs/issues/1299

  Maybe snapd needs to have a whitelist of environment variables?

To manage notifications about this bug go to:
https://bugs.launchpad.net/snapd/+bug/2127766/+subscriptions




More information about the foundations-bugs mailing list