Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] Exception: Failed to create opendevin user in sandbox: b'useradd: UID 0 is not unique\n' #936

Open
tintin92350 opened this issue Apr 9, 2024 · 22 comments
Labels
bug Something isn't working severity:medium Problems that affect many users

Comments

@tintin92350
Copy link

tintin92350 commented Apr 9, 2024

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:

  1. make run
  2. Go to the UI

Logs, error messages, and screenshots:

image

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 
@tintin92350 tintin92350 added the bug Something isn't working label Apr 9, 2024
@ioana11023
Copy link

I'm facing the same issue.

@LuoDongK
Copy link

LuoDongK commented Apr 9, 2024

me too. My os is macOS. Apple Chip(M1)

@wmitnaj
Copy link

wmitnaj commented Apr 9, 2024

I am also running open devin in a WSL (ubuntu) on windows 11 and I get the same error message. Any workarounds?

@tintin92350
Copy link
Author

Has this version been tested with a specific version of Docker? In the requirements, it's simply Docker without any version.

@sameqb
Copy link

sameqb commented Apr 9, 2024

I'm facing the same issue.

@mohammedrbaker
Copy link

Same problem here too. Any help please ?

@UnclePi979
Copy link

Did you run the command sudo make run? Try changing to make run.

@wmitnaj
Copy link

wmitnaj commented Apr 9, 2024

Did you run the command sudo make run? Try changing to make 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

@tintin92350
Copy link
Author

mmmh in fact may be we need to run docker in rootless ?

@UnclePi979
Copy link

Did you run the command sudo make run? Try changing to make 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' ?

@rbren rbren added the severity:medium Problems that affect many users label Apr 9, 2024
@cmhello88
Copy link

cmhello88 commented Apr 9, 2024

me too,My Os is CentOS7.9

@a18792721831
Copy link

me too!

@fuchsia74
Copy link

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

@SmartManoj
Copy link
Collaborator

SmartManoj commented Apr 10, 2024

export SANDBOX_USER_ID=1000 and run again

#481 (comment)

@tintin92350
Copy link
Author

Ok, this export seems to work 👍 It starts !

@wmitnaj
Copy link

wmitnaj commented Apr 10, 2024

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?

@SmartManoj
Copy link
Collaborator

Can I just add the SANDBOX_USER_ID into the config?

s

@sameqb
Copy link

sameqb commented Apr 10, 2024

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()

@Dexhub
Copy link

Dexhub commented Apr 12, 2024

@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 e0c7492 (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)

@SmartManoj
Copy link
Collaborator

Please check Docker is running using docker ps

@Dexhub

@Richardjbrain
Copy link

Richardjbrain commented Apr 22, 2024

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
`

@SmartManoj
Copy link
Collaborator

@Dexhub still you have issues?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working severity:medium Problems that affect many users
Projects
None yet
Development

No branches or pull requests