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_

View original on GitHub ↗

15 Comments

github-actions[bot] contributor · 4 months ago

Potential duplicates detected. Please review them and close your issue if it is a duplicate.

  • #12974

Powered by Codex Action

mahdimessai · 4 months ago

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.

Get-ChildItem "C:\Program Files\WindowsApps" |
  Where-Object { $_.Name -like "OpenAI.Codex*" } |
  Select-Object Name, FullName

Copy the folder path.

$pkg = "C:\Program Files\WindowsApps\OpenAI.Codex_26.304.38.0_x64__2p2nqsd0c7..."

Run:

takeown /F "$pkg" /R /D Y

then Run:

icacls "$pkg" /grant "$($env:USERNAME):(OI)(CI)(RX)" /T

Close codex app and re-open. Should work

etraut-openai contributor · 4 months ago

Thanks for reporting. We understand the problem and are working on a fix.

wbdb · 4 months ago

PowerShell Script Fix:

  • Open PowerShell as administrator
  • Navigate to the script
  • .\Fix-CodexWindowsAppsAcl.ps1
# Fix-CodexWindowsAppsAcl.ps1
# Grants current user Read+Execute to the installed OpenAI.Codex WindowsApps package.
# Run in an elevated PowerShell (Administrator).

$ErrorActionPreference = "Stop"

function Assert-Admin {
  $id = [Security.Principal.WindowsIdentity]::GetCurrent()
  $p  = New-Object Security.Principal.WindowsPrincipal($id)
  if (-not $p.IsInRole([Security.Principal.WindowsBuiltInRole]::Administrator)) {
    throw "Please run this script as Administrator."
  }
}

Assert-Admin

$base = "C:\Program Files\WindowsApps"
if (-not (Test-Path $base)) { throw "Path not found: $base" }

# List matching packages
$pkgs = Get-ChildItem $base -Directory |
  Where-Object { $_.Name -like "OpenAI.Codex*" } |
  Sort-Object LastWriteTime -Descending

if (-not $pkgs -or $pkgs.Count -eq 0) {
  throw "No folders matching 'OpenAI.Codex*' found under $base"
}

Write-Host "Found Codex packages:" -ForegroundColor Cyan
$pkgs | Select-Object Name, FullName, LastWriteTime | Format-Table -AutoSize

# Pick newest
$pkg = $pkgs[0].FullName
Write-Host "`nUsing package:" -ForegroundColor Cyan
Write-Host $pkg

# Take ownership (recursive)
Write-Host "`nRunning takeown..." -ForegroundColor Yellow
# Note: On some localized Windows versions /D expects localized input. Omit /D to avoid 'Y' parse errors.
& takeown /F "$pkg" /R | Out-Host

# Ensure Administrators group has Full Control (often required before changing ACLs in WindowsApps)
Write-Host "`nGranting Administrators Full Control (required for WindowsApps)..." -ForegroundColor Yellow
& icacls "$pkg" /grant "Administrators:(OI)(CI)(F)" /T | Out-Host

# Grant current user Read+Execute
$user = $env:USERNAME
Write-Host "`nGranting Read+Execute to '$user'..." -ForegroundColor Yellow
& icacls "$pkg" /grant "${user}:(OI)(CI)(RX)" /T | Out-Host

Write-Host "`nDone. Close Codex completely and reopen it." -ForegroundColor Green
BWBrook · 4 months ago

It's now been resolved (update via Windows Store). I tested and it works.

etraut-openai contributor · 4 months ago

Thanks for the confirmation!

xvhuan · 4 months ago

<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.

TheBeems · 4 months ago
It's now been resolved (update via Windows Store). I tested and it works.

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 arm64 and that triggered the error. The codex file at .codex/bin/wsl/codex shows ELF 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 arm64 WSL?

illgitthat · 4 months ago

@TheBeems @xvhuan Since the issue was closed out, open a new issue if you are still experiencing this.

peckomingo · 4 months ago

I am also on WSL and arm64 and have the same problem.

Mohitxxx · 4 months ago

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...

MertCtn · 4 months ago
It's now been resolved (update via Windows Store). I tested and it works.

No it didn't fixed

<img width="685" height="678" alt="Image" src="https://github.com/user-attachments/assets/461596e8-9ad8-4c10-bb61-95bb929fc7fd" />

wbdb · 4 months ago

@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.

TheBeems · 4 months ago

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?

benchan111999-cmd · 2 months ago

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-desktop or docker-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:

wsl -l -v

If the output looks like this:

  NAME                   STATE           VERSION
* docker-desktop         Running         2
  docker-desktop-data    Running         2
  Ubuntu                 Stopped         2

The * next to docker-desktop confirms this is the issue.

Fix Options

Fix 1: Change the WSL Default Distribution (Most Effective)

wsl --set-default Ubuntu

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:

wsl --set-version Ubuntu 2

Then run Fix 1 again.

Fix 3: If No Linux Distribution is Installed

If wsl -l -v only shows docker-desktop entries, you have no Ubuntu installed:

wsl --install

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:

  1. Open %USERPROFILE%\.codex\.codex-global-state.json
  2. Set runCodexInWindowsSubsystemForLinux to false
  3. Restart Codex, then go to Settings and switch back to WSL mode

Recommended Order

  1. Run wsl -l -v to confirm the issue
  2. Run wsl --set-default Ubuntu (or the correct distribution name)
  3. Restart Codex

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-desktopdocker-desktop-data,而這些是 Docker 的內部發行版,並不包含完整的 Linux 環境(沒有 /usr/bin/bash)。Codex 讀取 WSL 預設發行版並嘗試在其中執行,結果就出現此錯誤 。 github

診斷步驟

先在 PowerShell 執行以下指令,確認目前 WSL 狀態:

wsl -l -v

如果輸出類似:

  NAME                   STATE           VERSION
* docker-desktop         Running         2
  docker-desktop-data    Running         2
  Ubuntu                 Stopped         2

看到 * 標記在 docker-desktop 旁邊,就確認是這個問題。

修復方案

方案 1:更改 WSL 預設發行版(最根本的修復)

wsl --set-default Ubuntu

如果你的 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,需要升級:

wsl --set-version Ubuntu 2

完成後再執行方案 1 。 [dev](https://dev.to/bowmanjd/install-docker-on-windows-wsl-without-docker-desktop-34m9/comments)

方案 3:如果未安裝任何 Linux 發行版

wsl -l -v 只顯示 docker-desktop 系列,代表你尚未安裝 Ubuntu:

wsl --install

這會安裝 Ubuntu 作為預設發行版,完成後重啟電腦 。 [developers.openai](https://developers.openai.com/codex/windows)

方案 4(臨時 Workaround):手動修改設定檔

如果以上都無法立即解決,可暫時避免 app 無法啟動的問題 : [x](https://x.com/dkundel/status/2029263781558403504)

  1. 開啟 %USERPROFILE%\.codex\.codex-global-state.json
  2. runCodexInWindowsSubsystemForLinux 改為 false
  3. 重新啟動 Codex,進入設定後再重新切換回 WSL 模式

建議執行順序

  1. 先跑 wsl -l -v 確認問題
  2. 執行 wsl --set-default Ubuntu(或正確的發行版名稱)
  3. 重新啟動 Codex

這個步驟比之前嘗試的權限修復更直接針對根本原因。