Repeated "sudo: The 'no new privileges' flag is set" printed before every command

Resolved 💬 2 comments Opened Dec 4, 2025 by pforques Closed Mar 2, 2026
💡 Likely answer: A maintainer (etraut-openai, contributor) responded on this thread — see the highlighted reply below.

What version of Codex is running?

codex-cli 0.64.0

What subscription do you have?

Plus

Which model were you using?

gpt-5.1-codex-max

What platform is your computer?

Linux 6.6.87.2-microsoft-standard-WSL2 x86_64 unknown

What issue are you seeing?

  • Any command executed through the Codex CLI prints multiple lines: `sudo: The "no new privileges"

flag is set, which prevents sudo from running as root...` before the real output.

  • Example:
  • pwd → warning repeats 3x, then /home/orbisu
  • ls → warning repeats 3x, then apps, Downloads, projects, projects - Shortcut.lnk
  • codex --version → warning repeats 3x, then codex-cli 0.64.0

What steps can reproduce the bug?

1) Start a Codex CLI session on WSL2 (Linux 6.6.87.2-microsoft-standard-WSL2).
2) Run any simple command (e.g., pwd, ls, codex --version).
3) Observe that three sudo “no new privileges” warnings print before the actual command output.

What is the expected behavior?

  • Commands should run normally without sudo warnings when they don’t invoke sudo.

Additional information

The warnings appear even though the commands don’t call sudo explicitly. Environment is WSL2; sandbox mode workspace-write, network restricted.

<img width="935" height="665" alt="Image" src="https://github.com/user-attachments/assets/17c694e0-ee90-4b5a-937a-979815170449" />

View original on GitHub ↗

2 Comments

pforques · 8 months ago

The flag disappear when running sudo codex
But of course I don't want to run codex as sudo. So I really need help on this one.

etraut-openai contributor · 5 months ago

@pforques, are you still seeing this behavior? No one else has reported this, so I think it's something specific to your system.