Just some tips I gathered over time. All in one easily reachable place so I can share it wherever I want.
Some of it is just for me to copy and paste from :)
- HAOS Tips
This is useful to test shell_command
/command_line
or similar things.
Addons are docker containers so I might refer to them either way.
You need the Advanced SSH Addon with disabled protection mode
Make sure to restart the addon for it to take effect. THis gives you access to the docker
command.
Use docker ps
to list containers/addons
docker ps --format '{{.Names}}'
Or just docker ps
which is more verbose
docker ps
To also show stopped containers/addons
docker ps -a
The output can look similar to this
# docker ps --format '{{.Names}}'
hassio_supervisor
addon_a0d7b954_sqlite-web
addon_a0d7b954_nodered
addon_core_configurator
addon_core_samba
addon_core_ssh
addon_a0d7b954_vscode
addon_a0d7b954_glances
addon_a0d7b954_ssh
addon_core_mosquitto
hassio_multicast
hassio_audio
hassio_dns
hassio_cli
homeassistant
hassio_observer
To now enter a runing container you can use something like this
docker exec -ti homeassistant sh
Use CTRL+D
or exit
to get out again.
To just run a simple command you can do something like this
docker exec homeassistant cat /OFFICIAL_IMAGE
Depends on information above.
This can be useful to check where an addon stores its configuration.
docker inspect homeassistant | jq .[].Mounts
Depends on information above.
docker inspect addon_core_mosquitto | jq .[].HostConfig."PortBindings"
I have a separate article about how to check this here.
ha dns options --servers dns://DNSSERVERIPHERE --fallback=false
# Might not be needed
ha dns restart
HAOS itself has no package manager but most addons are based on Alpine and it has many packages.
For example
apk add gdu
gdu /
I trust you have good reasons for needing this. Proceed at your own risk.
You can gain access to the OS' CLI through the the Advanced SSH addon like this
docker run --rm --privileged --pid=host -it alpine:latest nsenter -t 1 -m -u -n -i sh
You need the Advanced SSH addon with disabled protection mode (restart it after disabling it) to get access to the docker
command.
I recommend this way because it's very simple to enable/disable, you can use a proper SSH client and you can just copy & paste commands.
Typing all the commands in via keyboard & monitor is quite cumbersome, especially because you cannot change the keyboard layout.
This requires logging in via developer SSH access on port 22222
.
Use a keyboard and monitor or the display/serial/terminal your hypervisor provides to access the OS.
I have instructions on how to set up a serial terminal with Proxmox VE here.