codex gets stuck at sudo step running on Ubuntu
What version of Codex is running?
codex-cli 0.53.0
What subscription do you have?
Pro
Which model were you using?
gpt 5 codex
What platform is your computer?
Linux 6.8.0-59-generic x86_64 x86_64
What issue are you seeing?
When Codex executes a command requiring sudo privileges, the terminal enters a password prompt state where user keyboard input does not register properly. The prompt appears, but input is either partially displayed or not accepted at all. The session becomes unresponsive to normal keyboard input.
Observed Behavior
Codex runs a command that triggers sudo
Terminal displays password for <user>: prompt
User attempts to type password
Input is not accepted (random characters appear or nothing appears)
Terminal becomes effectively frozen
Pressing Esc repeatedly sometimes restores control, but often fails even if it restore control keyboard input is only taken in partially
In many cases only Ctrl+C works, and sometimes the entire session must be closed
After force-closing, user must run codex resume to continue
it is not clear whether codex is actually working or it is waiting for a password . even if it is waiting for a password we cannot provide it as inout does not work
<img width="2037" height="432" alt="Image" src="https://github.com/user-attachments/assets/e6a941a3-2cbc-4ee2-b7a7-bd566cf34480" />
<img width="1357" height="222" alt="Image" src="https://github.com/user-attachments/assets/29b8a7da-d0c5-453b-876e-2d3c54dcd2bc" />
<img width="876" height="152" alt="Image" src="https://github.com/user-attachments/assets/1fb793e8-7f9d-45c3-88bc-7957ca794ba2" />
What steps can reproduce the bug?
Start a Codex CLI session on Ubuntu
Let it do some trivial stuff
Then let cidex do something that needs a sudo privilege like sudo docker ( does not really matter as long as sudo is involved)
Terminal shows password prompt
User tries to type password
Terminal freezes / does not accept input
Press Escape many times some times it work sometime it does not , if it works try to type anything and whatever you input will not appear on screen fully
What is the expected behavior?
Password input should be accepted normally, or
Codex should detect interactive sudo context and:
Prompt user for password securely, or
Fall back to non-interactive mode with proper guidance
Additional information
_No response_
6 Comments
Potential duplicates detected. Please review them and close your issue if it is a duplicate.
Powered by Codex Action
I also observed this issue. Very annoying!
I also don't understand why it should get sudo permissions at all.
If I manually run sudo before, programs will not ask for sudo password for some time. I though this could be a workaround.
But then I see this:
Seems like it's running in some container as root?
just ran into this in ubuntu, really annoying
Hey! I ran into a similar pattern in our bug knowledge base and thought this might help.
What's happening: Codex sandbox sets PR_SET_NO_NEW_PRIVS (prctl/seccomp) which kernel-blocks sudo privilege escalation. Additionally, Codex PTY layer does not properly relay interactive stdin to sudo password prompt, causing frozen terminal.
What worked for us:
Pre-scan commands for sudo/pkexec before execution. If detected: (1) reject with clear error explaining sandbox limitation, (2) suggest user run
sudo -vin a separate terminal to cache credentials (won't work due to no_new_privs), or (3) recommend user pre-install dependencies outside Codex. For the frozen terminal: add a timeout on interactive stdin prompts and detect sudo password prompt pattern to abort early with actionable message.Hope this helps! Let me know if it doesn't match your case — happy to dig deeper. 🦞
---
<sub>🦞 Confucius Debug — community knowledge base for AI agent bugs. Free to search via MCP.</sub>
It's happening to me. Whenever I want codex run some "sudo" command, it doesn't allow me to type the password, so it's always stuck on some tasks, like debugging driver problems.
A workaround for linux users:
Run sudo visudo to edit the sudoers file
Add a line for your user:
your_username_here ALL=(ALL) NOPASSWD: ALL
Note: This has significant security implications and should ideally be restricted to specific commands like
NOPASSWD: /usr/bin/apt-get)