OpenHands icon indicating copy to clipboard operation
OpenHands copied to clipboard

pexpect/ssh issue when running Docker

Open talentlo opened this issue 10 months ago • 32 comments

use docker,the chatbox "Error creating controller. Please check Docker is running using docker ps."

the docker logs:

INFO: Started server process [1] INFO: Waiting for application startup. INFO: Application startup complete. INFO: Uvicorn running on http://0.0.0.0:3000 (Press CTRL+C to quit) INFO: ('172.28.186.18', 64210) - "WebSocket /ws?token=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzaWQiOiJiY2FkMjQ5Ny02MzRjLTRkYzMtOGNjZi05NDA0MDJjNjRhOTEifQ.i_NEUWhxv2c9FhioADWKAsbXs09FP23Own8u8PiKb48" [accepted] INFO: connection open Starting loop_recv for sid: bcad2497-634c-4dc3-8ccf-940402c64a91 INFO: 172.28.186.18:64213 - "GET /api/messages/total HTTP/1.1" 200 OK INFO: 172.28.186.18:64212 - "GET /api/configurations HTTP/1.1" 200 OK 08:03:20 - opendevin:INFO: ssh_box.py:271 - Container stopped 08:03:20 - opendevin:WARNING: ssh_box.py:283 - Using port forwarding for Mac OS. Server started by OpenDevin will not be accessible from the host machine at the moment. See https://github.com/OpenDevin/OpenDevin/issues/897 for more information. 08:03:21 - opendevin:INFO: ssh_box.py:309 - Container started 08:03:22 - opendevin:INFO: ssh_box.py:326 - waiting for container to start: 1, container status: running 08:03:22 - opendevin:INFO: ssh_box.py:161 - Connecting to [email protected] via ssh. If you encounter any issues, you can try ssh -v -p 43729 [email protected] with the password 'ec60e3dc-d024-4667-bf91-61e6e42f14e8' and report the issue on GitHub. 08:03:23 - opendevin:ERROR: agent.py:127 - Error creating controller: Could not establish connection to host Traceback (most recent call last): File "/app/opendevin/server/agent/agent.py", line 118, in create_controller self.controller = AgentController( ^^^^^^^^^^^^^^^^ File "/app/opendevin/controller/agent_controller.py", line 91, in init self.command_manager = CommandManager(self.id, container_image) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/app/opendevin/controller/command_manager.py", line 26, in init self.shell = DockerSSHBox( ^^^^^^^^^^^^^ File "/app/opendevin/sandbox/ssh_box.py", line 90, in init self.start_ssh_session() File "/app/opendevin/sandbox/ssh_box.py", line 164, in start_ssh_session self.ssh.login(hostname, username, self._ssh_password, File "/app/.venv/lib/python3.12/site-packages/pexpect/pxssh.py", line 424, in login raise ExceptionPxssh('Could not establish connection to host') pexpect.pxssh.ExceptionPxssh: Could not establish connection to host Mounting workspace directory: /root/work_lcg/OpenDevinDocker INFO: 172.28.186.18:64231 - "GET /index.html HTTP/1.1" 304 Not Modified 08:04:03 - opendevin:INFO: session.py:39 - WebSocket disconnected, sid: bcad2497-634c-4dc3-8ccf-940402c64a91 INFO: connection closed INFO: ('172.28.186.18', 64233) - "WebSocket /ws?token=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzaWQiOiJiY2FkMjQ5Ny02MzRjLTRkYzMtOGNjZi05NDA0MDJjNjRhOTEifQ.i_NEUWhxv2c9FhioADWKAsbXs09FP23Own8u8PiKb48" [accepted] INFO: connection open Starting loop_recv for sid: bcad2497-634c-4dc3-8ccf-940402c64a91 INFO: 172.28.186.18:64231 - "GET /locales/zh/translation.json HTTP/1.1" 404 Not Found INFO: 172.28.186.18:64231 - "GET /api/refresh-files HTTP/1.1" 200 OK INFO: 172.28.186.18:64232 - "GET /api/messages/total HTTP/1.1" 200 OK INFO: 172.28.186.18:64231 - "GET /api/configurations HTTP/1.1" 200 OK 08:04:05 - opendevin:INFO: ssh_box.py:271 - Container stopped 08:04:05 - opendevin:WARNING: ssh_box.py:283 - Using port forwarding for Mac OS. Server started by OpenDevin will not be accessible from the host machine at the moment. See https://github.com/OpenDevin/OpenDevin/issues/897 for more information. 08:04:05 - opendevin:INFO: ssh_box.py:309 - Container started 08:04:06 - opendevin:INFO: ssh_box.py:326 - waiting for container to start: 1, container status: running 08:04:07 - opendevin:INFO: ssh_box.py:161 - Connecting to [email protected] via ssh. If you encounter any issues, you can try ssh -v -p 53149 [email protected] with the password 'ff06749c-5f4f-4313-85c2-762906ed6daf' and report the issue on GitHub. 08:04:08 - opendevin:ERROR: agent.py:127 - Error creating controller: Could not establish connection to host Traceback (most recent call last): File "/app/opendevin/server/agent/agent.py", line 118, in create_controller self.controller = AgentController( ^^^^^^^^^^^^^^^^ File "/app/opendevin/controller/agent_controller.py", line 91, in init self.command_manager = CommandManager(self.id, container_image) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/app/opendevin/controller/command_manager.py", line 26, in init self.shell = DockerSSHBox( ^^^^^^^^^^^^^ File "/app/opendevin/sandbox/ssh_box.py", line 90, in init self.start_ssh_session() File "/app/opendevin/sandbox/ssh_box.py", line 164, in start_ssh_session self.ssh.login(hostname, username, self._ssh_password, File "/app/.venv/lib/python3.12/site-packages/pexpect/pxssh.py", line 424, in login raise ExceptionPxssh('Could not establish connection to host') pexpect.pxssh.ExceptionPxssh: Could not establish connection to host Mounting workspace directory: /root/work_lcg/OpenDevinDocker INFO: 172.28.186.18:64231 - "GET /api/messages HTTP/1.1" 200 OK

talentlo avatar Apr 16 '24 08:04 talentlo

Getting exactly the same error when trying to start opendevin in docker in a windows 11 wsl ubuntu environment

wmitnaj avatar Apr 16 '24 10:04 wmitnaj

@wmitnaj that's helpful, I'm surprised to hear that docker on WSL has this problem

Setting -e SANDBOX_TYPE=exec may fix the issue for now

rbren avatar Apr 16 '24 17:04 rbren

@talentlo, In latest version also, you getting this error?

SmartManoj avatar Apr 17 '24 04:04 SmartManoj

I tried the new docker image today and the problem is still there

02:34:57 - opendevin:ERROR: agent.py:127 - Error creating controller: Could not establish connection to host Traceback (most recent call last): File "/app/opendevin/server/agent/agent.py", line 118, in create_controller self.controller = AgentController( ^^^^^^^^^^^^^^^^ File "/app/opendevin/controller/agent_controller.py", line 91, in init self.command_manager = CommandManager(self.id, container_image) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/app/opendevin/controller/command_manager.py", line 26, in init self.shell = DockerSSHBox( ^^^^^^^^^^^^^ File "/app/opendevin/sandbox/ssh_box.py", line 90, in init self.start_ssh_session() File "/app/opendevin/sandbox/ssh_box.py", line 164, in start_ssh_session self.ssh.login(hostname, username, self._ssh_password, File "/app/.venv/lib/python3.12/site-packages/pexpect/pxssh.py", line 424, in login raise ExceptionPxssh('Could not establish connection to host') pexpect.pxssh.ExceptionPxssh: Could not establish connection to host

talentlo avatar Apr 18 '24 02:04 talentlo

@talentlo, In latest version also, you getting this error?

@SmartManoj yes,the problem is still there

talentlo avatar Apr 18 '24 03:04 talentlo

I tried recent image from docker and this error is still not resolved. if any of you finds any solutions kindly report here. Regards, Muhammad Razeen Bari

razeenbari avatar Apr 18 '24 14:04 razeenbari

@PierrunoYT seems to have solved the issue by restarting his computer. YMMV

If this works for anyone, please report back

rbren avatar Apr 18 '24 16:04 rbren

@PierrunoYT seems to have solved the issue by restarting his computer. YMMV

If this works for anyone, please report back

I uninstalled WSL and Docker with the help of AI and then installed everything again.

then runned

Here are all the steps to set up OpenDevin on Ubuntu WSL with Python 3.12.3, Node.js v20.12.2, Docker, and all the requirements:

A. Install WSL2 on Windows

  1. Open PowerShell as an administrator.
  2. Run the following command to install WSL2:
    wsl --install
    
  3. Restart your computer when prompted.

B. Install Ubuntu on WSL

  1. Open the Microsoft Store.
  2. Search for "Ubuntu" and select the latest version (e.g., Ubuntu 22.04 LTS).
  3. Click "Install" and wait for the installation to complete.

C. Start Ubuntu and set up your user account

  1. Start Ubuntu from the Start menu.
  2. Wait for the installation to complete and you'll be prompted to create a user account.
  3. Enter a username and password for your Ubuntu user account.

D. Update and upgrade Ubuntu packages

  1. Open the Ubuntu terminal.
  2. Run the following commands to update and upgrade the packages:
    sudo apt update
    sudo apt upgrade
    

E. Install the required dependencies

  1. Install the necessary dependencies with the following command:
    sudo apt install build-essential libssl-dev zlib1g-dev libbz2-dev libreadline-dev libsqlite3-dev wget curl llvm libncurses5-dev libncursesw5-dev xz-utils tk-dev libffi-dev liblzma-dev python3-openssl git software-properties-common
    

F. Install Python 3.12.3

  1. Add the Deadsnakes PPA:
    sudo add-apt-repository ppa:deadsnakes/ppa
    
  2. Press Enter when prompted to continue the process.
  3. Update the package lists:
    sudo apt update
    
  4. Install Python 3.12.3:
    sudo apt install python3.12
    
  5. Verify the Python version:
    python3.12 --version
    
  6. Install pip for Python 3.12.3:
    sudo apt install python3.12-distutils
    curl https://bootstrap.pypa.io/get-pip.py | python3.12
    
  7. Verify the pip version for Python 3.12.3:
    python3.12 -m pip --version
    

G. Install Node.js v20.12.2 with nvm

  1. Install cURL:
    sudo apt-get install curl
    
  2. Download and run the nvm installation script:
    curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.0/install.sh | bash
    
  3. Close and reopen your terminal.
  4. Verify the nvm installation:
    command -v nvm
    
  5. Install Node.js v20.12.2:
    nvm install 20.12.2
    
  6. Set Node.js v20.12.2 as the default version:
    nvm alias default 20.12.2
    
  7. Verify the Node.js and npm versions:
    node -v
    npm -v
    

H. Install Docker

  1. Install Docker with the following commands:
    sudo apt install apt-transport-https ca-certificates curl software-properties-common
    curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg
    echo "deb [arch=amd64 signed-by=/usr/share/keyrings/docker-archive-keyring.gpg] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
    sudo apt update
    sudo apt install docker-ce docker-ce-cli containerd.io
    
  2. Add your user to the Docker group to avoid using sudo with Docker commands:
    sudo usermod -aG docker $USER
    
  3. Log out and log back in for the group changes to take effect.

I. Navigate to the desired directory

  1. Open a terminal in Ubuntu.
  2. Navigate to the directory where you want to set up OpenDevin, e.g.:
    cd /mnt/c/Users/pierr/OpenDevin
    

J. Set up OpenDevin

  1. Set the LLM_API_KEY environment variable with your OpenAI API key or another LLM API key:
    export LLM_API_KEY="sk-..."
    
    Replace "sk-..." with your actual API key.
  2. Set the WORKSPACE_DIR environment variable to the absolute path of the directory that OpenDevin should modify:
    export WORKSPACE_DIR=$(pwd)/workspace
    
    This command sets WORKSPACE_DIR to a directory named workspace in the current directory. You can change the path to your preference, but use an absolute path.

K. Start OpenDevin

  1. Start the OpenDevin Docker container with the following command:
    docker run \
        -e LLM_API_KEY \
        -e WORKSPACE_MOUNT_PATH=$WORKSPACE_DIR \
        -v $WORKSPACE_DIR:/opt/workspace_base \
        -v /var/run/docker.sock:/var/run/docker.sock \
        -p 3000:3000 \
        ghcr.io/opendevin/opendevin:0.3.1
    
  2. Access the OpenDevin web interface by opening a web browser and navigating to http://localhost:3000.

This should have successfully set up and started OpenDevin on Ubuntu WSL with Python 3.12.3, Node.js v20.12.2, Docker, and all the requirements. You can now start developing and exploring OpenDevin!

Remember to keep your API key secure and not share it publicly or in version control systems.

PierrunoYT avatar Apr 18 '24 16:04 PierrunoYT

@talentlo, https://github.com/OpenDevin/OpenDevin/blob/0356f6ec89b9b9c827fa84dda83903d716cedd85/opendevin/sandbox/docker/ssh_box.py#L163-L167

Did you try that ssh command?

SmartManoj avatar Apr 20 '24 11:04 SmartManoj

I guess this command needs to be run from inside docker... and the issue seems to be the hostname used. Sorry for opening a separate ticket

$ docker exec -ti opendevin-sandbox-03e863eb-5026-47bd-8cd1-ad282cb360cc ssh -v -p 51049 [email protected]
OpenSSH_8.9p1 Ubuntu-3ubuntu0.7, OpenSSL 3.0.2 15 Mar 2022
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: /etc/ssh/ssh_config line 19: include /etc/ssh/ssh_config.d/*.conf matched no files
debug1: /etc/ssh/ssh_config line 21: Applying options for *
ssh: Could not resolve hostname host.docker.internal: Name or service not known

Edit: Oh wait I see that's forwarded on the host. So just adding the hostname to /etc/hosts should do the trick I guess... or just using 127.0.0.1? Or the actual docker image id

dagelf avatar Apr 20 '24 13:04 dagelf

Hey all--we've added a troubleshooting doc for this issue: https://github.com/OpenDevin/OpenDevin/blob/main/docs/guides/Troubleshooting.md#unable-to-connect-to-ssh-box

If there are any Workarounds you've found that are missing there, please open a PR to add them!

rbren avatar Apr 20 '24 13:04 rbren

So it seems there are multiple issues.

  1. The actual port on the ssh container is different. Might be because I ran the docker image twice. --rm in the commandline of the spawning code can fix that.
  2. The hostname doesn't exist on all machines. Refer to the image by its id.

Will try do a PR...

dagelf avatar Apr 20 '24 13:04 dagelf

– - devin imcoming - -

Mike-FreeAI avatar Apr 20 '24 13:04 Mike-FreeAI

Investigation Report for Issue 1156

Summary

Issue 1156 involves a critical bug related to pexpect/ssh when running Docker on WSL, marked with the labels 'bug' and 'severity:critical'. The issue manifests as a failure to establish an SSH connection within the Docker container used by the OpenDevin project.

Steps Taken

  • Cloned the OpenDevin/OpenDevin repository and set up the development environment.
  • Reproduced the pexpect/ssh issue within the Docker environment.
  • Installed localtunnel to expose the local server to the internet for testing purposes.
  • Added detailed print statements to the ssh_box.py file to gain better insight into the SSH connection failure.
  • Attempted a manual SSH connection using the Docker host's IP address, which was successful until password authentication, where access was denied.
  • Discovered that the SSH service within the Docker container was not running.
  • Edited the sshd_config file to enable password authentication and restarted the SSH service.
  • Encountered issues with the SSH service not recognizing the updated configuration for password authentication.
  • Checked for any additional SSH configuration files that might be overriding the PasswordAuthentication setting; none were found.
  • Restarted the Docker container to ensure all services are started with the latest configuration.

Current Status

The Docker container has been restarted, and the SSH service should now be running with the configuration set to allow password authentication. A new attempt to establish an SSH connection is needed to verify if the issue is resolved.

Next Steps

  • Test the SSH connection again after the Docker container restart to confirm if the password authentication is working.
  • If the SSH connection is still not working, investigate other potential causes such as Docker network settings or SSH key configurations.
  • Document all findings and steps in the GitHub repository provided by the user.

Challenges Encountered

  • The Docker container did not have the ss or netstat utilities installed, which are typically used to check network service status.
  • The SSH service did not initially recognize the updated configuration to allow password authentication.
  • Encountered permission issues when attempting to push changes to the GitHub repository.

Additional Notes

  • The localtunnel URL provided is https://thirty-pandas-dress.loca.lt, which will be used for external access to the web application.
  • The Docker container ID is b90a95d2d07d.
  • The SSH service is expected to run on port 22 unless configured otherwise.

PierrunoYT avatar Apr 20 '24 13:04 PierrunoYT

@PierrunoYT aka DEVIN OMG

Mike-FreeAI avatar Apr 20 '24 13:04 Mike-FreeAI

It's slow as hell but it works.

PierrunoYT avatar Apr 20 '24 13:04 PierrunoYT

So adding this fixes it on Ubuntu at least, pretty sure it will resolve WSL too: --add-host host.docker.internal=host-gateway

dagelf avatar Apr 20 '24 13:04 dagelf

It's slow as hell but it works.

That's not slow...... but it should've tried more basic things first, like reading the logs, and checking local IP's and doing reachability checks, and searching existing issues.

Was that run on gpt3.5-turbo?

dagelf avatar Apr 20 '24 13:04 dagelf

if you see this

It's slow as hell but it works.

That's not slow...... but it should've tried more basic things first, like reading the logs, and checking local IP's and doing reachability checks, and searching existing issues.

Was that run on gpt3.5-turbo?

devin wrote that

Mike-FreeAI avatar Apr 20 '24 13:04 Mike-FreeAI

Thank you for the mention. I'm currently working on the issue and will keep you updated on the progress.

are you really devin? if so starcone of my github repos

Mike-FreeAI avatar Apr 20 '24 13:04 Mike-FreeAI

are you really devin? if so star one of my github repos @PierrunoYT

Mike-FreeAI avatar Apr 20 '24 13:04 Mike-FreeAI

reopened

Mike-FreeAI avatar Apr 20 '24 13:04 Mike-FreeAI

🎉 Thanks @dagelf for (I hope) solving this one!

Tl;dr, you should add --add-host host.docker.internal=host-gateway to the docker run command.

rbren avatar Apr 20 '24 13:04 rbren

@Mike-FreeAI does --add-host host.docker.internal=host-gateway not work for you? If that's the case I'll reopen

rbren avatar Apr 20 '24 13:04 rbren

@Mike-FreeAI does --add-host host.docker.internal=host-gateway not work for you? If that's the case I'll reopen

We tried to fix the issue with Devin

PierrunoYT avatar Apr 20 '24 13:04 PierrunoYT

i'm using ubuntu 22.04 (not a WSL2) getting same error

# Your OpenAI API key, or any other LLM API key
#export LLM_API_KEY="sk-..."
export LLM_API_KEY="sk-"
export LLM_MODEL="groq/llama3-70b-8192"
#export LLM_BASE_URL="https://api.groq.com/openai/v1"

# The directory you want OpenDevin to modify. MUST be an absolute path!
export WORKSPACE_BASE=/opt/workspace

docker run \
    -e LLM_API_KEY \
    -e LLM_MODEL \
    -e WORKSPACE_MOUNT_PATH=/opt/workspace \
    -v /opt/workspace:/opt/workspace_base \
    -v /var/run/docker.sock:/var/run/docker.sock \
    --add-host host.docker.internal=host-gateway \
    -p 3000:3000 \
    ghcr.io/opendevin/opendevin:0.3.1
(base) root@server:~# ./opendevin.sh 
INFO:     Started server process [1]
INFO:     Waiting for application startup.
INFO:     Application startup complete.
INFO:     Uvicorn running on http://0.0.0.0:3000 (Press CTRL+C to quit)
INFO:     192.168.1.124:51191 - "GET / HTTP/1.1" 307 Temporary Redirect
INFO:     192.168.1.124:51191 - "GET /api/refresh-files HTTP/1.1" 200 OK
INFO:     192.168.1.124:51191 - "GET /api/litellm-models HTTP/1.1" 200 OK
INFO:     192.168.1.124:51192 - "GET /api/messages/total HTTP/1.1" 200 OK
INFO:     192.168.1.124:51192 - "GET /api/agents HTTP/1.1" 404 Not Found
INFO:     ('192.168.1.124', 51195) - "WebSocket /ws?token=e*******" [accepted]
INFO:     connection open
Starting loop_recv for sid: 4da6f07b-ee2d-41fb-a1b0-3f3f21c1f3fb
INFO:     192.168.1.124:51192 - "GET /api/messages/total HTTP/1.1" 200 OK
18:14:11 - opendevin:INFO: ssh_box.py:271 - Container stopped
18:14:11 - opendevin:WARNING: ssh_box.py:283 - Using port forwarding for Mac OS. Server started by OpenDevin will not be accessible from the host machine at the moment. See https://github.com/OpenDevin/OpenDevin/issues/897 for more information.
18:14:11 - opendevin:INFO: ssh_box.py:309 - Container started
18:14:12 - opendevin:INFO: ssh_box.py:326 - waiting for container to start: 1, container status: exited
18:14:12 - opendevin:INFO: ssh_box.py:318 - container exited
18:14:12 - opendevin:INFO: ssh_box.py:319 - container logs:
18:14:12 - opendevin:INFO: ssh_box.py:320 - b'Missing privilege separation directory: /run/sshd\r\n'
18:14:12 - opendevin:ERROR: agent.py:127 - Error creating controller: Failed to start container
Traceback (most recent call last):
  File "/app/opendevin/server/agent/agent.py", line 118, in create_controller
    self.controller = AgentController(
                      ^^^^^^^^^^^^^^^^
  File "/app/opendevin/controller/agent_controller.py", line 51, in __init__
    self.command_manager = CommandManager(self.id, container_image)
                           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/app/opendevin/controller/command_manager.py", line 26, in __init__
    self.shell = DockerSSHBox(
                 ^^^^^^^^^^^^^
  File "/app/opendevin/sandbox/ssh_box.py", line 87, in __init__
    self.restart_docker_container()
  File "/app/opendevin/sandbox/ssh_box.py", line 331, in restart_docker_container
    raise Exception('Failed to start container')
Exception: Failed to start container
(base) root@server:~# uname -a
Linux server 6.5.0-28-generic #29~22.04.1-Ubuntu SMP PREEMPT_DYNAMIC Thu Apr  4 14:39:20 UTC 2 x86_64 x86_64 x86_64 GNU/Linux 

well, idk it's relevant i'm using sshd(port 22 are already opened, by opensshd)

image

msl2246 avatar Apr 22 '24 18:04 msl2246

Reopening this, as it appears to still be affecting some folks

rbren avatar Apr 23 '24 22:04 rbren

pierruno@Pierruno:/mnt/c/Users/pierr/OpenDevin$ docker run
-e LLM_API_KEY
-e WORKSPACE_MOUNT_PATH=$WORKSPACE_DIR
-v $WORKSPACE_DIR:/opt/workspace_base
-v /var/run/docker.sock:/var/run/docker.sock
-p 3000:3000
ghcr.io/opendevin/opendevin:0.4.0 Unable to find image 'ghcr.io/opendevin/opendevin:0.4.0' locally 0.4.0: Pulling from opendevin/opendevin b0a0cf830b12: Pull complete 72914424168c: Pull complete 80818bc858ed: Pull complete 805c2b19c211: Pull complete 7a89e8daeeae: Pull complete 5978226c46e8: Pull complete 18a065431faa: Pull complete 4a54321ea818: Pull complete ae971a861ecc: Pull complete 53965936ef14: Pull complete f9e7f90d3cb9: Pull complete f6726e7a8de0: Pull complete 6d7f23ac30e6: Pull complete b45b748e127a: Pull complete Digest: sha256:c3b990fc861746feeb3f026a951174f28861909d6f6c8bff5a6e5abdf21481e2 Status: Downloaded newer image for ghcr.io/opendevin/opendevin:0.4.0 INFO: Started server process [1] INFO: Waiting for application startup. INFO: Application startup complete. INFO: Uvicorn running on http://0.0.0.0:3000 (Press CTRL+C to quit) INFO: 172.17.0.1:50460 - "GET / HTTP/1.1" 307 Temporary Redirect INFO: 172.17.0.1:50460 - "GET /index.html HTTP/1.1" 200 OK INFO: 172.17.0.1:50460 - "GET /assets/index-D59teWsw.js HTTP/1.1" 200 OK INFO: 172.17.0.1:50462 - "GET /assets/index-CZQzs2DR.css HTTP/1.1" 200 OK INFO: ('172.17.0.1', 50474) - "WebSocket /ws?token=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzaWQiOiJiMWU1ZDM1My05MDM1LTRiYTEtOGEwMC04NGZmNDU0ZWMxYTEifQ.VHFX1AwnLJprhuTP_CHGpOpUBZNlruNT6Guzt1y2G9k" [accepted] INFO: connection open Starting loop_recv for sid: b1e5d353-9035-4ba1-8a00-84ff454ec1a1 INFO: 172.17.0.1:50462 - "GET /locales/de/translation.json HTTP/1.1" 200 OK INFO: 172.17.0.1:50460 - "GET /locales/en/translation.json HTTP/1.1" 200 OK INFO: 172.17.0.1:50462 - "GET /favicon-32x32.png HTTP/1.1" 200 OK INFO: 172.17.0.1:50460 - "GET /apple-touch-icon.png HTTP/1.1" 200 OK 18:30:10 - opendevin:INFO: agent.py:144 - Creating agent MonologueAgent using LLM gpt-4-0125-preview 18:30:10 - opendevin:INFO: llm.py:51 - Initializing LLM with model: gpt-4-0125-preview 18:30:10 - opendevin:INFO: ssh_box.py:353 - Container stopped 18:30:10 - opendevin:INFO: ssh_box.py:373 - Mounting workspace directory: /mnt/c/Users/pierr/OpenDevin/workspace 18:30:33 - opendevin:INFO: ssh_box.py:396 - Container started 18:30:34 - opendevin:INFO: ssh_box.py:413 - waiting for container to start: 1, container status: running 18:30:34 - opendevin:INFO: ssh_box.py:178 - Connecting to [email protected] via ssh. If you encounter any issues, you can try ssh -v -p 45061 [email protected] with the password '4b113e4d-8215-443b-acd7-f11dc1caa40b' and report the issue on GitHub. 18:30:34 - opendevin:ERROR: agent.py:155 - Error creating controller: Could not establish connection to host Traceback (most recent call last): File "/app/opendevin/server/agent/agent.py", line 147, in create_controller self.controller = AgentController( ^^^^^^^^^^^^^^^^ File "/app/opendevin/controller/agent_controller.py", line 57, in init self.action_manager = ActionManager(self.id) ^^^^^^^^^^^^^^^^^^^^^^ File "/app/opendevin/controller/action_manager.py", line 33, in init self.sandbox = DockerSSHBox( ^^^^^^^^^^^^^ File "/app/opendevin/sandbox/docker/ssh_box.py", line 91, in init self.start_ssh_session() File "/app/opendevin/sandbox/docker/ssh_box.py", line 181, in start_ssh_session self.ssh.login(hostname, username, self._ssh_password, File "/app/.venv/lib/python3.12/site-packages/pexpect/pxssh.py", line 424, in login raise ExceptionPxssh('Could not establish connection to host') pexpect.pxssh.ExceptionPxssh: Could not establish connection to host INFO: 172.17.0.1:50462 - "GET /api/litellm-models HTTP/1.1" 200 OK INFO: 172.17.0.1:50482 - "GET /api/messages/total HTTP/1.1" 200 OK INFO: 172.17.0.1:50494 - "GET /sw.js HTTP/1.1" 404 Not Found INFO: 172.17.0.1:50508 - "GET /workbox-c06b064f.js HTTP/1.1" 404 Not Found INFO: 172.17.0.1:50460 - "GET /api/refresh-files HTTP/1.1" 200 OK INFO: 172.17.0.1:50460 - "GET /api/agents HTTP/1.1" 200 OK INFO: 172.17.0.1:50460 - "GET /sw.js HTTP/1.1" 404 Not Found INFO: 172.17.0.1:50462 - "GET /workbox-c06b064f.js HTTP/1.1" 404 Not Found INFO: 172.17.0.1:50460 - "DELETE /api/messages HTTP/1.1" 200 OK INFO: 172.17.0.1:50462 - "GET /workbox-c06b064f.js HTTP/1.1" 404 Not Found INFO: 172.17.0.1:50460 - "GET /sw.js HTTP/1.1" 404 Not Found

PierrunoYT avatar Apr 25 '24 18:04 PierrunoYT

you can try ssh -v -p 45061 [email protected] with the password '4b113e4d-8215-443b-acd7-f11dc1caa40b' and report the issue on GitHub.

Did you try?

SmartManoj avatar Apr 26 '24 03:04 SmartManoj

There's two different errors here: The original issue here:

opendevin:ERROR: agent.py:155 - Error creating controller: Could not establish connection to host
Traceback (most recent call last):

This one is fixed by --add-host host.docker.internal=host-gateway. Nobody has yet proven otherwise. @PierrunoYT you didn't add this... that's why it's not working. (It looks like)

opendevin:INFO: ssh_box.py:320 - b'Missing privilege separation directory: /run/sshd\r\n'
opendevin:ERROR: agent.py:127 - Error creating controller: Failed to start container
Traceback (most recent call last):

That happens when there is no /run/sshd directory when /usr/sbin/sshd is run... seems to be a containerization or container template issue. (Or permissions or disk full?)

@msl2246 This is a separate issue. I guess seeing as that the final error is the same we can work on this issue here. Does anyone know what the ssh image is created or pulled from, and how to test it separately?

Maybe an mkdir /run/sshd can be added in the ssh container, just to be sure?

dagelf avatar Apr 26 '24 12:04 dagelf