I did a test install of Home Assistant using docker on an Ubuntu 18 VM just to make sure it was going to meet my needs. I’ve now moved over to my production server (4 core Xeon @ 3.1GHz, 32Gb of memory), and I can’t get Home Assistant to boot up cleanly. I’m getting constant “Setup of recorder is taking over 10 seconds” and “database is locked” errors, which I don’t understand. It’s a clean install, Home Assistant just created the database, so how has it managed to lock itself at the same time? If I let it sit for ~30 minutes it’ll eventually come online, but with errors about missing dependencies.
Server load is negligible, there are Grafana, InfluxDB Telegraf containers running, along with Portainer, but more than enough power for Home Assistant (I’m averaging 4% CPU load). My data volume is a NFS share on my Synology, but again this worked on Ubuntu 18, and that device only averages ~6% CPU load, so that shouldn’t be causing these database locks.
I followed exactly the same steps as I did on my Ubuntu 18 test VM, so the only variable is that this is Ubuntu 20. Any ideas?
The process I used is below…
Docker Setup
sudo apt-get update
sudo apt-get install apt-transport-https ca-certificates curl gnupg-agent software-properties-common
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
sudo apt-key fingerprint 0EBFCD88
sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable"
sudo apt-get update
sudo apt-get install docker-ce docker-ce-cli containerd.io
sudo usermod -aG docker $USER
sudo systemctl enable docker
Docker Test
docker run hello-world
runs without error without running as root.
NFS Volume Creation
docker volume create --driver local --opt type=nfs --opt o=addr=172.16.1.250,rw --opt device=:/volume1/DockerHost/home-assistant home_assistant
Home Assistant Container Creation
docker run --init -d --name="home-assistant" -e "TZ=America/New_York" -v home_assistant:/config -v /dev/ttyUSB0:/dev/ttyUSB0 --restart=always --net=host homeassistant/home-assistant:stable
Note that /dev/ttyUSB0
is my USB-Serial adapter connected to my whole home audio controller.
Also notable is that the NFS volume was empty. Creating the container did build the directory structure (.cloud, deps, home-assistant_v2.db, and the yaml files). I tried rebuilding it again this morning, and in the time it has taken me to write this post it still hasn’t come online yet (not accessible through the browser). home-assistant.log just contains the following, and there’s no real load on the system. It’s like it has hung but the logs don’t really give any inclination as to why.
2020-05-25 09:07:04 WARNING (MainThread) [homeassistant.setup] Setup of recorder is taking over 10 seconds.
2020-05-25 09:13:16 ERROR (Recorder) [homeassistant.components.recorder] Error during connection setup: (sqlite3.OperationalError) database is locked
(Background on this error at: http://sqlalche.me/e/e3q8) (retrying in 3 seconds)
2020-05-25 09:19:40 ERROR (Recorder) [homeassistant.components.recorder] Error during connection setup: (sqlite3.OperationalError) database is locked
(Background on this error at: http://sqlalche.me/e/e3q8) (retrying in 3 seconds)
2020-05-25 09:26:04 ERROR (Recorder) [homeassistant.components.recorder] Error during connection setup: (sqlite3.OperationalError) database is locked
(Background on this error at: http://sqlalche.me/e/e3q8) (retrying in 3 seconds)
2020-05-25 09:32:28 ERROR (Recorder) [homeassistant.components.recorder] Error during connection setup: (sqlite3.OperationalError) database is locked
(Background on this error at: http://sqlalche.me/e/e3q8) (retrying in 3 seconds)
I could rebuild the whole thing on Ubuntu 18, but that would mean rebuilding Grafana, InfluxDB and Telegraf so I’d consider that a last resort. I didn’t use the supervised install since I read the horror stories about upgrading when everything is broken out into different containers. Maybe someone can give me some suggestions as to what I’m doing wrong (or whether it’s purely related to Ubuntu 20).