Codex app doesn't open in WSL with bash
Resolved 💬 15 comments Opened Mar 4, 2026 by kendonB Closed Mar 5, 2026
💡 Likely answer: A maintainer (github-actions[bot], contributor)
responded on this thread — see the highlighted reply below.
What version of the Codex App are you using (From “About Codex” dialog)?
No About Codex
What subscription do you have?
Pro
What platform is your computer?
Windows 11
What issue are you seeing?
<img width="1058" height="409" alt="Image" src="https://github.com/user-attachments/assets/ae597ea5-13c2-41d1-8498-1eb926d508aa" />
What steps can reproduce the bug?
Open Codex, switch settings to WSL/bash throughout. Close Codex. Reopen Codex.
What is the expected behavior?
_No response_
Additional information
_No response_
15 Comments
Potential duplicates detected. Please review them and close your issue if it is a duplicate.
Powered by Codex Action
I found this temporary workaround until they fix this issue
The idea is to grant Read + Execute on the specific Codex package.
Run powershell as administrator.
Copy the folder path.
Run:
then Run:
Close codex app and re-open. Should work
Thanks for reporting. We understand the problem and are working on a fix.
PowerShell Script Fix:
It's now been resolved (update via Windows Store). I tested and it works.
Thanks for the confirmation!
<img width="684" height="653" alt="Image" src="https://github.com/user-attachments/assets/376b3675-dd6b-487e-abd4-c0d578d1f6d5" />
I updated the Codex app via the Windows Store and tested again, but the issue still occurs on my side. The app-server still exits with the same error when WSL mode is enabled (permission denied when trying to execute the runtime under WindowsApps).
Could you confirm which version contains the fix, or if there are any additional steps required after updating? I’m currently unable to start Codex when WSL execution is enabled.
Which version should we have? My codex app has been updated to version 26.304.1528.0, but I get the following error:
Codex app-server exited unexpectedly (code=126, signal=null).Most recent error: /usr/bin/bash: line 1: /mnt/c/Users/beems/.codex/bin/wsl/codex: Success
Edit 1:
I tried also with deleting the .codex folder in my user profile to start clean. But when setting it to use wsl, it give the above error again.
Edit 2:
I did some debugging with Chat. It came to the conclusion I was running WSL as
arm64and that triggered the error. The codex file at.codex/bin/wsl/codexshowsELF 64-bit LSB pie executable, x86-64, version 1 (SYSV), static-pie linked, stripped.Can others confirm that it isn't working and they are on
arm64WSL?@TheBeems @xvhuan Since the issue was closed out, open a new issue if you are still experiencing this.
I am also on WSL and arm64 and have the same problem.
An error has occurred
Codex crashed with the following error:
Codex app-server exited unexpectedly (code=3221225781, signal=null).
Most recent error: None
Some things to try:
Check your config.toml for invalid settings
Check your settings to disable running in WSL if you are seeing compatibility issues
Try downloading a different version of the extension
Any help...
No it didn't fixed
<img width="685" height="678" alt="Image" src="https://github.com/user-attachments/assets/461596e8-9ad8-4c10-bb61-95bb929fc7fd" />
@Mohitxxx @MertCtn Looks like a new bug. Best to create a separate issue. Everything is running smoothly here. This was a permissions error. Something seems to be wrong with Bash on your end.
To prevent permission error on your end check my script: https://github.com/openai/codex/issues/13488#issuecomment-3999948870 If the error persists after that, it is a new problem.
I created a new issue for machines on arm cpu's: https://github.com/openai/codex/issues/13565
But I assume it has very low priority. Is the codex app open source as well? So we can compile the app ourselves?
These are the steps from Claude Sonnet 4.6 in English, and it helped me to solve the problem:
Root Cause
When Docker Desktop is installed, the WSL default distribution may be set to
docker-desktopordocker-desktop-data. These are Docker's internal distributions and do not contain a full Linux environment (no/usr/bin/bash). Codex reads the WSL default distribution and tries to execute within it, resulting in this error.Diagnostic Step
Run the following in PowerShell to check your current WSL status:
If the output looks like this:
The
*next todocker-desktopconfirms this is the issue.Fix Options
Fix 1: Change the WSL Default Distribution (Most Effective)
If your Ubuntu distribution has a different name (e.g.
Ubuntu-22.04), replace accordingly. Then restart the Codex app.Fix 2: Make Sure Ubuntu is Running on WSL2
If Ubuntu is still on WSL1, upgrade it:
Then run Fix 1 again.
Fix 3: If No Linux Distribution is Installed
If
wsl -l -vonly showsdocker-desktopentries, you have no Ubuntu installed:This installs Ubuntu as the default distribution. Restart your PC after.
Fix 4 (Temporary Workaround): Edit the Config File Manually
If none of the above resolves it immediately:
%USERPROFILE%\.codex\.codex-global-state.jsonrunCodexInWindowsSubsystemForLinuxtofalseRecommended Order
wsl -l -vto confirm the issuewsl --set-default Ubuntu(or the correct distribution name)This approach directly addresses the root cause, unlike the permission fixes you previously attempted.
---
這些是來自 Claude Sonnet 4.6 的步驟(英文版),它幫助我解決了問題:
這個問題的核心在於:Codex 嘗試在
docker-desktop這個 WSL 發行版中運行,而非真正的 Linux 發行版(如 Ubuntu),因此找不到/usr/bin/bash。 這是一個已知的 WSL 預設發行版設定問題。問題根源
當你安裝了 Docker Desktop 後,WSL 的預設發行版可能被設定為
docker-desktop或docker-desktop-data,而這些是 Docker 的內部發行版,並不包含完整的 Linux 環境(沒有/usr/bin/bash)。Codex 讀取 WSL 預設發行版並嘗試在其中執行,結果就出現此錯誤 。 github診斷步驟
先在 PowerShell 執行以下指令,確認目前 WSL 狀態:
如果輸出類似:
看到
*標記在docker-desktop旁邊,就確認是這個問題。修復方案
方案 1:更改 WSL 預設發行版(最根本的修復)
如果你的 Ubuntu 發行版名稱不同(例如
Ubuntu-22.04),請用正確名稱替換 。改完後重新啟動 Codex 即可。 [stackoverflow](https://stackoverflow.com/questions/72483632/ubuntu-error-the-command-docker-could-not-be-found-in-this-wsl-2-distro)方案 2:確認 Ubuntu 為 WSL2 版本
如果 Ubuntu 發行版仍是 WSL1,需要升級:
完成後再執行方案 1 。 [dev](https://dev.to/bowmanjd/install-docker-on-windows-wsl-without-docker-desktop-34m9/comments)
方案 3:如果未安裝任何 Linux 發行版
若
wsl -l -v只顯示docker-desktop系列,代表你尚未安裝 Ubuntu:這會安裝 Ubuntu 作為預設發行版,完成後重啟電腦 。 [developers.openai](https://developers.openai.com/codex/windows)
方案 4(臨時 Workaround):手動修改設定檔
如果以上都無法立即解決,可暫時避免 app 無法啟動的問題 : [x](https://x.com/dkundel/status/2029263781558403504)
%USERPROFILE%\.codex\.codex-global-state.jsonrunCodexInWindowsSubsystemForLinux改為false建議執行順序
wsl -l -v確認問題wsl --set-default Ubuntu(或正確的發行版名稱)這個步驟比之前嘗試的權限修復更直接針對根本原因。