Addons: MariaDB: Initial startup issues

Created on 10 Aug 2019  路  5Comments  路  Source: home-assistant/addons

Description

I cannot connect to the addon from Home Assistant, potentially due to the issue I get when I initially start the addon after installation.

Home Assistant configuration:*

recorder:
  purge_keep_days: 3
  db_url: mysql://hass:securePassword@core-mariadb/homeassistant?charset=utf8

Logs in Home Assistant:

2019-08-10 19:41:51 ERROR (Recorder) [homeassistant.components.recorder] Error during connection setup: (MySQLdb._exceptions.OperationalError) (2002, "Can't connect to MySQL server on 'core-mariadb' (115)")
(Background on this error at: http://sqlalche.me/e/e3q8) (retrying in 3 seconds)
2019-08-10 19:41:54 ERROR (Recorder) [homeassistant.components.recorder] Error during connection setup: (MySQLdb._exceptions.OperationalError) (2002, "Can't connect to MySQL server on 'core-mariadb' (115)")
(Background on this error at: http://sqlalche.me/e/e3q8) (retrying in 3 seconds)
...

Env

Generic install:聽| 聽True
-- | ---
OS | Ubuntu 18.04
arch | x86_64
Addon version | 1.2
Supervisor version | 172
HA version | 0.97.1

Add-on configuration:

{
  "databases": [
    "homeassistant"
  ],
  "logins": [
    {
      "username": "hass",
      "host": "homeassistant",
      "password": "securePassword"
    }
  ],
  "rights": [
    {
      "username": "hass",
      "host": "homeassistant",
      "database": "homeassistant",
      "grant": "ALL PRIVILEGES ON"
    }
  ]
}

What has been tried so far:

  • Use "%" as the "host" in the addon configuration
  • Reinstall of the addon
  • Uninstall the addon, then reboot the host, then install the addon again.

Addon logs during the initial startup:

[INFO] Create a new mariadb initial system
2019-08-10 19:47:01 0 [ERROR] InnoDB: preallocating 12582912 bytes for file ./ibdata1 failed with error 95
2019-08-10 19:47:01 0 [ERROR] InnoDB: Could not set the file size of './ibdata1'. Probably out of disk space
2019-08-10 19:47:01 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-08-10 19:47:01 0 [ERROR] Plugin 'InnoDB' init function returned error.
2019-08-10 19:47:01 0 [ERROR] Plugin 'InnoDB' registration as a STORAGE ENGINE failed.
2019-08-10 19:47:01 0 [ERROR] Unknown/unsupported storage engine: InnoDB
2019-08-10 19:47:01 0 [ERROR] Aborting

At that point the addon stops.

Logs during all other startups:

[INFO] Use exists mariadb initial system
[INFO] Start MariaDB
190810 20:15:00 mysqld_safe Logging to '/data/databases/core-mariadb.err'.
190810 20:15:00 mysqld_safe Starting mysqld daemon with databases from /data/databases

At that point, the addon stay started, but it's not possible to use it.

logs from the supervisor:

19-08-10 18:12:43 INFO (SyncWorker_13) [hassio.docker.interface] Pull image homeassistant/amd64-addon-mariadb tag 1.2.
19-08-10 18:13:00 INFO (MainThread) [hassio.addons] Add-on 'core_mariadb' successfully installed
19-08-10 18:13:10 INFO (SyncWorker_19) [hassio.docker.addon] Start Docker add-on homeassistant/amd64-addon-mariadb with version 1.2
19-08-10 18:14:58 INFO (SyncWorker_18) [hassio.docker.interface] Clean addon_core_mariadb application
19-08-10 18:15:00 INFO (SyncWorker_18) [hassio.docker.addon] Start Docker add-on homeassistant/amd64-addon-mariadb with version 1.2

The container is pingable so there is communication between them:

sudo docker exec homeassistant ping core-mariadb
PING core-mariadb (172.30.33.1): 56 data bytes
64 bytes from 172.30.33.1: seq=0 ttl=64 time=0.072 ms
wontfix

Most helpful comment

@ludeeus, are you by chance using ZFS for your underlying Hass.io storage?

I was also hit by this and turns out there's an upstream incompatibility with MariaDB versions >= 10.2 and ZFS volumes due to the new way MariaDB preallocates file system space.
See https://jira.mariadb.org/browse/MDEV-16015 and https://github.com/docker-library/mariadb/issues/95 for more info.

I was able to workaround it by rebuilding the core-mariadb container using Alpine 3.7 (containing most recent MariaDB version prior to 10.2)

cd <hassio data dir>/addons/core/mariadb
docker build --build-arg BUILD_FROM=homeassistant/amd64-base:3.7 -t homeassistant/amd64-addon-mariadb:1.2 .

and restarting the addon

All 5 comments

@ludeeus, are you by chance using ZFS for your underlying Hass.io storage?

I was also hit by this and turns out there's an upstream incompatibility with MariaDB versions >= 10.2 and ZFS volumes due to the new way MariaDB preallocates file system space.
See https://jira.mariadb.org/browse/MDEV-16015 and https://github.com/docker-library/mariadb/issues/95 for more info.

I was able to workaround it by rebuilding the core-mariadb container using Alpine 3.7 (containing most recent MariaDB version prior to 10.2)

cd <hassio data dir>/addons/core/mariadb
docker build --build-arg BUILD_FROM=homeassistant/amd64-base:3.7 -t homeassistant/amd64-addon-mariadb:1.2 .

and restarting the addon

I am not, just a regular SSD.

So, I, too randomly had this exact problem when I restarted HA after making some config changes to a camera (no changes to the add-on or the recorder: config).

My solution was to hard-code the Hassio IP address into the db_url: instead of core-mariadb
e.g.

recorder:
  db_url: mysql://hass:[email protected]/homeassistant?charset=utf8

No idea what's going on with the add-on or Hassio that caused it to crap out.

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

What has helped for me is to change the host in add-on configuration to "%" in both places. That was a solution that I read about here: https://community.home-assistant.io/t/mariadb-add-on-trouble/37771/5?u=ifloris

Was this page helpful?
0 / 5 - 0 ratings

Related issues

nealeydee picture nealeydee  路  7Comments

ThomasThomsen01 picture ThomasThomsen01  路  5Comments

escoand picture escoand  路  9Comments

thisisme picture thisisme  路  10Comments

d0ugal picture d0ugal  路  14Comments