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 Authenticationecho $(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-devsudo 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 TESTssudo 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 machinewget "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 installationgdbus 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 withsudo 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 withgrep 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 rowAPPEND=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 onlyapparmor=1 security=apparmor
save and close the file, thensudo update-initramfs -u
sudo reboot
Check AppArmorsystemctl status apparmor.service
sudo /usr/sbin/aa-status
orsudo /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, thensudo 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_configurationsudo 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.socketsudo systemctl daemon-reload
sudo systemctl enable systemd-journal-gatewayd.socket
sudo systemctl enable systemd-journal-remotesudo systemctl daemon-reload
sudo systemctl restart systemd-journal-gatewayd.socket
sudo systemctl restart systemd-journal-remote
checksudo systemctl status systemd-journal-gatewayd.socket
sudo systemctl status systemd-journal-remotereboot
If Systemd Journal errors persist:
https://community.home-assistant.io/t/journal-issues-with-supervised-install-after-updating-to-2022-11/483879/48sudo 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 directorysudo 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=-3sudo systemctl daemon-reload
sudo systemctl restart systemd-journal-remote
sudo systemctl status systemd-journal-remote
Usefull command for Docker
How restart containersdocker 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 starteddocker update --restart unless-stopped $(docker ps -a -q)
docker images
IMAGEID
sudo docker run -d --restart unless-stopped
Remove and Clean All
Clean Home Assistant package and filessudo apt remove -y homeassistant-supervised
rmor
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-appasudo rm -r /usr/share/hassio/*
sudo systemctl daemon-reload
Clean Dockersudo 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 VLANip link delete dev hassio
ip link delete dev docker0