Supervised install docs - how to restart, etc. from the host?

Are there any docs for using the supervised install for common tasks like how to restart it from the host system if necessary?

I did the supervised install, it starts up fine on boot, which is great, but how do I restart it without rebooting the system?

systemctl start hassio-supervisor.service brings back the supervisor container, and hassio_dns, but doesn’t bring back the homeassistant container.

Another systemd unit file was installed hassio-apparmor but that doesn’t seem to start homeassistant either.

Also is there anyway to interact with the supervisor / CLI when homeassistant isn’t running/broken?

Go to the sidebar -> Configuration -> Server Controls -> Restart

I can’t anything from the GUI if homeassistant isn’t running

Let me put it another way. If I stop home assistant from the GUI, how do I get it restarted?

If I need to completely stop home assistant/docker to do some sort of system maint. How do I make sure everything is stopped cleanly and then how do I restart it without rebooting?

FWIW, I’m getting these errors in the log, I’m not sure if these are preventing homeassistant from starting.

2020-03-17 18:19:10 WARNING (zeroconf-ServiceBrowser__googlecast._tcp.local.) [zeroconf] Exception occurred:
Traceback (most recent call last):
  File "/usr/local/lib/python3.7/site-packages/zeroconf/__init__.py", line 2589, in send
    bytes_sent = s.sendto(packet, 0, (real_addr, port))
OSError: [Errno 101] Network unreachable

How do you have HA installed. This doesn’t tell us a lot.

Assuming you are on a PC with Ubuntu/Debian, or a Pi with Raspbian as the base OS, you can install Portainer to manage anything running in Docker.

docker run -d -p 9000:9000 --name=portainer --restart=always -v /var/run/docker.sock:/var/run/docker.sock -v portainer_data:/data portainer/portainer

You’ll then access Portainer at YOUR_MACHINE_IP:9000

I followed “Install Home Assistant Supervised on a generic Linux host” to install on Raspbian on RPI 4.

So I’ve got the supervisor and home assistant running in docker containers. I’ve also got the systemd unit files that were installed as part of that method.

I was under the impression from the docs that this was one of the remaining approved install methods.

I’m trying to figure out how that’s intended to be managed - systemctl, docker, something else?

2 Likes

Docker. :slight_smile: Supervisor and Homeassistant are both containers. If you want to start, run the supervisor. It should start the homeassistant container as well as other necessary containers. :slight_smile:

Normally I simply restart the PI, but that’s just convenience. sudo reboot is the easiest command to remember… :smiley: :smiley: :smiley: and I’m running HA on this Pi exclusively.

The easiest way to stop/start/restart Docker containers is with Portainer. Alternatively, you can do the same from the command line, but Portainer has a nice web interface that makes it super easy.

Install Portainer with the code I listed in my previous post.

sudo docker restart homeassistant (or whatever the container name is)

1 Like

Take a look here:

Thanks for all the replies. I’m under the impression that the Supervised Install is slightly than the other installs – I could have some of this wrong:

  • As with a Hass.io (now Home Assistant) install on bare hardware, the Home Assistant Supervisor is managing the containers.
  • This gives the ability to run HA Add-ons in containers that are managed by the supervisor.
  • The supervisor itself runs in a docker container (as mentioned above). The supervisor container has access to the docker socket, so even though it is running in a container - it can communicate with the docker daemon and manage the containers, namely the add-ons.

At this point, I’m not clear to what extent the supervisor manages the homeassistant container. In the hass.io case I believe it is responsible for the complete lifecycle management of the homeassistant container.

The supervised install uses two systemd unit files, hassio-apparmor.service and hassio-supervisor.service. I believe these are responsible for starting the containers at boot.

systemctl stop hassio-supervisor appears to stop the supervisor docker container, but it leaves the other containers running hassio-audio, hassio-dns, homeassistant, and add-ons. I can’t tell if this is intentional or a bug?

Stopping the hassio-apparmor service with systemd does nothing, there is no ExecStop defined in the systemd unit file. Looking at the hassio-apparmorscript that got installed in /usr/bin, it just seems to “upload an apparmor profile”, not sure what that means. Haven’t looked at apparmor yet.

I can’t tell if I should be able to use any of the ha/hass CLI tools to interact with the supervisor. They don’t get installed on the host system, so I’d need to docker exec into the container.

Finally, as mentioned above, I’m tripping over a problem that I don’t know whether it is installation related, something I’m doing wrong, or just a bug, Home Assistant seems to be encountering an error, safe mode isn’t helping, So all I get is the blue bar at the top and an empty white screen, there are no text or icons on the screen.

The log file:

2020-03-17 18:42:46 WARNING (zeroconf-ServiceBrowser__coap._udp.local.) [zeroconf] Exception occurred:
Traceback (most recent call last):
  File "/usr/local/lib/python3.7/site-packages/zeroconf/__init__.py", line 2589, in send
    bytes_sent = s.sendto(packet, 0, (real_addr, port))
OSError: [Errno 101] Network unreachable
2020-03-18 09:23:16 ERROR (MainThread) [homeassistant.components.hassio.handler] Timeout on /homeassistant/info request
2020-03-18 09:23:16 WARNING (MainThread) [homeassistant.components.hassio] Can't read last version:

You have the custom commands available to you via the ssh addons.
ha core restart would be available to you that way along with many others.
https://www.home-assistant.io/hassio/commandline/

@cogneato - Thanks for the reply. I haven’t tried to install the ssh add-on. At a minimum the port would need to change to not conflict with the host’s ssh.

I had somewhat assumed that the ha command would be available by docker exec’ing into the hassio_supervisor container. But it doesn’t look like it is in there, which I guess might be understandable.

Also, doesn’t the availability of the ssh add-on container depends on supervisor running correctly?

You can install the HA cli to run an bare metal, without the hassio ssh add-on.

There is a CLI available at https://github.com/home-assistant/cli

I did

sudo apt update && sudo apt upgrade -y
sudo apt-get install git
sudo apt-get install golang
go get -d github.com/home-assistant/cli
cd /root/go/src/github.com/home-assistant/cli/
go build main.go
mv main ha
export SUPERVISOR_ENDPOINT=http://IP:8123/api/hassio
create a long lived api token longandsafesecret
export SUPERVISOR_API_TOKEN=longandsafesecret
cp ha /usr/bin

add the exports to /etc/profile at the bottom !!!

1 Like

@francisp - Thank you that was helpful. I got it working, but then I also learned that if homeassistant isn’t running, I can’t use ha to talk to the supervisor, so it won’t help in that case.

if supervisor is not running, you need to try

sudo systemctl start hassio-supervisor.service

First, your error is related to your install. Showing network unreachable in this case means, your network inside the Docker containers isn’t running. That means, your containers can’t talk to each other and there is no container who takes the lead (=host).

I can see, that this seems HA related to you, but right now you’re experiencing “Docker problems”, not HA problems. My suggestion would be to take a look at the Docker documentation and get at least the basics for Docker. No offence intended, but it should make things a lot clearer for you.

Or are you familiar with Docker and just don’t get the right starting point? That was my case, I searched and looked, and didn’t get the point… :wink:

Here we go. You have a few possible installation methods with HA, depending on what you want later. We assume now, you have an empty RPi or NUC or whatever computer

  • You want to only install HA on this machine, HA should manage everything, including the operating system on that computer => the full package. This will install HassOS and Hass.io. Here you can’t SSH into your OS, you can only work with the tools Hass.io offers you.
    This means, HassOS will install all you need in Docker containers and manages them.
  • You install your OS for yourself, like Raspian or Debian. Now you can decide between two methods,
    • only install HA, meaning only HomeAssistant is installed, no addOns, no managing outside HA
    • you install Docker and afterwards Hass.io, to use all addOns and can manage some things regarding your host system. What I get, this is the installation you did.

With this in mind, all your questions go into the direction of setting up and managing your containers. Setup should already be done by the installation script from HA.

I’d advise to now install “Portainer” on the OS level (not in Hass.io). You will now see, which containers are running, stopped and why that is.

And now comes my last point, that helped me a lot in understanding: If you are familiar with docker-compose (if not, check the documentation at Docker), you can find some docker-compose.yaml on the net, these explained a lot to me:

Look here


and here

Thanks for your reply.

My point, when supervisor is running, but homeassistant is not, the ha CLI won’t work. It would be helpful to be able to run ha core start But, the endpoint, port 8123, is homeassistant, which isn’t running. I don’t think the supervisor has its own endpoint, yet?

I’m ok with starting the supervisor container via systemctl. I figured that out right away when I looked to see what systemd unit files got installed. AFAICT that isn’t documented anywhere.

What I am surprised by is that starting supervisor via systemctl does not seem to start the homeassistant container if it isn’t running.

The homeassistant container starts correctly at boot. I’m guessing the supervisor does that?

USE PORTAINER to start the home assistant container if the supervisor doesn’t. This is the easy way

1 Like

Hmm, I just tried that on a regular Hass.io (fully hassos image), the ha command works without homeassistant running. So it’s not connecting to 8123.

SUPERVISOR_ENDPOINT isn’t set. It does a DNS lookup to the internal DNS running in a container. I didn’t try to look at the go code, but using strace, it connects to the supervisor on port 80 using the container network.

So in order to have ha function similarly in the supervised install, supervisor’s port 80 would need to be exposed to the host system.

Or am I missing something?