Cannot Create or access a MariaDb database

  • I have setup LibreELEC 11.03.00 on a Hugsun X99

    I attempted to use the same advancedsettings.xml that I have used from other devices (Raspberry Pi 4 using Pi's OS and Kodi 19.4, and generic Amlogic devices using CoreELEC and Kodo 20.2) to access by back-end MariaDB database. This did not work; an extract of kodi.log is attached, named "kodi log extract remote.txt".

    I then installed the MariaDB sql server addon, modified advancedsettings.xml accordingly and attempted to connect to it. Again, it did notwork; an extract of kodi.log is attached, named "kodi log extract local.txt"

    I would appreciate guidance from anyone who might know what is the problem, and how I might fix it.

    Many thanks, Peter

  • Is "wait for network" enabled in LE network settings? If no, enable it else Kodi can start and will attempt to connect before it's available and DB connectivity doesn't wait/cycle, the connection either succeeds or fails. If the network is now up (presumably, to get logs) you can also run "systemctl restart kodi" and it should connect to setup the DB. If no, then it's some other issue like trying to connect to an outdated MariaDB version; although that normally flags a different error.

  • Yes, wait for network set to 10 secs. But would any network issue cause the inability to access the database on localhost?

    Version of MariaDB on remote server is 5.5.5-10.5.21-MariaDB-0+deb11u1, on local machine is 5.5.5-10.11.5-MariaDB


  • But as you suggested, I tried again to reboot with advancedsettings.xml pointing to the remote server, then waited for quite some time (like hours, I was interrupted by other things) and then did "systemctl restart kodi", and the remote database is connected properly. So thanks for your solution. I'll experiment with increasing the wait for network setting to achieve a reliable connection when I reboot.

  • But would any network issue cause the inability to access the database on localhost?

    "localhost" configuration is special. As a mariadb/mysqld feature it is using the unix socket. But Kodi's mariadb-connector-c defaults to /tmp/mysql.sock whereas the mariadb addon is configured to /run/mariadb/mysql.sock.

    TL;DR: Unless it is fixed use 127.0.0.1 instead.

  • Thanks, using 127.0.0.1 instead of localhost does fix the problem with opening the mariadb on the same system

    However, accessing a mariadb on a remote system is still an issue. I've increased the wait to 60 seconds, and still no database connection at boot time. It is evident that the system is not waiting for the time to elapse before the user interface is shown with no database connected. Irrespective of the parameter, the user interface shows in <10 seconds. When connected via ssh, I repeatedly systemctl restart mariadb and systemctl restart kodi and eventually the database does connect; taking between 15 and 30 attempts. A work around but hardly optimal!

  • For remote DB the local mariadb should have no effect. If kodi does not connect while network is up (you are connected via ssh) this is likely something different.

    For complete debug logging insert

    Code
    <loglevel hide="false">1</loglevel>
    <debug>
      <showloginfo>false</showloginfo>
    </debug>

    to your advancedsettings.xml and activate Database Component Logging in Kodi settings.

    Reboot. When Kodi is hanging execute pastekodi via ssh and post the URL.