OpenHands icon indicating copy to clipboard operation
OpenHands copied to clipboard

sshd not found

Open cardoza1991 opened this issue 1 year ago • 12 comments

I have all necessary dependencies installed and running as necessary. michael@megatron:~/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:latest 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:45932 - "GET / HTTP/1.1" 307 Temporary Redirect INFO: 172.17.0.1:45932 - "GET /index.html HTTP/1.1" 304 Not Modified INFO: 172.17.0.1:45932 - "GET /assets/index-C089YNx-.js HTTP/1.1" 304 Not Modified INFO: 172.17.0.1:45946 - "GET /assets/index-C3qOtGcN.css HTTP/1.1" 304 Not Modified INFO: ('172.17.0.1', 45948) - "WebSocket /ws?token=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzaWQiOiJmZjI4ZTZlNy1iMTQ0LTRiNGYtOWU5NS1hYjk0N2VmNjNiMDEifQ.xtBvYb6dwokdpUAoUftSwgQnwLD1_gyjnKL-PK8CFSQ" [accepted] INFO: connection open Starting loop_recv for sid: ff28e6e7-b144-4b4f-9e95-ab947ef63b01 INFO: 172.17.0.1:45946 - "GET /locales/en/translation.json HTTP/1.1" 304 Not Modified INFO: 172.17.0.1:45946 - "GET /api/refresh-files HTTP/1.1" 200 OK INFO: 172.17.0.1:45946 - "GET /api/configurations HTTP/1.1" 200 OK INFO: 172.17.0.1:45932 - "GET /api/messages/total HTTP/1.1" 200 OK 00:18:27 - opendevin:INFO: ssh_box.py:271 - Container stopped 00:18:27 - 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. 00:18:28 - opendevin:ERROR: ssh_box.py:311 - Failed to start container 00:18:28 - opendevin:ERROR: agent.py:127 - Error creating controller: 400 Client Error for http+docker://localhost/v1.43/containers/a03a0fd2249fe296fb143e0e70eea3bf159093031a1c71004f45082e281d39c7/start: Bad Request ("failed to create task for container: failed to create shim task: OCI runtime create failed: runc create failed: unable to start container process: exec: "/usr/sbin/sshd": stat /usr/sbin/sshd: no such file or directory: unknown") Traceback (most recent call last): File "/app/.venv/lib/python3.12/site-packages/docker/api/client.py", line 265, in _raise_for_status response.raise_for_status() File "/app/.venv/lib/python3.12/site-packages/requests/models.py", line 1021, in raise_for_status raise HTTPError(http_error_msg, response=self) requests.exceptions.HTTPError: 400 Client Error: Bad Request for url: http+docker://localhost/v1.43/containers/a03a0fd2249fe296fb143e0e70eea3bf159093031a1c71004f45082e281d39c7/start

The above exception was the direct cause of the following exception:

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 87, in init self.restart_docker_container() File "/app/opendevin/sandbox/ssh_box.py", line 312, in restart_docker_container raise ex File "/app/opendevin/sandbox/ssh_box.py", line 293, in restart_docker_container self.container = self.docker_client.containers.run( ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/app/.venv/lib/python3.12/site-packages/docker/models/containers.py", line 880, in run container.start() File "/app/.venv/lib/python3.12/site-packages/docker/models/containers.py", line 417, in start return self.client.api.start(self.id, **kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/app/.venv/lib/python3.12/site-packages/docker/utils/decorators.py", line 19, in wrapped return f(self, resource_id, *args, **kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/app/.venv/lib/python3.12/site-packages/docker/api/container.py", line 1135, in start self._raise_for_status(res) File "/app/.venv/lib/python3.12/site-packages/docker/api/client.py", line 267, in _raise_for_status raise create_api_error_from_http_exception(e) from e ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/app/.venv/lib/python3.12/site-packages/docker/errors.py", line 39, in create_api_error_from_http_exception raise cls(e, response=response, explanation=explanation) from e docker.errors.APIError: 400 Client Error for http+docker://localhost/v1.43/containers/a03a0fd2249fe296fb143e0e70eea3bf159093031a1c71004f45082e281d39c7/start: Bad Request ("failed to create task for container: failed to create shim task: OCI runtime create failed: runc create failed: unable to start container process: exec: "/usr/sbin/sshd": stat /usr/sbin/sshd: no such file or directory: unknown")

What could the issue be? I checked the docker container with f6321c673c4e:/app# ls -l /usr/sbin/sshd

-rwxr-xr-x 1 root root 1261336 Dec 19 14:51 /usr/sbin/sshd

root@f6321c673c4e:/app# the /usr/sbin/sshd exists in the right area and has the correct permissions. Screenshot from 2024-04-15 20-21-55

cardoza1991 avatar Apr 16 '24 00:04 cardoza1991

Docker container is running. (base) michael@megatron:~/OpenDevin$ docker ps CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES eef5651de99a ghcr.io/opendevin/opendevin:latest "uvicorn opendevin.s…" 5 minutes ago Up 5 minutes 0.0.0.0:3000->3000/tcp, :::3000->3000/tcp sad_jackson

cardoza1991 avatar Apr 16 '24 00:04 cardoza1991

Getting the same issue on mac, not able to run it at all. Any quick resolution will help

AtulGargMT avatar Apr 16 '24 07:04 AtulGargMT

I checked the docker container with f6321c673c4e

eef5651de99a

Both are different

SmartManoj avatar Apr 16 '24 12:04 SmartManoj

Yeah it would be different. It's called container IDs they'd be different.

cardoza1991 avatar Apr 16 '24 13:04 cardoza1991

@cardoza1991 thanks for the report. Can you tell us more about your operating system and environment? Are there any security controls in place?

In the future, filling out the bug template is very helpful

rbren avatar Apr 16 '24 17:04 rbren

@cardoza1991 thanks for the report. Can you tell us more about your operating system?

In the future, filling out the bug template is very helpful

Yeah I am using Ubuntu 22.04 LTS desktop not the server

cardoza1991 avatar Apr 16 '24 17:04 cardoza1991

Is it possible there are some security controls in place that might prevent access to sshd?

rbren avatar Apr 16 '24 17:04 rbren

For more clarity, the problem is on this line: https://github.com/OpenDevin/OpenDevin/blob/7710112ae284ae9b988f2ac4729194fbb21ecefc/opendevin/sandbox/ssh_box.py#L293

We are trying to start a container running sshd. This usually works, but for some reason not in your env...

rbren avatar Apr 16 '24 17:04 rbren

For now, adding -e SANDBOX_TYPE=exec should fix it

rbren avatar Apr 16 '24 17:04 rbren

Is it possible there are some security controls in place that might prevent access to sshd?

not that I am aware of.

cardoza1991 avatar Apr 17 '24 13:04 cardoza1991

For now, adding -e SANDBOX_TYPE=exec should fix it

good news is it ran successfully.

docker run
-e LLM_API_KEY
-e WORKSPACE_MOUNT_PATH=/home/michael/the-reserves
-v $WORKSPACE_DIR:/opt/workspace_base
-v /var/run/docker.sock:/var/run/docker.sock
-p 3001:3000
ghcr.io/opendevin/opendevin:latest I added the -e SANDBOX_TYPE=exec as shown above. it runs on my system successfully. Ubuntu 22.04 lts, Ubuntu Desktop

cardoza1991 avatar Apr 17 '24 13:04 cardoza1991

I had port 3000 bound to another program. So I added 3001:3000

cardoza1991 avatar Apr 17 '24 13:04 cardoza1991

Sounds like this is fixed!

rbren avatar Apr 17 '24 17:04 rbren