pexpect.pxssh.ExceptionPxssh: Could not establish connection to host
Describe the bug
After running 'make run' in the console and changing configType.RUN_AS_DEVIN to be true, the connection fails and Devin agents cannot be initialized
Setup and configuration
Current version:
commit 6e566dd21dc4f93475fd5b8e601d301226a12f2f (HEAD -> main, origin/main, origin/HEAD)
Author: Yufan Song <[email protected]>
Date: Mon Apr 8 02:23:25 2024 -0700
fix: change default RUN_AS_DEVIN to true and change some network setting (#895)
* fix use devin
* fix port problem
My config.toml and environment vars (be sure to redact API keys):
LLM_MODEL="gpt-3.5-turbo-1106"
LLM_API_KEY="<Redacted>"
LLM_EMBEDDING_MODEL=""
WORKSPACE_DIR="./workspace"
My model and agent (you can see these settings in the UI):
- Model: NA
- Agent: NA
- Yet to load as it is stuck in the initializing agent stage
Commands I ran to install and run OpenDevin:
> Installing Python 3.11, and other requirements using windows WSL2
make build
make run
Steps to Reproduce:
- make build
- make run
Logs, error messages, and screenshots:
Additional Context
File "/mnt/../opendevin/server/agent/manager.py", line 125, in create_controller self.controller = AgentController( ^^^^^^^^^^^^^^^^ File "/mnt/../opendevin/controller/agent_controller.py", line 86, in init self.command_manager = CommandManager( ^^^^^^^^^^^^^^^ File "/mnt/../OpenDevin/opendevin/controller/command_manager.py", line 14, in init self.shell = DockerInteractive( ^^^^^^^^^^^^^^^^^^ File "/mnt/../OpenDevin/opendevin/sandbox/sandbox.py", line 139, in init self.start_ssh_session() File "/mnt/../opendevin/sandbox/sandbox.py", line 167, in start_ssh_session self.ssh.login(hostname, username, self._ssh_password, port=2222) File "/home/user/.cache/pypoetry/virtualenvs/opendevin-RHnpmKt7-py3.11/lib/python3.11/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
you need to restart your container for that.
btw the very recent pr https://github.com/OpenDevin/OpenDevin/pull/891 solved this problem also.
I have restarted the docker container using the docker restart
I have the same issue。Mac M1. I find that the SSH server did not start successfully, because the port 2222 have no server listened.
Closing in favor of https://github.com/OpenDevin/OpenDevin/issues/889
Closing in favor of #889
Hi, @rbren - I have followed your link to #889 - but I don't see any solution - only a link this this problem #902 . Have I missed something ? I have the same problem on Ubuntu 22.04 machines (I tried both PCs at work & and at home)
The log is similar (used the new docker installation method):
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:main 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:57772 - "GET / HTTP/1.1" 307 Temporary Redirect INFO: ('172.17.0.1', 57774) - "WebSocket /ws?token=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzaWQiOiJjMjExOWFiMC1mODNjLTQyN2MtOThiZS0xY2U2NGE2MGU5YzgifQ.IyhFR_p_kwlxl9Tz7BJ1comyau8xNujK86IMyKEEZGA" [accepted] INFO: connection open Starting loop_recv for sid: c2119ab0-f83c-427c-98be-1ce64a60e9c8 INFO: 172.17.0.1:57790 - "GET /api/refresh-files HTTP/1.1" 200 OK INFO: 172.17.0.1:57790 - "GET /api/messages/total HTTP/1.1" 200 OK INFO: 172.17.0.1:57790 - "GET /api/messages/total HTTP/1.1" 200 OK 10:33:25 - opendevin:INFO: llm.py:25 - Initializing LLM with model: gpt-3.5-turbo 10:33:25 - opendevin:INFO: ssh_box.py:271 - Container stopped 10:33:25 - 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. 10:33:26 - opendevin:INFO: ssh_box.py:309 - Container started 10:33:27 - opendevin:INFO: ssh_box.py:326 - waiting for container to start: 1, container status: running 10:33:27 - opendevin:INFO: ssh_box.py:161 - Connecting to [email protected] via ssh. If you encounter any issues, you can tryssh -v -p 34551 [email protected]` with the password '2b64c787-075f-4d53-bb58-3e54a1351da4' and report the issue on GitHub.
10:33:27 - opendevin:ERROR: agent.py:123 - Error creating controller: Could not establish connection to host
Traceback (most recent call last):
File "/app/opendevin/server/agent/agent.py", line 114, in create_controller
self.controller = AgentController(
^^^^^^^^^^^^^^^^
File "/app/opendevin/controller/agent_controller.py", line 47, in init
self.action_manager = ActionManager(self.id, container_image)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/app/opendevin/controller/action_manager.py", line 36, 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
Here is the ouput of "docker ps":
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
3abebca26d36 ghcr.io/opendevin/sandbox "/usr/sbin/sshd -D -…" 13 minutes ago Up 13 minutes 0.0.0.0:34551->34551/tcp, :::34551->34551/tcp opendevin-sandbox-c2119ab0-f83c-427c-98be-1ce64a60e9c8
86bde131c3e3 ghcr.io/opendevin/opendevin:main "uvicorn opendevin.s…" 13 minutes ago Up 13 minutes 0.0.0.0:3000->3000/tcp, :::3000->3000/tcp elegant_bhabha
`
@hungson175 Please try adding to config.toml: SANDBOX_TYPE=exec
Sorry, new canonical issue is here: https://github.com/OpenDevin/OpenDevin/issues/1156
same error on Ubuntu 22.04 but before this error i also added 127.0.0.1 host.docker.internal in the hosts file because the docker desktop install only ads 127.0.0.1 kubernetes.docker.internal to this file