CODEX don't allow apt-get

I’m trying CODEX

I tried to set up .NET 9 SDK in the brand new OpenAI Codecs terminal. Guess what? No apt-get, no outbound connection, and not even ChatGPT knows who to ask for help.

It’s like giving me a Ferrari with no wheels and asking why I’m not winning the race.
Is this a feature, a bug, or just a cruel joke on devs?

2 Likes

You should be able to use apt-get in the setup script. Once that part of the process completes and the container boots, networking is disabled… but it’s available there for this purpose.

@EduardoPires @hunter.hillegas

You need to run apt update before any apt install or apt-get install commands or it will not be able to find the packages.

1 Like

Two things from my perspective…(1) I have had success with .net 8 using apt install in the setup script. Here is the install script that has worked:

set -euo pipefail
apt-get update
apt-get install -y dotnet-sdk-8.0
# Only restore if we actually have a project/solution file
if compgen -G "*.sln" >/dev/null || compgen -G "*.csproj" >/dev/null; then
  echo "⛓  Found .NET project/solution file – running dotnet restore..."
  dotnet restore
else
  echo "⚠️  No .sln or .csproj file found. Skipping dotnet restore."
fi

(2) I have had some inconsistencies I can’t explain. The first several tasks I tried after saving the script in the environment settings failed inexplicably. Then it just started working, which makes me think there may be bugs, or some latency between save and effect. Also, it looks to me like the environment setup is different for the ‘Ask’ tasks, and when I use the environment with the script above for the ask tasks, dotnet is not found for the agent.

Thank you for the script. Here’s a version for dotnet 9 sdk:

set -euo pipefail
wget https://packages.microsoft.com/config/ubuntu/22.04/packages-microsoft-prod.deb -O packages-microsoft-prod.deb
sudo dpkg -i packages-microsoft-prod.deb
rm packages-microsoft-prod.deb
apt-get update
apt-get install -y dotnet-sdk-9.0
# Only restore if we actually have a project/solution file
if compgen -G "*.sln" >/dev/null || compgen -G "*.csproj" >/dev/null; then
  echo "⛓  Found .NET project/solution file – running dotnet restore..."
  dotnet restore
else
  echo "⚠️  No .sln or .csproj file found. Skipping dotnet restore."
fi
1 Like