I’ve installed the MariaDB addon from the hass.io addon store, but can’t get it to work for a hill of beans.
The addon config:
{
"databases": [
"homeassistant"
],
"logins": [
{
"username": "hass",
"host": "core-mariadb",
"password": "password"
}
],
"rights": [
{
"username": "hass",
"host": "core-mariadb",
"database": "homeassistant",
"grant": "ALL PRIVILEGES ON"
}
]
}
I have tried variations of hosts, different users (hardcoded in config or as hass user), same issue.
When the addon is FIRST run, these are the docker logs generated:
[INFO] Create a new mariadb initial system
2019-09-14 22:46:49 0 [ERROR] InnoDB: preallocating 12582912 bytes for file ./ibdata1 failed with error 95
2019-09-14 22:46:49 0 [ERROR] InnoDB: Could not set the file size of './ibdata1'. Probably out of disk space
2019-09-14 22:46:49 0 [ERROR] InnoDB: Database creation was aborted with error Generic error. You may need to delete the ibdata1 file before trying to start up again.
2019-09-14 22:46:50 0 [ERROR] Plugin 'InnoDB' init function returned error.
2019-09-14 22:46:50 0 [ERROR] Plugin 'InnoDB' registration as a STORAGE ENGINE failed.
2019-09-14 22:46:50 0 [ERROR] Unknown/unsupported storage engine: InnoDB
2019-09-14 22:46:50 0 [ERROR] Aborting
When running a subsequent time, these are the logs:
[INFO] Use exists mariadb initial system
[INFO] Start MariaDB
190914 22:48:44 mysqld_safe Logging to '/data/databases/core-mariadb.err'.
190914 22:48:44 mysqld_safe Starting mysqld daemon with databases from /data/databases
BUT CHECK THIS OUT
If I go into the container, I can watch the PID of this sleep 1
command increment every second.
~/hass-shortcut(master*) » docker exec -i -t addon_core_mariadb bash
bash-4.4# ps au
PID USER TIME COMMAND
1 root 0:00 /sbin/docker-init -- /run.sh
6 root 0:00 {run.sh} /bin/bash /run.sh
392 root 0:00 bash
400 root 0:00 sleep 1
The addon logs show this here, which aligns with the run.sh code below
[INFO] Use exists mariadb initial system
[INFO] Start MariaDB
190914 22:30:48 mysqld_safe Logging to '/data/databases/core-mariadb.err'.
190914 22:30:48 mysqld_safe Starting mysqld daemon with databases from /data/databases
The run.sh code, where we can see the above logs being generated, and also the sleep 1
. So it looks like it’s making it to mysqld_safe --datadir="$MARIADB_DATA" --user=root --skip-log-bin < /dev/null &
and failing.
# Init mariadb
if [ ! -d "$MARIADB_DATA" ]; then
echo "[INFO] Create a new mariadb initial system"
mysql_install_db --user=root --datadir="$MARIADB_DATA" > /dev/null
else
echo "[INFO] Use exists mariadb initial system"
fi
# Start mariadb
echo "[INFO] Start MariaDB"
mysqld_safe --datadir="$MARIADB_DATA" --user=root --skip-log-bin < /dev/null &
MARIADB_PID=$!
# Wait until DB is running
while ! mysql -e "" 2> /dev/null; do
sleep 1
done
If I check my /data/databases/core-maridb.err
file, I see the errors just below, which may be preventing mariadb from running. Unfortunately, all of the info I could pull up on this is mostly based around Docker on Mac, or Docker on Windows… HASS in this case is running as hass.io on a bare metal Arch linux install. All other docker containers are working just fine, including HASS.io itself.
2019-09-14 22:48:45 0 [ERROR] InnoDB: The Auto-extending innodb_system data file './ibdata1' is of a different size 0 pages than specified in the .cnf file: initial 768 pages, max 0 (relevant if non-zero) pages!
2019-09-14 22:48:45 0 [ERROR] InnoDB: Plugin initialization aborted with error Generic error
2019-09-14 22:48:45 0 [Note] InnoDB: Starting shutdown...
2019-09-14 22:48:45 0 [ERROR] Plugin 'InnoDB' init function returned error.
2019-09-14 22:48:45 0 [ERROR] Plugin 'InnoDB' registration as a STORAGE ENGINE failed.
2019-09-14 22:48:45 0 [Note] Plugin 'FEEDBACK' is disabled.
2019-09-14 22:48:45 0 [ERROR] Could not open mysql.plugin table. Some plugins may be not loaded
2019-09-14 22:48:45 0 [ERROR] Unknown/unsupported storage engine: InnoDB
2019-09-14 22:48:45 0 [ERROR] Aborting
Thinking that disk space could be a culprit (I was desperate, and held little faith it would work) I ran /usr/share/hassio/addons/data/core_mariadb » docker rmi $(docker images -f "dangling=true" -q)
to clear up the cruft. I was right; it didn’t work.
Hopefully that’s enough data to help someone recognize this issue. I imagine it’s something as simple as a my.cnf update, or perhaps it’s not.