Software

Home Assistant Supervised on Armbian TV Box

How install Home Assistant Supervised in Docker on Armbian TV Box like X96 Max Plus (Amlogic X905X3) or X96 Mini (Rockchip rk3228a)
>Check requirements<

If your Armbian does not have SSH enabled:
sudo armbian-config
System” > “SSH
enable first 3 options:
Permit Root Login
Password Authentication
Pubkey Authentication
echo $(uname -s)_$(uname -m)
Note your Machine.

Install Docker Dependencies

sudo apt-get update

sudo apt install -y \
apparmor \
apt-transport-https \
autoconf \
bluez \
build-essential \
ca-certificates \
curl \
dbus \
gnupg \
gnupg-agent \
jq \
libffi-dev \
libglib2.0-bin \
libjpeg-dev \
libopenjp2-7 \
libssl-dev \
libtiff5 \
libturbojpeg0-dev \
lsb-release \
network-manager \
python3 \
python3-dev \
python3-pip \
python3-venv \
udisks2 \
libglib2.0-bin \
software-properties-common \

systemd-resolved \
systemd-journal-remote \
tzdata \
udisks2 \
wget \
zlib1g-dev


sudo reboot

If libtiff5 does not exist (with Debian 12 bookworm), use libtiff5-dev

Install Docker

sudo curl -sSL https://get.docker.com/ | sh
Clean before install, in case of old installations
sudo apt-get remove docker docker-engine docker.io containerd runc

SYSTEM TESTs
sudo systemctl enable docker
sudo groupadd docker
sudo usermod -aG docker $USER
sudo systemctl status docker
sudo systemctl restart docker
docker --version

Install Home Assistant OS Agent

echo $(uname -s)_$(uname -m)
https://github.com/home-assistant/os-agent/releases/latest
copy the link of the last release for yor machine
wget "https://github.com/home-assistant/os-agent/releases/download/1.4.1/os-agent_1.4.1_linux_aarch64.deb"
sudo dpkg -i os-agent_1.4.1_linux_aarch64.deb

test the installation
gdbus introspect --system --dest io.hass.os --object-path /io/hass/os

Install Home Assistant Supervised in Docker

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

Custom homeassistant-supervised.deb

If you got errors as you are using Armbian 23 and/or a different Architecture rather than the Debian/Architecture required
or the envs are not compatibile with stock installer script, use my fork without Architecture and envs errors check, at your own risk!
wget https://github.com/Travis90x/supervised-installer/releases/latest/download/homeassistant-supervised.deb
sudo apt install ./homeassistant-supervised.deb


Now wait 10/20 minutes and try to navigato with a browser to

http:\\your_TVbox_IP:8123\ as you see in the terminal


check that all container is running with
sudo docker ps -a

If you see the possibility to restore a backup, Supervised is running.

On http:\\your_TVbox_IP:4357
Supervised results Connected, Home Assistant show “Unsupported
Home Assistant Supervised has a list of Supported Machine types and we use qemuarm-64 (or qemuarm on 32bit SoC like armv7l) that support ARM hardware
<<is much more widely varying than x86 hardware. ARM CPUs are generally built into “system-on-chip” (SoC)>>.
To obtain Supported Operative System, Docker CE container had to run only Linux Debian 11 aka Bullseye (no derivatives),
and Armbian is a derivative of Debian.

I haven’t found anything about this on the net,
but I’ll try to find a way to make the system appear as supported.
I pull a request to better support Armbian OS, to not show errors for apparmor and Docker cgroup v2,
but it seems Home Assistant Supervised project won’t supports it.
https://github.com/home-assistant/supervised-installer/pull/282

Solution for notification of errors in Supervised

Docker CGroup and AppArmor issue

If Home Assistant show a notification that need AppArmor
and to switch from Docker CGroup v2 to v1,
check CGropu version with
grep cgroup /proc/mounts
you should follow this guide
https://docs.docker.com/config/containers/runmetrics/#changing-cgroup-version
but X95 Max Plus TVBox has not /etc/default/grub and GRUB_CMDLINE_LINUX inside
So with Winscp open
/boot/uEnv.txt (if there is /boot/armbianEnv.txt for Rockchip, see below)
edit the row
APPEND=root=UUID=f0c71fbb-e1aa-4f34-8db4-9459511f4a9b rootflags=data=writeback rw rootfstype=ext4 console=ttyAML0,115200n8 console=tty0 no_console_suspend consoleblank=0 fsck.f
at the end of the same row APPEND=… add:
systemd.unified_cgroup_hierarchy=0 apparmor=1 security=apparmor
save and close the file, then
sudo update-initramfs -u
sudo reboot

For SoC Rockchip with armbianEnv.txt

In the file /boot/armbianEnv.txt add at the end these args on a separate row:
extraargs=apparmor=1 security=apparmor
or if extraargs already exist, add at the end of the row only
apparmor=1 security=apparmor
save and close the file, then
sudo update-initramfs -u
sudo reboot

Check AppArmor
systemctl status apparmor.service
sudo /usr/sbin/aa-status

or
sudo /sbin/aa-status


If CGroup issue persists:
edit with WinSCP /boot/boot.cmd
go to line
setenv bootargs “earlyprintk root=${rootdev} console=ttyS2,115200n8 console=tty1 rootwait…
edit it adding “systemd.unified_cgroup_hierarchy=0“, so:
setenv bootargs “earlyprintk root=${rootdev} console=ttyS2,115200n8 console=tty1 systemd.unified_cgroup_hierarchy=0 rootwait…
save, close and do this:
sudo mkimage -C none -A arm -T script -d /boot/boot.cmd /boot/boot.scr

edit armbianEnv.txt removing systemd.unified_cgroup_hierarchy:

save and close the file, then
sudo update-initramfs -u
sudo reboot

Connectivity check issue

https://www.home-assistant.io/more-info/unsupported/connectivity_check
In putty execute the following:
sudo nano /etc/NetworkManager/NetworkManager.conf
[logging]
backend=journal
[connectivity]
uri=http://checkonline.home-assistant.io/online.txt

Systemd-Resolved issue

sudo systemctl enable systemd-resolved.service && sudo systemctl start systemd-resolved
In systemd 239 systemd-resolve has been renamed to resolvectl, so…
sudo ln /usr/bin/resolvectl /usr/bin/systemd-resolve
check with:
systemd-resolve home-assistant.io

Docker Configuration issue

https://www.home-assistant.io/more-info/unsupported/docker_configuration
sudo nano /etc/docker/daemon.json

{
"log-driver": "journald",
"storage-driver": "overlay2",
"ip6tables": true,
"experimental": true,
"log-opts": {
"tag": "{{.Name}}"
}
}


Systemd Journal issue

sudo apt-get install --reinstall systemd-journal-remote
sudo reboot

If persist:
sudo systemctl stop systemd-journal-gatewayd.socket
rm -rf "/run/systemd-journal-gatewayd.sock
sudo touch /run/systemd-journal-gatewayd.sock
sudo systemctl enable systemd-journal-gatewayd.socket
sudo systemctl start systemd-journal-gatewayd.socket



sudo systemctl daemon-reload
sudo systemctl enable systemd-journal-gatewayd.socket
sudo systemctl enable systemd-journal-remote

sudo systemctl daemon-reload
sudo systemctl restart systemd-journal-gatewayd.socket
sudo systemctl restart systemd-journal-remote

check
sudo systemctl status systemd-journal-gatewayd.socket
sudo systemctl status systemd-journal-remote

reboot

If Systemd Journal errors persist:
https://community.home-assistant.io/t/journal-issues-with-supervised-install-after-updating-to-2022-11/483879/48
sudo cp /usr/lib/systemd/system/systemd-journal-gatewayd.socket /etc/systemd/system
sudo nano /etc/systemd/system/systemd-journal-gatewayd.socket

edit: ListenStream=/run/systemd-journal-gatewayd.sock
systemctl daemon-reload
systemctl enable systemd-journal-gatewayd.socket
reboot


If Systemd Journal errorr persist
with Permission denied and/or /etc/ssl/private/journal-remote.pem’: No such file or directory
sudo chown systemd-journal-remote /var/log/journal/remote/
copy /lib/systemd/system/systemd-journal-remote.service into /etc/systemd/system/
then edit
–listen-https=-3
to
–listen-http=-3
sudo systemctl daemon-reload
sudo systemctl restart systemd-journal-remote
sudo systemctl status systemd-journal-remote

Usefull command for Docker

How restart containers
docker restart hassio_supervisor
docker restart homeassistant

How restart all containers
docker restart $(docker ps -a -q)


Change autorestart mode
docker run -d –restart unless-stopped NAMECONTAINER
restart automatically all container already started
docker update --restart unless-stopped $(docker ps -a -q)

docker images
sudo docker run -d --restart unless-stopped
IMAGEID

Remove and Clean All

Clean Home Assistant package and files
sudo apt remove -y homeassistant-supervised
sudo systemctl stop hassio-supervisor.service
sudo systemctl stop hassio-apparmor.service
sudo systemctl disable hassio-supervisor.service
sudo systemctl disable hassio-apparmor.service
sudo rm -rf /etc/systemd/system/hassio-supervisor.service
sudo rm -rf /etc/systemd/system/hassio-apparmor.service
sudo rm -rf /usr/sbin/hassio-supervisor
sudo rm -rf /usr/sbin/hassio-appa
rmor
sudo rm -r /usr/share/hassio/*
sudo systemctl daemon-reload

Clean Docker
sudo systemctl stop docker

Remove Containers and Images
Got ID of containers*
docker container ls
sudo docker stop IDCONTAINER*
sudo docker kill IDCONTAINER*
sudo docker container rm -f IDCONTAINER*
Got ID of images**
docker images
sudo docker rmi -f IDIMAGE**

Remove unused images
sudo docker image prune -a

Removes all stopped containers
sudo docker container prune -f

Remove all unused containers, networks, images...
sudo docker system prune


Remove all containers and images
(Attention!! Not only Home Assistant if you install other containers)

sudo docker stop $(docker ps -q)

sudo docker kill $(docker ps -q)
sudo docker container rm -f $(docker ps -q)
sudo docker rmi -f $(docker images -q)


Remove VLAN
ip link delete dev hassio
ip link delete dev docker0



en_GBEnglish (UK)