SOLVED: Can't access hassio command line from hass.io installed on Ubuntu

Hi all,

I’m having problems accessing the hass.io gui and need to do some restarts from the command line, but I cannot find the hass command referenced here

anywhere. I don’t see it on the base Ubuntu machine, in the hass.io supervisor container, or in the homeassistant container. I followed the standard hass.io on linux install instructions from here

and so far everything has worked fine as long as I was managing it from the GUI (which is not an option now).

Any ideas? Can I install this cli tool separately?

Did you set up SSH addon in Hassio? I think you can run /bin/bash from the home assistant docker container.

No, I have SSH set up directly to the host machine… I thought it would be enough… I can get a command line to the host machine, supervisor, or homeassistant containers. Does it set up some other mysterious virtual environment if you use the SSH addon?

I think

docker exec -it homeassistant /bin/bash

will start a shell in the docker container. With the ssh addon you can ssh over port 2222, I believe

1 Like

Yes, I have no problem getting a shell into the homeassistant docker container, but within that container I can find no hassio command…

This is the correct answer; I just did it last night as a matter of fact and it worked flawlessly. Install the OpenSSH add-on, set the password then port to 2222 (instead of 22). In your ssh client of choice, ensure you change the port to 2222, punch in the IP of your ubuntu host and it’ll map the session straight to the Hass.io CLI.

Or from a terminal prompt;

ssh -p 2222 username@ipaddress

That’s exactly what I do.

What exactly am I sshing into if I install the SSH addon if it’s not the homeassistant or hass-supervisor containers or base Ubuntu system? I don’t really relish the idea of 2 different ssh daemons running on my system, and I’m not sure that this would even work without mapping ports out of the docker container… But I suppose I will try it…

it creates another docker container that hosts the hassio-cli environment and sends commands to the main homeassistant instance. It does seem a little heavyweight for that, but that’s how it works.

I was poking around in the source code for hassio-cli today for something else, but I guess you could just build it yourself and use it from anywhere.

1 Like

Okay, that makes sense then… Thanks for the clarification, it’s always nice to have some idea what you are actually doing when you do things ;-).

Unfortunately as I had to just bounce the homeassistant docker container in the absence of any better method to get it to accept a new config to get access to the gui again, now my hass.io menu has disappeared so no add-on action until I bounce the whole server (unless you know how to get it reconnected to the hassio-supervisor)…

I’ll do it tomorrow, it’s getting late here…

Perhaps the cli is in the supervisor container. Hassio only installs those two het the cli is there

It’s not in the supervisor. That was my first thought as well, but you can start a shell in that container and it’s nowhere to be found. It really does create another Docker container for it as part of the ssh add-on installation.

2 Likes

I just verified that with a HassOs VM. The cli command in the ssh container appears to be hass.

EDIT: I just restarted the entire host system, and it ‘magically’ came right. Thanks guys!

when I try: docker exec -it homeassistant /bin/bash

I get: Error: No such container: homeassistant

But when I go docker ps I see it:

albert@hotelalpha:~$ docker ps
CONTAINER ID        IMAGE                                        COMMAND                  CREATED             STATUS              PORTS                                                                NAMES
daf57b2bce5f        esphome/esphome-hassio-amd64:1.13.6          "/init"                  53 minutes ago      Up 53 minutes                                                                            addon_15ef4d2f_esphome
07bae02f25e0        homeassistant/amd64-addon-configurator:3.4   "/run.sh"                53 minutes ago      Up 53 minutes                                                                            addon_core_configurator
bd519457f886        homeassistant/amd64-addon-samba:8.1          "/run.sh"                55 minutes ago      Up 55 minutes                                                                            addon_core_samba
0d09ae80d4fb        homeassistant/amd64-addon-mosquitto:4.3      "/run.sh"                55 minutes ago      Up 55 minutes       0.0.0.0:1883-1884->1883-1884/tcp, 0.0.0.0:8883-8884->8883-8884/tcp   addon_core_mosquitto
4a15c2b64da1        homeassistant/amd64-hassio-dns:1             "coredns -conf /conf…"   55 minutes ago      Up 55 minutes                                                                            hassio_dns
8cb80a8e7040        homeassistant/amd64-hassio-supervisor        "/bin/entry.sh pytho…"   14 hours ago        Up 55 minutes                                                                            hassio_supervisor
2dce2ac4a1ec        homeassistant/qemux86-64-homeassistant       "/bin/entry.sh pytho…"   22 hours ago        Up 44 minutes                                                                            homeassistant
albert@hotelalpha:~$ docker exec -it homeassistant /bin/bash
Error: No such container: homeassistant
albert@hotelalpha:~$ docker exec -it 2dce2ac4a1ec /bin/bash
Error: No such container: 2dce2ac4a1ec
albert@hotelalpha:~$

Cmon! Jeez!

EDIT: I just restarted the entire host system, and it ‘magically’ came right. Thanks guys!

Have you tried running as sudo?

yes, sorry, I tried that also.

Edit: resolved, see my orig post.