Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MariaDB: Initial startup issues #653

Closed
ludeeus opened this issue Aug 10, 2019 · 5 comments
Closed

MariaDB: Initial startup issues #653

ludeeus opened this issue Aug 10, 2019 · 5 comments
Labels

Comments

@ludeeus
Copy link
Member

ludeeus commented Aug 10, 2019

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
@talltechdude
Copy link

@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 MariaDB/mariadb-docker#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

@ludeeus
Copy link
Member Author

ludeeus commented Aug 15, 2019

I am not, just a regular SSD.

@backcountrymountains
Copy link

backcountrymountains commented Aug 16, 2019

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.

@stale
Copy link

stale bot commented Sep 15, 2019

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.

@stale stale bot added the wontfix label Sep 15, 2019
@ludeeus ludeeus closed this as completed Sep 15, 2019
@iFloris
Copy link

iFloris commented Sep 16, 2019

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants