OpenHands icon indicating copy to clipboard operation
OpenHands copied to clipboard

[Bug]: SANDBOX_USER_ID cannot be 0. Please run with a different user id.

Open zGamerZz opened this issue 1 year ago • 12 comments

Is there an existing issue for the same bug?

  • [X] I have checked the troubleshooting document at https://opendevin.github.io/OpenDevin/modules/usage/troubleshooting
  • [X] I have checked the existing issues.

Describe the bug

Hey, when I try to run OpenDevin with the official actual cmd this Error comes:

SANDBOX_USER_ID cannot be 0. Please run with a different user id.

How can I run with a different user id?

Current Version

0.5.0

Installation and Configuration

#The directory you want OpenDevin to modify. MUST be an absolute path!
export WORKSPACE_BASE=$(pwd)/workspace;

docker run \
    --pull=always \
    -e SANDBOX_USER_ID=$(id -u) \
    -e WORKSPACE_MOUNT_PATH=$WORKSPACE_BASE \
    -v $WORKSPACE_BASE:/opt/workspace_base \
    -v /var/run/docker.sock:/var/run/docker.sock \
    -p 3000:3000 \
    --add-host host.docker.internal:host-gateway \
    ghcr.io/opendevin/opendevin:0.5

Model and Agent

No response

Reproduction Steps

  1. Type the cmd
  2. the error

Logs, Errors, Screenshots, and Additional Context

No response

zGamerZz avatar May 07 '24 17:05 zGamerZz

@zGamerZz sounds like you're logged in as root. Do you typically work as the root user? What's your OS?

rbren avatar May 07 '24 18:05 rbren

@zGamerZz sounds like you're logged in as root. Do you typically work as the root user? What's your OS?

@rbren I´m on Windows but use Ubuntu via WSL as root user

zGamerZz avatar May 07 '24 19:05 zGamerZz

SANDBOX_USER_ID cannot be 0. Please run with a different user id. me too,I´m on Centos7.9

baoge2778 avatar May 08 '24 07:05 baoge2778

same here on Ubuntu 22

Beamaccount avatar May 08 '24 13:05 Beamaccount

Try docker run \ --pull=always \ -e SANDBOX_USER_ID=1000 \ -e WORKSPACE_MOUNT_PATH=$WORKSPACE_BASE \ -v $WORKSPACE_BASE:/opt/workspace_base \ -v /var/run/docker.sock:/var/run/docker.sock \ -p 3000:3000 \ --add-host host.docker.internal:host-gateway \ ghcr.io/opendevin/opendevin:0.5

aj47 avatar May 08 '24 15:05 aj47

Hey all, I have a proposed fix here, which allows running as root (which should work better than aj47's workaround)

Can you try running with tag 1651-merge (instead of 0.5) and see if it works any better?

rbren avatar May 08 '24 16:05 rbren

(CC @zGamerZz @Beamaccount @baoge2778)

rbren avatar May 08 '24 16:05 rbren

(抄送@zGamerZz @Beamaccount @baoge2778)

docker run
--pull=always
-e SANDBOX_USER_ID=$(id -u)
-e WORKSPACE_MOUNT_PATH=$WORKSPACE_BASE
-v $WORKSPACE_BASE:/opt/workspace_base
-v /var/run/docker.sock:/var/run/docker.sock
-p 3000:3000
--add-host host.docker.internal:host-gateway
ghcr.io/opendevin/opendevin:1651-merge

It worked. But other errors occurred after starting the container

06:09:21 - opendevin:ERROR: ssh_box.py:224 - Command timed out, killing process... 06:09:51 - opendevin:ERROR: agent.py:138 - Error creating controller: Failed to source ~/.bashrc with exit code -1 and output Command: "source ~/.bashrc" timed out. Sending SIGINT to the process: root@45731512d9b8:/workspace# ^C root@45731512d9b8:/workspace# Traceback (most recent call last): File "/app/opendevin/server/agent/agent.py", line 130, in create_controller self.controller = AgentController( ^^^^^^^^^^^^^^^^ File "/app/opendevin/controller/agent_controller.py", line 82, in init self.action_manager.init_sandbox_plugins(agent.sandbox_plugins) File "/app/opendevin/controller/action_manager.py", line 48, in init_sandbox_plugins self.sandbox.init_plugins(plugins) File "/app/opendevin/runtime/plugins/mixin.py", line 47, in init_plugins raise RuntimeError( RuntimeError: Failed to source ~/.bashrc with exit code -1 and output Command: "source ~/.bashrc" timed out. Sending SIGINT to the process: root@45731512d9b8:/workspace# ^C root@45731512d9b8:/workspace#

baoge2778 avatar May 09 '24 06:05 baoge2778

Try docker run \ --pull=always \ -e SANDBOX_USER_ID=1000 \ -e WORKSPACE_MOUNT_PATH=$WORKSPACE_BASE \ -v $WORKSPACE_BASE:/opt/workspace_base \ -v /var/run/docker.sock:/var/run/docker.sock \ -p 3000:3000 \ --add-host host.docker.internal:host-gateway \ ghcr.io/opendevin/opendevin:0.5

This is working for me thank you :)

zGamerZz avatar May 09 '24 09:05 zGamerZz

@baoge2778 can you open a new issue for your new problem? If you could fill out the template and mention you're running as root that would be helpful

rbren avatar May 09 '24 13:05 rbren

actually @baoge2778 scratch that--seems @zGamerZz was using the SANDBOX_USER_ID=1000 workaround, which will likely cause other issues (all files written by OpenDevin will have the wrong permissions/ownership)

rbren avatar May 09 '24 13:05 rbren

@baoge2778 can you open a new issue for your new problem? If you could fill out the template and mention you're running as root that would be helpful

ok.https://github.com/OpenDevin/OpenDevin/issues/1682

baoge2778 avatar May 10 '24 02:05 baoge2778