OpenHands
OpenHands copied to clipboard
[BUG] Exception: Failed to create opendevin user in sandbox: b'useradd: UID 0 is not unique\n'
Describe the bug
When I run the make run command, everything seems to start but when the Agent controller try to initiate the environment an exception is thrown: Exception: Failed to create opendevin user in sandbox: b'useradd: UID 0 is not unique\n'
Setup and configuration
Current version:
commit 8ab9c6fb86db7ac21969fd5fadd18bab97bdb172 (HEAD -> main, origin/main, origin/HEAD)
My config.toml and environment vars (be sure to redact API keys):
LLM_MODEL="gpt-3.5-turbo-1106"
LLM_API_KEY="sk-XXX"
LLM_EMBEDDING_MODEL="openai"
WORKSPACE_DIR="./workspace"
My model and agent (you can see these settings in the UI):
- Model: gpt-3.5-turbo-1106
- Agent: MonologueAgent
Commands I ran to install and run OpenDevin:
# Install NVM then nodejs
nvm install 20.12.1
# Install pipx to install poetry (python 3.11.9)
apt install pipx
pipx install poetry
# Docker version 26.0.0
# Then
make build
make setup-config
make run
Steps to Reproduce:
- make run
- Go to the UI
Logs, error messages, and screenshots:
Additional Context
I am running a WSL (ubuntu) on Windows 11
SOLUTION
You need to export the variable SANDBOX_USER_ID to 1000 thanks to @SmartManoj
export SANDBOX_USER_ID=1000
I'm facing the same issue.
me too. My os is macOS. Apple Chip(M1)
I am also running open devin in a WSL (ubuntu) on windows 11 and I get the same error message. Any workarounds?
Has this version been tested with a specific version of Docker? In the requirements, it's simply Docker without any version.
I'm facing the same issue.
Same problem here too. Any help please ?
Did you run the command sudo make run? Try changing to make run.
Did you run the command
sudo make run? Try changing tomake run.
Well that is one thing I tried, then it gives me this error:
[Errno 13] Permission denied: b'/mnt/c/Windows/system32/config/systemprofile/AppData/Local/Microsoft/WindowsApps/uvicorn
mmmh in fact may be we need to run docker in rootless ?
Did you run the command
sudo make run? Try changing tomake run.Well that is one thing I tried, then it gives me this error:
[Errno 13] Permission denied: b'/mnt/c/Windows/system32/config/systemprofile/AppData/Local/Microsoft/WindowsApps/uvicorn
Can you try sudo chmod 777 -R 'denied_path' ?
me too,My Os is CentOS7.9
me tooοΌ
same error. Docker version 26.0.0, build 2ae903e Linux docker2 6.1.0-18-amd64 #1 SMP PREEMPT_DYNAMIC Debian 6.1.76-1 (2024-02-01) x86_64 GNU/Linux
export SANDBOX_USER_ID=1000 and run again
https://github.com/OpenDevin/OpenDevin/pull/481#issuecomment-2046139344
Ok, this export seems to work π It starts !
Ok, this export seems to work π It starts !
I tried the export, at first it seemed like it worked, but then I got this again: Exception: Failed to create opendevin user in sandbox: b'useradd: UID 0 is not unique\n'
Can I just add the SANDBOX_USER_ID into the config?
Can I just add the SANDBOX_USER_ID into the config?
s
This is the cause. https://github.com/OpenDevin/OpenDevin/blob/main/opendevin/sandbox/sandbox.py#L26
When I commented out the following, the issue was resolved.
opendevin/sandbox/sandbox.py
# if config.get_or_none('SANDBOX_USER_ID') is not None:
# USER_ID = int(config.get_or_default('SANDBOX_USER_ID', ''))
# elif hasattr(os, 'getuid'):
# USER_ID = os.getuid()
@sameqb - I am having the below issue around docker not working. Per Discord someone recommended your comment. However on the latest commit, I do not see the line in question. commit e0c7492609bf8ebdbd7270c9e9261bf2944f3bc6 (HEAD -> main, origin/main, origin/HEAD)
opendevin:ERROR: ssh_box.py:61 - Please check Docker is running using docker ps.
16:06:10 - opendevin:ERROR: agent.py:136 - Error creating controller: Error while fetching server API version: ('Connection aborted.', ConnectionRefusedError(61, 'Connection refused'))
Traceback (most recent call last)
Please check Docker is running using
docker ps
@Dexhub
Have modified /opendevin/sandbox/docker/ssh_box.py line 40 to the following, which then allows OpenDevin to run on Ubuntu from Visual Studio Code insiders via a SSH connection
# FIXME: On some containers, the devin user doesn't have enough permission, e.g. to install packages
# How do we make this more flexible?
RUN_AS_DEVIN = config.get('RUN_AS_DEVIN').lower() != 'false'
# Set a default USER_ID to a non-system reserved value
default_user_id = 1001
# Fetch USER_ID from configuration and validate it
sandbox_user_id = config.get('SANDBOX_USER_ID')
if sandbox_user_id and int(sandbox_user_id) > 1000:
USER_ID = int(sandbox_user_id)
else:
# Fallback to os.getuid(), but ensure it's not 0
USER_ID = os.getuid() if os.getuid() > 1000 else default_user_id
`
@Dexhub still you have issues?
Closing as it seems this issue may be resolved. Please feel free to reopen if you are still encountering it.
export WORKSPACE_BASE=$(pwd)/workspace
docker run
-it
--pull=always
--add-host host.docker.internal:host-gateway
-e SANDBOX_USER_ID=1000
-e LLM_API_KEY="ollama"
-e LLM_BASE_URL="http://host.docker.internal:11434"
-e WORKSPACE_MOUNT_PATH=$WORKSPACE_BASE
-v $WORKSPACE_BASE:/opt/workspace_base
-v /var/run/docker.sock:/var/run/docker.sock
-p 3000:3000
ghcr.io/opendevin/opendevin:0.6
run with make run not docker
write nname of llm like in ollama list
ollama/orca-mini:latest
Wait a long time for the form to load llm
export SANDBOX_USER_ID=1000
persist_sandbox=false
config.toml [core] workspace_base="./workspace" persist_sandbox=false SANDBOX_USER_ID=1000
[llm] model="ollama/orca-mini:latest" api_key="ollama" base_url="http://127.0.0.1:11434" embedding_model=""
sudo vi /etc/systemd/system/ollama.service
or
sudo nano /etc/systemd/system/ollama.service
In the [Service] bracket add these lines
Environment="OLLAMA_HOST=0.0.0.0:11434" Environment="OLLAMA_ORIGINS=*" Then save, reload the configuration and restart the service.
sudo systemctl daemon-reload sudo systemctl restart ollama
conda activate with python 3.11
https://opendevin.github.io/OpenDevin/modules/usage/llms/localLLMs
curl -L -O "https://github.com/conda-forge/miniforge/releases/latest/download/Miniforge3-$(uname)-$(uname -m).sh" bash Miniforge3-$(uname)-$(uname -m).sh
conda create --name work python=3.11 conda activate work