Open ms1design opened 1 month ago
This is awesome @ms1design, good luck in your mission! 🙏
The crew from Seeed Studio would also probably be interested to help you with this if you didn't already show it to them.
It's funny—I discussed it with Elaine, but back then, I advised against using supervisor because I found it too complicated to support or use. 🙈 Welcome to my world 😆
Logs: _hassio_supervisor_logs.txt
homeassistant-supervisor
container is not immediately restarting anymore due to many issueshomeassistant-supervisor
is able to detect homeassistant-core
container running in same docker networkhomeassistant-supervisor
installation script docker
availability inside homeassistant-supervisor
containerSUPERVISOR_MACHINE
value to properly configure coresys
using git patchhomeassistant-supervisor
docker image labels required for proper system and machine detectionSUPERVISOR_DEV: 1
)cli
docker
plugin in container homeassistant-supervisor
and other HA related docker image labels required for proper versions detectionI'm happy to share a significant breakthrough: the successful setup of the homeassistant-supervisor
with homeassistant
container on my Jetson device 🎉
This bringing us one step closer to harnessing the power of edge computing for AI/ML Home Assistant solutions 🦾 🤖 The next step would be streamlined install and uninstall process for Jetson devices.
The journey to this milestone has been marked by quirks and challenges, but overall idea was to:
Note: This is a work-in-progress version, so instructions may evolve.
Before launching the homeassistant-supervisor
container on your Jetson device, ensure you meet the necessary requirements:
Set up essential directories on your Jetson:
sudo mkdir -p \
/usr/share/hassio/audio/asound \
/usr/share/hassio/dns \
/usr/share/hassio/homeassistant \
/usr/share/hassio/ssl \
/usr/share/hassio/share \
/usr/share/hassio/media \
/usr/share/hassio/tmp
Create symbolic links:
sudo ln -sf /etc/pulse/client.conf /usr/share/hassio/tmp/homeassistant_pulse
Execute the following command to launch the hassio_supervisor
container:
docker run -d \
--name hassio_supervisor \
--hostname supervisor \
--privileged \
--cap-add=ALL \
--security-opt seccomp=unconfined \
--security-opt apparmor=unconfined \
-p 80:80 \
-v ha-config:/config \
-v ha-share:/share \
-v ha-media:/media \
-v ha-supervisor:/data \
-v ha-supervisor-share:/tmp/supervisor/data \
-v /usr/bin/docker:/usr/bin/docker \
-v /run/docker.sock:/run/docker.sock:ro \
-v /etc/docker/daemon.json:/etc/docker/daemon.json:ro \
-v /var/run/dbus:/var/run/dbus \
-v /run/NetworkManager:/run/NetworkManager \
-v /etc/NetworkManager:/etc/NetworkManager \
-v /run/dbus/system_bus_socket:/run/dbus/system_bus_socket:ro \
-v /run/udev:/run/udev:ro \
-v /etc/udev/rules.d:/etc/udev/rules.d:ro \
-v /run/audio:/run/audio:ro \
-v /etc/asound.conf:/etc/asound.conf:ro \
-v /etc/pulse/client.conf:/etc/pulse/client.conf:ro \
-v /sys/fs/cgroup:/sys/fs/cgroup:ro \
-v /etc/systemd/resolved.conf:/etc/systemd/resolved.conf \
-v /run/systemd/system:/run/systemd/system \
-v /var/log/journal:/var/log/journal:ro \
-v /run/log/journal:/run/log/journal:ro \
-v /etc/machine-id:/etc/machine-id:ro \
-v /etc/localtime:/etc/localtime:ro \
-v /etc/timezone:/etc/timezone:ro \
--device /dev/snd:/dev/snd \
--device /dev/bus/usb \
ms1design/homeassistant-supervisor:latest-r36.2.0-cu122-cp312
hassio_supervisor
container, powered by Docker running on the host machine, will seamlessly download all necessary dependencies, including hassio_audio
, hassio_cli
, hassio_dns
, hassio_multicast
, hassio_observer
, and finally, the homeassistant
, as shown in the screenshot below.
Note:
hassio_supervisor
autonomously manages all containers prefixed withhassio_
andhomeassistant
container. Manual intervention is not recommended.
homeassistant-supervisor
logs
```log
s6-rc: info: service s6rc-oneshot-runner: starting
s6-rc: info: service s6rc-oneshot-runner successfully started
s6-rc: info: service fix-attrs: starting
s6-rc: info: service fix-attrs successfully started
s6-rc: info: service legacy-cont-init: starting
cont-init: info: running /etc/cont-init.d/udev.sh
[13:55:20] INFO: Using udev information from host
cont-init: info: /etc/cont-init.d/udev.sh exited 0
s6-rc: info: service legacy-cont-init successfully started
s6-rc: info: service legacy-services: starting
services-up: info: copying legacy longrun supervisor (no readiness notification)
services-up: info: copying legacy longrun watchdog (no readiness notification)
s6-rc: info: service legacy-services successfully started
[13:55:20] INFO: Starting local supervisor watchdog...
2024-05-16 13:55:20.994 INFO (MainThread) [__main__] Initializing Supervisor setup
2024-05-16 13:55:21.052 INFO (MainThread) [supervisor.bootstrap] Setting up coresys for machine: qemuarm-64
2024-05-16 13:55:21.058 INFO (MainThread) [supervisor.docker.supervisor] Attaching to Supervisor ms1design/homeassistant-supervisor with version 2024.05.1
2024-05-16 13:55:21.058 INFO (MainThread) [supervisor.docker.supervisor] Connecting Supervisor to hassio-network
2024-05-16 13:55:21.263 WARNING (SyncWorker_0) [supervisor.docker.manager] ms1design/homeassistant-supervisor not found for cleanup
2024-05-16 13:55:21.264 INFO (MainThread) [supervisor.resolution.evaluate] Starting system evaluation with state initialize
2024-05-16 13:55:21.265 WARNING (MainThread) [supervisor.resolution.evaluations.docker_configuration] Docker logging driver json-file is not supported!
2024-05-16 13:55:21.265 WARNING (MainThread) [supervisor.resolution.evaluations.base] The configuration of Docker is not supported (more-info: https://www.home-assistant.io/more-info/unsupported/docker_configuration)
2024-05-16 13:55:21.266 WARNING (MainThread) [supervisor.resolution.evaluations.base] AppArmor is required for Home Assistant. (more-info: https://www.home-assistant.io/more-info/unsupported/apparmor)
2024-05-16 13:55:21.267 INFO (MainThread) [supervisor.resolution.evaluate] System evaluation complete
2024-05-16 13:55:21.268 INFO (MainThread) [__main__] Setting up Supervisor
2024-05-16 13:55:21.432 INFO (MainThread) [supervisor.api] Starting API on 172.30.32.2
2024-05-16 13:55:21.830 CRITICAL (MainThread) [supervisor.hardware.monitor] Not privileged to run udev monitor!
2024-05-16 13:55:21.832 INFO (MainThread) [supervisor.dbus.manager] Connected to system D-Bus.
2024-05-16 13:55:21.832 INFO (MainThread) [supervisor.dbus.agent] Load dbus interface io.hass.os
2024-05-16 13:55:21.832 INFO (MainThread) [supervisor.dbus.hostname] Load dbus interface org.freedesktop.hostname1
2024-05-16 13:55:21.833 INFO (MainThread) [supervisor.dbus.logind] Load dbus interface org.freedesktop.login1
2024-05-16 13:55:21.833 INFO (MainThread) [supervisor.dbus.network] Load dbus interface org.freedesktop.NetworkManager
2024-05-16 13:55:21.833 INFO (MainThread) [supervisor.dbus.rauc] Load dbus interface de.pengutronix.rauc
2024-05-16 13:55:21.833 INFO (MainThread) [supervisor.dbus.resolved] Load dbus interface org.freedesktop.resolve1
2024-05-16 13:55:21.834 INFO (MainThread) [supervisor.dbus.systemd] Load dbus interface org.freedesktop.systemd1
2024-05-16 13:55:21.834 INFO (MainThread) [supervisor.dbus.timedate] Load dbus interface org.freedesktop.timedate1
2024-05-16 13:55:21.834 WARNING (MainThread) [supervisor.dbus.agent] No OS-Agent support on the host. Some Host functions have been disabled.
2024-05-16 13:55:21.834 WARNING (MainThread) [supervisor.dbus.rauc] Host has no rauc support. OTA updates have been disabled.
2024-05-16 13:55:22.088 INFO (MainThread) [supervisor.host.services] Updating service information
2024-05-16 13:55:22.097 INFO (MainThread) [supervisor.host.sound] Updating PulseAudio information
2024-05-16 13:55:22.101 WARNING (SyncWorker_0) [supervisor.host.sound] Can't update PulseAudio data: Failed to connect to pulseaudio server
2024-05-16 13:55:22.373 INFO (MainThread) [supervisor.host.network] Updating local network information
2024-05-16 13:55:22.610 INFO (MainThread) [supervisor.host.apparmor] Loading AppArmor Profiles: set()
2024-05-16 13:55:22.611 WARNING (MainThread) [supervisor.host.apparmor] AppArmor is not enabled on host
2024-05-16 13:55:22.617 INFO (MainThread) [supervisor.docker.monitor] Started docker events monitor
2024-05-16 13:55:22.618 INFO (MainThread) [supervisor.updater] Fetching update data from https://version.home-assistant.io/stable.json
2024-05-16 13:55:22.929 INFO (MainThread) [supervisor.docker.interface] Found ghcr.io/home-assistant/aarch64-hassio-cli versions: [
hassio_audio
logs```log s6-rc: info: service s6rc-oneshot-runner: starting s6-rc: info: service s6rc-oneshot-runner successfully started s6-rc: info: service fix-attrs: starting s6-rc: info: service fix-attrs successfully started s6-rc: info: service legacy-cont-init: starting cont-init: info: running /etc/cont-init.d/filesystem.sh cont-init: info: /etc/cont-init.d/filesystem.sh exited 0 s6-rc: info: service legacy-cont-init successfully started s6-rc: info: service alsa: starting s6-rc: info: service alsa successfully started s6-rc: info: service alsa-init: starting [13:55:25] INFO: Adjust ALSA mixer settings for /dev/snd/controlC0 [13:55:26] INFO: Adjust ALSA mixer settings for /dev/snd/controlC1 [13:55:26] INFO: Adjust ALSA mixer settings for /dev/snd/controlC2 s6-rc: info: service alsa-init successfully started s6-rc: info: service pulseaudio: starting [13:55:58] WARNING: No supervisor configuration found W: [pulseaudio] main.c: Running in system mode, but --disallow-module-loading not set. W: [pulseaudio] main.c: Home directory of user 'root' is not '/var/run/pulse', ignoring. W: [pulseaudio] caps.c: Normally all extra capabilities would be dropped now, but that's impossible because PulseAudio was built without capabilities support. W: [pulseaudio] main.c: OK, so you are running PA in system mode. Please make sure that you actually do want to do that. W: [pulseaudio] main.c: Please read http://www.freedesktop.org/wiki/Software/PulseAudio/Documentation/User/WhatIsWrongWithSystemWide/ for an explanation why system mode is usually a bad idea. W: [pulseaudio] module-udev-detect.c: Failed to open /proc/asound/card0: No such file or directory W: [pulseaudio] module-udev-detect.c: Failed to open /proc/asound/card1: No such file or directory W: [pulseaudio] module-udev-detect.c: Failed to open /proc/asound/card2: No such file or directory s6-rc: info: service pulseaudio successfully started s6-rc: info: service legacy-services: starting s6-rc: info: service legacy-services successfully started E: [pulseaudio] main.c: Failed to acquire org.pulseaudio.Server: org.freedesktop.DBus.Error.AccessDenied: Connection ":1.6842" is not allowed to own the service "org.pulseaudio.Server" due to security policies in the configuration file N: [pulseaudio] bluez5-util.c: Could not find org.bluez.BatteryProviderManager1.RegisterBatteryProvider(), is bluetoothd started with experimental features enabled (-E flag)? W: [pulseaudio] bluez5-util.c: org.bluez.Media1.RegisterApplication() failed: org.freedesktop.DBus.Error.UnknownMethod: Method "RegisterApplication" with signature "oa{sv}" on interface "org.bluez.Media1" doesn't exist W: [pulseaudio] bluez5-util.c: Couldn't register media application for adapter /org/bluez/hci0 W: [pulseaudio] bluez5-util.c: Only SBC codec is available for A2DP profiles E: [pulseaudio] bluez5-util.c: org.bluez.Media1.RegisterEndpoint() failed: org.freedesktop.DBus.Error.UnknownMethod: Method "RegisterEndpoint" with signature "oa{sv}" on interface "org.bluez.Media1" doesn't exist E: [pulseaudio] bluez5-util.c: org.bluez.Media1.RegisterEndpoint() failed: org.freedesktop.DBus.Error.UnknownMethod: Method "RegisterEndpoint" with signature "oa{sv}" on interface "org.bluez.Media1" doesn't exist ```
hassio_cli
logs```log s6-rc: info: service s6rc-oneshot-runner: starting s6-rc: info: service s6rc-oneshot-runner successfully started s6-rc: info: service fix-attrs: starting s6-rc: info: service fix-attrs successfully started s6-rc: info: service legacy-cont-init: starting s6-rc: info: service legacy-cont-init successfully started s6-rc: info: service legacy-services: starting s6-rc: info: service legacy-services successfully started ```
hassio_dns
logs```log s6-rc: info: service s6rc-oneshot-runner: starting s6-rc: info: service s6rc-oneshot-runner successfully started s6-rc: info: service fix-attrs: starting s6-rc: info: service fix-attrs successfully started s6-rc: info: service legacy-cont-init: starting cont-init: info: running /etc/cont-init.d/corefile.sh 2024/05/16 13:55:24 open /config/coredns.json: no such file or directory [13:55:24] ERROR: Corefile fails to generate. Use fallback corefile! cont-init: info: /etc/cont-init.d/corefile.sh exited 0 s6-rc: info: service legacy-cont-init successfully started s6-rc: info: service legacy-services: starting services-up: info: copying legacy longrun coredns (no readiness notification) [WARNING] plugin/hosts: File does not exist: /config/hosts .:53 .:5553 CoreDNS-1.8.7 linux/arm64, go1.22.2, a9adfd5-dirty s6-rc: info: service legacy-services successfully started ```
hassio_multicast
logs```log s6-rc: info: service s6rc-oneshot-runner: starting s6-rc: info: service s6rc-oneshot-runner successfully started s6-rc: info: service fix-attrs: starting s6-rc: info: service fix-attrs successfully started s6-rc: info: service legacy-cont-init: starting s6-rc: info: service legacy-cont-init successfully started s6-rc: info: service legacy-services: starting services-up: info: copying legacy longrun mdns (no readiness notification) mdns-repeater (6): dev hassio addr 172.30.32.1 mask 255.255.254.0 net 172.30.32.0 s6-rc: info: service legacy-services successfully started ```
hassio_observer
logs```log 2024/05/16 11:55:26 Start webserver on http://0.0.0.0:80 ```
homeassistant
logs```log s6-rc: info: service s6rc-oneshot-runner: starting s6-rc: info: service s6rc-oneshot-runner successfully started s6-rc: info: service fix-attrs: starting s6-rc: info: service fix-attrs successfully started s6-rc: info: service legacy-cont-init: starting s6-rc: info: service legacy-cont-init successfully started s6-rc: info: service legacy-services: starting services-up: info: copying legacy longrun home-assistant (no readiness notification) s6-rc: info: service legacy-services successfully started 2024-05-16 13:59:31.011 ERROR (MainThread) [homeassistant.components.hassio.handler] Client error on /supervisor/options request 0, message='Attempt to decode JSON with unexpected mimetype: text/plain; charset=utf-8', url=URL('http://172.30.32.2/supervisor/options') ```
Wow, okay! This is awesome @ms1design ! Hopefully this makes things a lot easier for everyone 🙏
That docker run command 🤣
If making those /usr/share/hassio
directories on the host is the only host-side changes required, that's not too bad at all. Or perhaps you were alluding to something bigger?
@dusty-nv, I’m rolling hard on this docker run command too 😂 it's a huge roll forward 🤣 especially when we realise how complicated it is to port all HA repositories and integrate them together.
I was trying to make it work with almost no changes to the host machine, which leaves us with one critical error regarding udev permissions, among many other warnings as shown in the previous screenshots.
These are not the best results from a user perspective. I’m tempted to extend the jetson-containers API to support installation and uninstallation scripts for host machines, which would essentially make the Dockerfile unnecessary for this container. We can tackle that with a little reorganisation:
My ideal plan is for the user to issue just one command on the host machine, which will install HA Supervisor with all system dependencies and optionally the full Wyoming Voice Assistant pipeline from jetson-containers. This might take some time :)
Sounds like a good plan @ms1design. Thank you for looking into this - that's okay if it takes time, I appreciate you wanting to go about it the right way that is easiest for users. My guess/hope is this will all come together nicely around the time we have the more advanced agents operating and hopefully the new AI API's defined by HA. I have been working with the NousResearch/Hermes-2-Pro-Llama-3-8B
model for controller LLM and been getting some encouraging initial results from that, way better than what Llama3 could do for function calling.
Anyways, yea - your HA Supervisor repo could include jetson-containers as a submodule if that aids in the one-click/one-command scripted setup. Others in the group have been using jetson-containers as a submodule in their projects and that design seems to be working well for them.
homeassistant-supervisor
Hi @dusty-nv 👋
To keep Home Assistant on Jetson project progressing, I'm revisiting the experiments with the Home Assistant Supervisor container. My aim is to simplify the onboarding process for Home Assistant and Wyoming add-ons on Jetson devices based on our experiences during the latest Jetson AI Research Group meeting.
While I'm not sure whether containerizing Supervisor and making it work with all its system dependencies is feasible, I'm willing to give it a shot. Below is what I tried yesterday and what should be done or fixed based on the
homeassistant-supervisor
logs.All questions and advice are warmly welcomed!
Updates:
May 8, 2024
Logs: _homeassistant-supervisor_logs.txt
homeassistant-supervisor
container.ciso8601
andpsutil-home-assistant
) to standalone, reusable containers in thesmart-home/dependencies
directory.homeassistant-supervisor
dependencyeudev
in thesmart-home/dependencies
directory.403
errors when fetching RAW files from GitHub injetson_containers/utils.js
. This was achieved by switching fromurllib.request
(which still usesHTTP/1.1
) to therequests
library, enabling the use ofHTTP/2
requests.jetson_containers/utils.py
:handle_json_request
,handle_text_request
,github_latest_tag
, andget_json_value_from_url
.config.py
.homeassistant-core
container'sbuild.sh
script.homeassistant-supervised
container.Quick Start
host
machine runningdocker
using sameuser
:docker-compose.yaml
exampleTODO
Based on
homeassistant-supervisor
logsinstall.sh
script forhost
machine if conterization is impossiblehomeassistant-core
can detect thehomeassistant-supervisor
container and vice versa~homeassistant-supervisor
container docker volumes & pathseudev
dependency container to support independent build & install stages to allowdpkg
uploadSUPERVISOR_MACHINE
value to properly configurecoresys
(generic-aarch64
is used for now) to enable OTA updates:~INFO (MainThread) [supervisor.bootstrap] Setting up coresys for machine: generic-aarch64
~WARNING (MainThread) [supervisor.updater] Can't process version data: 'generic-aarch64'
~docker
availability:~WARNING (MainThread) [supervisor.resolution.evaluations.base] The configuration of Docker is not supported (more-info: https://www.home-assistant.io/more-info/unsupported/docker_configuration)
~CRITICAL (MainThread) [supervisor.supervisor] Can't setup Supervisor Docker container!
~WARNING (SyncWorker_0) [supervisor.docker.manager] Can't get None for cleanup
~docker
deamon onhost
machine to support required method of logging (or find an easy way of doing that for users):WARNING (MainThread) [supervisor.resolution.evaluations.docker_configuration] Docker logging driver json-file is not supported!
AppArmor
(but where? in container or on host?):WARNING (MainThread) [supervisor.host.apparmor] AppArmor is not enabled on host
WARNING (MainThread) [supervisor.resolution.evaluations.base] AppArmor is required for Home Assistant. (more-info: https://www.home-assistant.io/more-info/unsupported/apparmor)
WARNING (MainThread) [supervisor.resolution.evaluations.base] Supervisor does not run in Privileged mode. (more-info: https://www.home-assistant.io/more-info/unsupported/privileged)
CRITICAL (MainThread) [supervisor.hardware.monitor] Not privileged to run udev monitor!
WARNING (MainThread) [supervisor.resolution.evaluations.base] System run with disabled trusted content security. (more-info: https://www.home-assistant.io/more-info/unsupported/content_trust)
~WARNING (MainThread) [supervisor.security.module] Disabled content-trust, skip validation
~SUPERVISOR_DEV: 1
):~0.00s - Debugger warning: It seems that frozen modules are being used, which may make the debugger miss breakpoints. Please pass -Xfrozen_modules=off to python to disable frozen modules. Note: Debugging will proceed. Set PYDEVD_DISABLE_FILE_VALIDATION=1 to disable this validation.
~cli
docker
plugin in container:~INFO (MainThread) [supervisor.plugins.base] No cli plugin Docker image None found.
~WARNING (MainThread) [supervisor.plugins.base] Error on installing cli plugin, retrying in 30sec
~INFO (MainThread) [supervisor.docker.interface] Found None versions: [<AwesomeVersion CalVer '22.04'>, <AwesomeVersion SpecialContainer 'latest'>, <AwesomeVersion SpecialContainer 'latest'>, <AwesomeVersion SpecialContainer 'latest'>, <AwesomeVersion SpecialContainer 'latest'>, <AwesomeVersion SemVer '2.19.4'>, <AwesomeVersion SpecialContainer 'latest'>]
~docker-compose
example: