Installing Home Assistant Supervised

Today we will be installing Home Assistant Supervised on Debian 12 according to official instructions. “Sho, again?” – many will ask. Yes, but simply installing it according to the instructions is boring and we will definitely run into problems that are not even mentioned in the instructions.

Why Debian? Because it is the recommended operating system. Theoretically, it can be installed on any Linux system. Also, this article will not discuss why Home Assistant Supervised and not Home Assistant OS. This article is not about that.

The Home Assistant Supervised installation plan is as follows:

  • Install Debian.

  • Install dependencies.

  • Install OS-Agent and Home Assistant.

Installing Debian.

At the time of writing, the current version of Debian is 12.5.0. Download ISO distribution from the official website. If we install it on a PC, then we write it to a flash drive, for example via Rufus.

We install everything to the minimum, be sure to select SSH server. Graphical shell and standard system utilites optional. We are setting up the network using DHCP; we are not in a hurry to set up a static address yet.

When the installation is complete, disable password login in SSH and write the public key to authorized_keys.

If you are installing on a virtual machine, then at this stage it is highly advisable to take a snapshot so as not to have to reinstall from scratch again if something goes wrong. And in general, don’t hesitate to take snapshots after each successful stage, it saves a lot of time.

Next, the entire installation must come from root. We go into root using the command su - (don't forget the dash at the end). You should be prompted for the root password that you entered when installing the system. After going to root, the greeting line should look like:

root@homeassistant:~#

Installing dependencies.

Install/update the necessary packages:

apt update
apt install apparmor bluez cifs-utils curl dbus jq libglib2.0-bin lsb-release network-manager nfs-common systemd-journal-remote systemd-resolved udisks2 wget -y

Next, install docker:

curl -fsSL get.docker.com | sh

Installing OS-Agent and Home Assistant.

Download and install OS-Agent. At the time of writing, the current version is 1.6.0:

wget https://github.com/home-assistant/os-agent/releases/download/1.6.0/os-agent_1.6.0_linux_x86_64.deb
dpkg -i os-agent_1.6.0_linux_x86_64.deb

Let's check its functionality:

root@homeassistant:~# gdbus introspect --system --dest io.hass.os --object-path /io/hass/os
node /io/hass/os {
  interface org.freedesktop.DBus.Introspectable {
    methods:
      Introspect(out s out);
    signals:
    properties:
  };
  interface org.freedesktop.DBus.Properties {
    methods:
      Get(in  s interface,
          in  s property,
          out v value);
      GetAll(in  s interface,
             out a{sv} props);
      Set(in  s interface,
          in  s property,
          in  v value);
    signals:
      PropertiesChanged(s interface,
                        a{sv} changed_properties,
                        as invalidates_properties);
    properties:
  };
  interface io.hass.os {
    methods:
    signals:
    properties:
      @org.freedesktop.DBus.Property.EmitsChangedSignal("invalidates")
      readonly s Version = '1.6.0';
      @org.freedesktop.DBus.Property.EmitsChangedSignal("true")
      readwrite b Diagnostics = false;
  };
};

If there are no errors, objects are output normally interfacethen everything was installed correctly.

Next, download and install Home Assistant:

wget -O homeassistant-supervised.deb https://github.com/home-assistant/supervised-installer/releases/latest/download/homeassistant-supervised.deb
apt install ./homeassistant-supervised.deb

After installation, after 2-3 minutes (or longer) go to http://IP_ADDRESS:8123/ (where IP_ADDRESS is the IP address of the machine), wait for completion and configure Home Assistant.


Stop, stop, stop! Wait! Did you think that everything would just work out for you like this? Remember I mentioned problems? Let's figure out what can and will definitely go wrong during the installation process.

systemd-resolved

You have installed the dependencies. Trying to install docker:

root@homeassistant:~# curl -fsSL get.docker.com | sh
curl: (6) Could not resolve host: get.docker.com

… and suddenly we discover that the resolver has fallen off. In fact, it's installed systemd-resolved and the DNS server from the network settings did not work.

We check:

root@homeassistant:~# resolvectl dns
Global:
Link 2 (ens192):

That’s right, there is no DNS server on the interface. Doesn't work right away, you need to restart the service first systemctl restart systemd-resolved.service.

Add the router's DNS server to the network interface, 1.1.1.1 or 8.8.8.8 and check:

root@homeassistant:~# resolvectl dns ens192 192.168.1.1
root@homeassistant:~# resolvectl dns
Global:
Link 2 (ens192): 192.168.1.1
root@homeassistant:~# ping4 google.com
PING  (108.177.14.101) 56(84) bytes of data.
64 bytes from lt-in-f101.1e100.net (108.177.14.101): icmp_seq=1 ttl=111 time=32.4 ms
64 bytes from lt-in-f101.1e100.net (108.177.14.101): icmp_seq=2 ttl=111 time=32.7 ms
64 bytes from lt-in-f101.1e100.net (108.177.14.101): icmp_seq=3 ttl=111 time=32.7 ms
^C

Great! We try to install Docker again.

This problem also sometimes appears when installing the Home Assistant package. During installation it starts spamming with ping errors.

ping: checkonline.home-assistant.io: Temporary failure in name resolution
[info] Waiting for checkonline.home-assistant.io - network interface might be down...
ping: checkonline.home-assistant.io: Temporary failure in name resolution
[info] Waiting for checkonline.home-assistant.io - network interface might be down...

Without interrupting the installation process, you need to log in to a parallel SSH session, or (if you are working directly) switch to the second terminal (switching between terminals Alt+F1..F6). Next, we register DNS on the interface, switch to the main session/terminal, the installation should continue automatically.

NetworkManager

The NetworkManager problem usually occurs after the entire installation of Home Assistant while running Docker containers.

If you have registered a static IP address, then a problem with NetworkManager is almost guaranteed to occur. This means that the resolver does not work, even if it is registered manually, and therefore all containers except the main one do not download and start. Although ping directly to the IP address works fine.

root@homeassistant:~# docker ps
CONTAINER ID   IMAGE                                                   COMMAND   CREATED         STATUS         PORTS     NAMES
5fa8dfe4429c   ghcr.io/home-assistant/amd64-hassio-supervisor:latest   "/init"   6 minutes ago   Up 6 minutes             hassio_supervisor
root@homeassistant:~# resolvectl dns
Global:
Link 2 (ens192):
Link 3 (docker0):
Link 5 (vethfd10614):
Link 6 (hassio):
Link 8 (veth3dfd1c5):
root@homeassistant:~# resolvectl dns ens192 192.168.1.1
root@homeassistant:~# resolvectl dns
Global:
Link 2 (ens192): 192.168.1.1
Link 3 (docker0):
Link 5 (vethfd10614):
Link 6 (hassio):
Link 8 (veth3dfd1c5):
root@homeassistant:~# ping4 google.com
ping: google.com: Temporary failure in name resolution
root@homeassistant:~# ping4 8.8.8.8
PING 8.8.8.8 (8.8.8.8) 56(84) bytes of data.
64 bytes from 8.8.8.8: icmp_seq=1 ttl=112 time=30.6 ms
64 bytes from 8.8.8.8: icmp_seq=2 ttl=112 time=30.6 ms
64 bytes from 8.8.8.8: icmp_seq=3 ttl=112 time=30.7 ms
^C

Since we have NetworkManager installed, then most likely network management has passed to it. Let's check.

root@homeassistant:~# nmcli connection show 
NAME                UUID                                  TYPE      DEVICE 
Supervisor ens192   4e12c325-9cce-4446-bce6-4e00a038da7a  ethernet  ens192 
lo                  0fb78ab7-1397-4b7d-b2f9-08a5e4ce159c  loopback  lo     
Wired connection 1  9596ad70-3e69-3dcf-9c4e-7baffa45d79d  ethernet  --     

This is true. Home Assistant has created a new profile Supervisor ens192 (ens192 may differ depending on the interface used) and activated it. Most likely the problem is there.

root@homeassistant:~# nmcli connection edit "Supervisor ens192" 
nmcli> print ipv4
['ipv4' setting values]
ipv4.method:                            manual
ipv4.dns:                               --
ipv4.dns-search:                        --
ipv4.dns-options:                       --
ipv4.dns-priority:                      0
ipv4.addresses:                         192.168.1.30/24
ipv4.gateway:                           192.168.1.1
.......

There is no indication of the DNS server in the profile. We add it to the profile, save it, check it.

nmcli> set ipv4.dns 192.168.1.1
nmcli> print ipv4.dns
ipv4.dns: 192.168.1.1
nmcli> save persistent 
Connection 'Supervisor ens192' (4e12c325-9cce-4446-bce6-4e00a038da7a) successfully updated.
nmcli> quit 
root@homeassistant:~# nmcli connection down "Supervisor ens192" && nmcli connection up "Supervisor ens192" 
Connection 'Supervisor ens192' successfully deactivated (D-Bus active path: /org/freedesktop/NetworkManager/ActiveConnection/3)
Connection successfully activated (D-Bus active path: /org/freedesktop/NetworkManager/ActiveConnection/4)
root@homeassistant:~# ping4 google.com
PING  (173.194.220.139) 56(84) bytes of data.
64 bytes from lk-in-f139.1e100.net (173.194.220.139): icmp_seq=1 ttl=109 time=32.6 ms
64 bytes from lk-in-f139.1e100.net (173.194.220.139): icmp_seq=2 ttl=109 time=32.5 ms
64 bytes from lk-in-f139.1e100.net (173.194.220.139): icmp_seq=3 ttl=109 time=32.5 ms

If you connect via SSH, then reconnection must be done with one command, otherwise you will have to go into the console, because. the grid will turn off.

We go for tea and wait for all the containers to rise.

root@homeassistant:~# docker ps
CONTAINER ID   IMAGE                                                      COMMAND               CREATED          STATUS         PORTS                                   NAMES
9085135ef77d   ghcr.io/home-assistant/qemux86-64-homeassistant:2024.6.2   "/init"               6 minutes ago    Up 6 minutes                                           homeassistant
54edaaebde19   ghcr.io/home-assistant/amd64-hassio-multicast:2024.03.0    "/init"               7 minutes ago    Up 7 minutes                                           hassio_multicast
ad3991713142   ghcr.io/home-assistant/amd64-hassio-audio:2023.12.0        "/init"               7 minutes ago    Up 7 minutes                                           hassio_audio
b0d247d8d950   ghcr.io/home-assistant/amd64-hassio-dns:2024.04.0          "/init"               7 minutes ago    Up 7 minutes                                           hassio_dns
58fcbe893417   ghcr.io/home-assistant/amd64-hassio-cli:2024.05.0          "/init"               7 minutes ago    Up 7 minutes                                           hassio_cli
896050f24454   ghcr.io/home-assistant/amd64-hassio-observer:2023.06.0     "/usr/bin/observer"   14 minutes ago   Up 7 minutes   0.0.0.0:4357->80/tcp, :::4357->80/tcp   hassio_observer
5fa8dfe4429c   ghcr.io/home-assistant/amd64-hassio-supervisor:latest      "/init"               36 minutes ago   Up 7 minutes                                           hassio_supervisor

When did the last container go up? qemux86-64-homeassistantyou can log in through a browser and make further settings.

If you log in too early and see an installation error, don’t be alarmed, you need to wait some more time.

Problems with NetworkManager can also result in the system not remembering network settings via the web interface and resetting them after a system reboot.

The solution to this problem is quite simple. If you look at network profiles, in this case most likely the profile controlled by Home Assistant will be inactive.

root@homeassistant:~# nmcli connection show 
NAME                UUID                                  TYPE      DEVICE 
Supervisor ens192   4e12c325-9cce-4446-bce6-4e00a038da7a  ethernet  -- 
lo                  0fb78ab7-1397-4b7d-b2f9-08a5e4ce159c  loopback  lo     
Wired connection 1  9596ad70-3e69-3dcf-9c4e-7baffa45d79d  ethernet  ens192     

You need to switch to a profile that will be controlled by Home Assistant. It is advisable to delete the remaining profile, but usually it is deleted on its own when the system is rebooted.

root@homeassistant:~# nmcli connection down "Wired connection 1" && nmcli connection up "Supervisor ens192" 
Connection 'Wired connection 1' successfully deactivated (D-Bus active path: /org/freedesktop/NetworkManager/ActiveConnection/3)
Connection successfully activated (D-Bus active path: /org/freedesktop/NetworkManager/ActiveConnection/4)
root@homeassistant:~# nmcli connection delete "Wired connection 1"

Other errors

After installation, do not forget to restart the system on which Home Assistant is installed. Otherwise, it will signal an unrecoverable error and/or will not show the address on the network interface.

Conclusion

Perhaps these are not all the errors that you will encounter, especially if you install Home Assistant on a Linux system other than Debian 12. Problems with NetworkManager will most likely be fixed over time, because this is a system configuration problem when the very first container is activated amd64-hassio-supervisor.

Similar Posts

Leave a Reply

Your email address will not be published. Required fields are marked *