Home Assistant Supervisor on Docker on Ubuntu Changed to Core

I installed home assistant supervisor on ubuntu 20.04. The install went fine and I was up and running for a few days. I had to reboot the OS and noticed that the ha web interface couldn’t connect. There was no docker image for homeassistant running. When I started it, I got the core version (i.e., no supervisor option in the left menu. My other apps were missing as well. Also my Lutron lights appear but don’t work. It’s possible I may have trashed my ha image trying to fix the problem. Looking through the script I don’t see where ha was installed. I’ve tried restarting hassio.supervisor, both in docker and the service. How can I get the supervisor version back? This isn’t my production image so I can start from scratch if need be.

Update

I’ve read elsewhere that the supervisor version runs ha core. It would seem then that the supervisor is the one adding itself to the ha web page as well as the add-ons that are set to display in the left menu bar. Another alternative is that ha core checks some setting to determine if it will display the items. I’m just guessing here. I also don’t see anywhere in the install script that docker ha core image is created. Does the supervisor create it on start up?

I ran ha core info. It returned:

arch: amd64
audio_input: None
audio_output: None
boot: true
image: homeassistant/qemux86-64-homeassistant
ip_address: 172.30.32.1
last_version: 2020.12.1
machine: null
port: 8123
ssl: false
update_available: false
version: 2020.12.1
version_latest: 2020.12.1
wait_boot: 600
watchdog: true

This is the output from docker container ls -a:

CONTAINER ID   IMAGE                                           COMMAND                  CREATED        STATUS                    PORTS                  NAMES
4f81bc691845   f38d289d7db4                                    "/init"                  19 hours ago   Up 11 minutes                                    homeassistant
0fb3f3a99ad1   hassioaddons/node-red-amd64:7.2.11              "/init"                  20 hours ago   Up 20 hours                                      addon_a0d7b954_nodered
f339b792be37   hassioaddons/ssh-amd64:7.8.0                    "/init"                  20 hours ago   Up 20 hours                                      addon_a0d7b954_ssh
7bc9661db87c   homeassistant/amd64-hassio-multicast:3          "/init"                  20 hours ago   Up 20 hours                                      hassio_multicast
8e0c10ea76c7   homeassistant/amd64-hassio-cli:2020.11.1        "/init /bin/bash -c …"   20 hours ago   Up 20 hours                                      hassio_cli
aef5a7312f19   homeassistant/amd64-hassio-audio:17             "/init"                  20 hours ago   Up 20 hours                                      hassio_audio
e2ee60e266bf   homeassistant/amd64-hassio-dns:2020.11.0        "/init"                  20 hours ago   Up 20 hours                                      hassio_dns
63ff90f79651   homeassistant/amd64-hassio-supervisor           "/init"                  2 days ago     Up About an hour                                 hassio_supervisor
eba857f981cb   hassioaddons/lutron-cert-amd64:0.6.0            "/init"                  2 days ago     Exited (0) 20 hours ago                          addon_a0d7b954_lutron-cert
d8c820364a39   homeassistant/amd64-hassio-observer:2020.10.1   "/init"                  3 days ago     Up 20 hours               0.0.0.0:4357->80/tcp   hassio_observer

I followed instructions at: https://www.jamestucker.me/post/install-home-assistant-on-ubuntu-server-20-04/

This is the shell script that does the install:

#!/usr/bin/env bash
set -e

declare -a MISSING_PACKAGES

function info { echo -e "\e[32m[info] $*\e[39m"; }
function warn  { echo -e "\e[33m[warn] $*\e[39m"; }
function error { echo -e "\e[31m[error] $*\e[39m"; exit 1; }

warn ""
warn "If you want more control over your own system, run"
warn "Home Assistant as a VM or run Home Assistant Core"
warn "via a Docker container."
warn ""
warn "If you want to abort, hit ctrl+c within 10 seconds..."
warn ""

sleep 10

ARCH=$(uname -m)

IP_ADDRESS=$(hostname -I | awk '{ print $1 }')

BINARY_DOCKER=/usr/bin/docker

DOCKER_REPO=homeassistant

SERVICE_DOCKER="docker.service"
SERVICE_NM="NetworkManager.service"

FILE_DOCKER_CONF="/etc/docker/daemon.json"
FILE_INTERFACES="/etc/network/interfaces"
FILE_NM_CONF="/etc/NetworkManager/NetworkManager.conf"
FILE_NM_CONNECTION="/etc/NetworkManager/system-connections/default"

URL_RAW_BASE="https://raw.githubusercontent.com/home-assistant/supervised-installer/master/files"
URL_VERSION="https://version.home-assistant.io/stable.json"
URL_BIN_APPARMOR="${URL_RAW_BASE}/hassio-apparmor"
URL_BIN_HASSIO="${URL_RAW_BASE}/hassio-supervisor"
URL_DOCKER_DAEMON="${URL_RAW_BASE}/docker_daemon.json"
URL_HA="${URL_RAW_BASE}/ha"
URL_INTERFACES="${URL_RAW_BASE}/interfaces"
URL_NM_CONF="${URL_RAW_BASE}/NetworkManager.conf"
URL_NM_CONNECTION="${URL_RAW_BASE}/system-connection-default"
URL_SERVICE_APPARMOR="${URL_RAW_BASE}/hassio-apparmor.service"
URL_SERVICE_HASSIO="${URL_RAW_BASE}/hassio-supervisor.service"
URL_APPARMOR_PROFILE="https://version.home-assistant.io/apparmor.txt"

# Check env
command -v systemctl > /dev/null 2>&1 || MISSING_PACKAGES+=("systemd")
command -v nmcli > /dev/null 2>&1 || MISSING_PACKAGES+=("network-manager")
command -v apparmor_parser > /dev/null 2>&1 || MISSING_PACKAGES+=("apparmor")
command -v docker > /dev/null 2>&1 || MISSING_PACKAGES+=("docker")
command -v jq > /dev/null 2>&1 || MISSING_PACKAGES+=("jq")
command -v curl > /dev/null 2>&1 || MISSING_PACKAGES+=("curl")
command -v dbus-daemon > /dev/null 2>&1 || MISSING_PACKAGES+=("dbus")


if [ ! -z "${MISSING_PACKAGES}" ]; then
    warn "The following is missing on the host and needs "
    warn "to be installed and configured before running this script again"
    error "missing: ${MISSING_PACKAGES[@]}"
fi

# Check if Modem Manager is enabled
if systemctl list-unit-files ModemManager.service | grep enabled > /dev/null 2>&1; then
    warn "ModemManager service is enabled. This might cause issue when using serial devices."
fi

# Detect wrong docker logger config
if [ ! -f "$FILE_DOCKER_CONF" ]; then
  # Write default configuration
  info "Creating default docker daemon configuration $FILE_DOCKER_CONF"
  curl -sL ${URL_DOCKER_DAEMON} > "${FILE_DOCKER_CONF}"

  # Restart Docker service
  info "Restarting docker service"
  systemctl restart "$SERVICE_DOCKER"
else
  STORAGE_DRIVER=$(docker info -f "{{json .}}" | jq -r -e .Driver)
  LOGGING_DRIVER=$(docker info -f "{{json .}}" | jq -r -e .LoggingDriver)
  if [[ "$STORAGE_DRIVER" != "overlay2" ]]; then 
    warn "Docker is using $STORAGE_DRIVER and not 'overlay2' as the storage driver, this is not supported."
  fi
  if [[ "$LOGGING_DRIVER"  != "journald" ]]; then 
    warn "Docker is using $LOGGING_DRIVER and not 'journald' as the logging driver, this is not supported."
  fi
fi

# Check dmesg access
if [[ "$(sysctl --values kernel.dmesg_restrict)" != "0" ]]; then
    info "Fix kernel dmesg restriction"
    echo 0 > /proc/sys/kernel/dmesg_restrict
    echo "kernel.dmesg_restrict=0" >> /etc/sysctl.conf
fi

# Create config for NetworkManager
info "Creating NetworkManager configuration"
curl -sL "${URL_NM_CONF}" > "${FILE_NM_CONF}"
if [ ! -f "$FILE_NM_CONNECTION" ]; then
    curl -sL "${URL_NM_CONNECTION}" > "${FILE_NM_CONNECTION}"
fi

warn "Changes are needed to the /etc/network/interfaces file"
info "If you have modified the network on the host manualy, those can now be overwritten"
info "If you do not overwrite this now you need to manually adjust it later"
info "Do you want to proceed with that? [N/y] "
read answer < /dev/tty

if [[ "$answer" =~ "y" ]] || [[ "$answer" =~ "Y" ]]; then
    info "Replacing /etc/network/interfaces"
    curl -sL "${URL_INTERFACES}" > "${FILE_INTERFACES}";
fi

info "Restarting NetworkManager"
systemctl restart "${SERVICE_NM}"

# Parse command line parameters
while [[ $# -gt 0 ]]; do
    arg="$1"

    case $arg in
        -m|--machine)
            MACHINE=$2
            shift
            ;;
        -d|--data-share)
            DATA_SHARE=$2
            shift
            ;;
        -p|--prefix)
            PREFIX=$2
            shift
            ;;
        -s|--sysconfdir)
            SYSCONFDIR=$2
            shift
            ;;
        *)
            error "Unrecognized option $1"
            ;;
    esac
    shift
done

PREFIX=${PREFIX:-/usr}
SYSCONFDIR=${SYSCONFDIR:-/etc}
DATA_SHARE=${DATA_SHARE:-$PREFIX/share/hassio}
CONFIG=$SYSCONFDIR/hassio.json

# Generate hardware options
case $ARCH in
    "i386" | "i686")
        MACHINE=${MACHINE:=qemux86}
        HASSIO_DOCKER="$DOCKER_REPO/i386-hassio-supervisor"
    ;;
    "x86_64")
        MACHINE=${MACHINE:=qemux86-64}
        HASSIO_DOCKER="$DOCKER_REPO/amd64-hassio-supervisor"
    ;;
    "arm" |"armv6l")
        if [ -z $MACHINE ]; then
            error "Please set machine for $ARCH"
        fi
        HASSIO_DOCKER="$DOCKER_REPO/armhf-hassio-supervisor"
    ;;
    "armv7l")
        if [ -z $MACHINE ]; then
            error "Please set machine for $ARCH"
        fi
        HASSIO_DOCKER="$DOCKER_REPO/armv7-hassio-supervisor"
    ;;
    "aarch64")
        if [ -z $MACHINE ]; then
            error "Please set machine for $ARCH"
        fi
        HASSIO_DOCKER="$DOCKER_REPO/aarch64-hassio-supervisor"
    ;;
    *)
        error "$ARCH unknown!"
    ;;
esac

if [[ ! "${MACHINE}" =~ ^(intel-nuc|odroid-c2|odroid-n2|odroid-xu|qemuarm|qemuarm-64|qemux86|qemux86-64|raspberrypi|raspberrypi2|raspberrypi3|raspberrypi4|raspberrypi3-64|raspberrypi4-64|tinker)$ ]]; then
    error "Unknown machine type ${MACHINE}!"
fi

### Main

# Init folders
if [ ! -d "$DATA_SHARE" ]; then
    mkdir -p "$DATA_SHARE"
fi

# Read infos from web
HASSIO_VERSION=$(curl -s $URL_VERSION | jq -e -r '.supervisor')

##
# Write configuration
cat > "$CONFIG" <<- EOF
{
    "supervisor": "${HASSIO_DOCKER}",
    "machine": "${MACHINE}",
    "data": "${DATA_SHARE}"
}
EOF

##
# Pull supervisor image
info "Install supervisor Docker container"
docker pull "$HASSIO_DOCKER:$HASSIO_VERSION" > /dev/null
docker tag "$HASSIO_DOCKER:$HASSIO_VERSION" "$HASSIO_DOCKER:latest" > /dev/null

docker pull "homeassistant/amd64-hassio-supervisor:20.12.7"
docker tag "homeassistant/amd64-hassio-supervisor:20.12.7" "homeassistant/amd64-hassio-supervisor:latest"

##
# Install Hass.io Supervisor
info "Install supervisor startup scripts"
curl -sL ${URL_BIN_HASSIO} > "${PREFIX}/sbin/hassio-supervisor"
curl -sL ${URL_SERVICE_HASSIO} > "${SYSCONFDIR}/systemd/system/hassio-supervisor.service"

sed -i "s,%%HASSIO_CONFIG%%,${CONFIG},g" "${PREFIX}"/sbin/hassio-supervisor
sed -i -e "s,%%BINARY_DOCKER%%,${BINARY_DOCKER},g" \
       -e "s,%%SERVICE_DOCKER%%,${SERVICE_DOCKER},g" \
       -e "s,%%BINARY_HASSIO%%,${PREFIX}/sbin/hassio-supervisor,g" \
       "${SYSCONFDIR}/systemd/system/hassio-supervisor.service"

chmod a+x "${PREFIX}/sbin/hassio-supervisor"
systemctl enable hassio-supervisor.service > /dev/null 2>&1;

#
# Install Hass.io AppArmor
info "Install AppArmor scripts"
mkdir -p "${DATA_SHARE}/apparmor"
curl -sL ${URL_BIN_APPARMOR} > "${PREFIX}/sbin/hassio-apparmor"
curl -sL ${URL_SERVICE_APPARMOR} > "${SYSCONFDIR}/systemd/system/hassio-apparmor.service"
curl -sL ${URL_APPARMOR_PROFILE} > "${DATA_SHARE}/apparmor/hassio-supervisor"

sed -i "s,%%HASSIO_CONFIG%%,${CONFIG},g" "${PREFIX}/sbin/hassio-apparmor"
sed -i -e "s,%%SERVICE_DOCKER%%,${SERVICE_DOCKER},g" \
    -e "s,%%HASSIO_APPARMOR_BINARY%%,${PREFIX}/sbin/hassio-apparmor,g" \
    "${SYSCONFDIR}/systemd/system/hassio-apparmor.service"

chmod a+x "${PREFIX}/sbin/hassio-apparmor"
systemctl enable hassio-apparmor.service > /dev/null 2>&1;
systemctl start hassio-apparmor.service


##
# Init system
info "Start Home Assistant Supervised"
systemctl start hassio-supervisor.service

##
# Setup CLI
info "Installing the 'ha' cli"
curl -sL ${URL_HA} > "${PREFIX}/bin/ha"
chmod a+x "${PREFIX}/bin/ha"

info
info "Home Assistant supervised is now installed"
info "First setup will take some time, when it's ready you can reach it here:"
info "http://${IP_ADDRESS}:8123"
info

What docker version are you running. ?

Firstly, Ubuntu isn’t a supported OS for a Supervised install. If you are starting fresh, use Debian 10

If you’ve done a fresh install, you’ve probably installed the 20.10 Docker update that breaks the Supervisor.

@francisp I just did the install last week. It’s 20.10.1. I did work initially and I didn’t upgrade it. Maybe I got lucky.

@kanga_who I manage a half dozen ubuntu images so was hoping to keep life simple. I’m not averse to another OS, I’ve used probably 20 different ones at one point or another. The reason I chose the docker supervisor route was to get the add-on store. I’ve read that you can run ha without docker. I’m familiar with python set ups as I have a few django sites. Is Ubuntu supported for this type of install? The only caveat is that I may also use the OS as an integration server for my django sites as well.

From the link you posted, I saw that there was a fix to the problem in beta. I followed the instructions to install it and it said I already have it install

root@ibex:/usr/share/hassio# ha supervisor options --channel beta
Command completed successfully.
root@ibex:/usr/share/hassio# ha supervisor reload
Command completed successfully.
root@ibex:/usr/share/hassio# ha supervisor update
Error: Version 2020.12.7 is already in use