OpenEnergyMonitor Community

Problems upgrading from OpenHAB2 to OpenHAB3


I have been trying to upgrade from OpenHAB2 to OpenHAB3. In doing so, I seem to have broken emonpi … I now get the following error when trying to connect:

Can’t connect to database, please verify credentials/configuration in settings.ini
Error message: Connection refused

I think this is something to do with the database not running, so logging on to the emonpi via a shell, and querying the db status, I get this:

[email protected]:~ $ systemctl status mariadb.service
● mariadb.service - MariaDB 10.3.17 database server
   Loaded: loaded (/lib/systemd/system/mariadb.service; enabled; vendor preset: enabled)
   Active: deactivating (stop-sigterm) (Result: exit-code)
     Docs: man:mysqld(8)
  Process: 2054 ExecStartPre=/usr/bin/install -m 755 -o mysql -g root -d /var/run/mysqld (code=exited, status=0/SUCCESS)
  Process: 2055 ExecStartPre=/bin/sh -c systemctl unset-environment _WSREP_START_POSITION (code=exited, status=0/SUCCESS)
  Process: 2057 ExecStartPre=/bin/sh -c [ ! -e /usr/bin/galera_recovery ] && VAR= ||   VAR=`/usr/bin/galera_recovery`; [ $? -eq 0 ]   && systemctl set-environment _WSREP_START_POSITION=$VAR || exit 1 (co
  Process: 2106 ExecStart=/usr/sbin/mysqld $MYSQLD_OPTS $_WSREP_NEW_CLUSTER $_WSREP_START_POSITION (code=exited, status=1/FAILURE)
 Main PID: 2106 (code=exited, status=1/FAILURE)
   Status: "MariaDB server is down"
    Tasks: 3 (limit: 2319)
   Memory: 55.6M
   CGroup: /system.slice/mariadb.service
           └─667 /usr/sbin/mysqld

Oct 08 14:38:30 emonpi systemd[1]: Starting MariaDB 10.3.17 database server...
Oct 08 14:38:31 emonpi systemd[1]: mariadb.service: Found left-over process 667 (mysqld) in control group while starting unit. Ignoring.
Oct 08 14:38:31 emonpi systemd[1]: This usually indicates unclean termination of a previous run, or service implementation deficiencies.
Oct 08 14:38:31 emonpi mysqld[2106]: 2021-10-08 14:38:31 0 [Note] /usr/sbin/mysqld (mysqld 10.3.17-MariaDB-0+deb10u1) starting as process 2106 ...
Oct 08 14:39:08 emonpi systemd[1]: mariadb.service: Main process exited, code=exited, status=1/FAILURE 

Could anybody offer any advice?



If this is the OpenHab that was pre-installed many moons ago on the EmonSD, then it is on a very old and unsupported version of Raspbian.

The advice is to not run anything other than emoncms on an EmonPi as it can have unexpected consequences (as you have found).

If it is an old version, I suggest getting a new SD card, putting the EmonSD image on to it and importing your data. If it is this old, the import may be a little challenging but fixable.

Hi - no, it’s a relatively new EmonPi setup (about a year old) which I installed OpenHAB on in order to pass data to/from Loxone. Looks like I may have to install a new image on the SD card if I can’t fix the database issue …

My guess it that OpenHab uses a different config for mariadb than emoncms, but both need to use it.

I do not know if that service file is the default or not. The emoncms install does not change the default service file at all.

I’ve downloaded a clean version of the mariadb.service file from the latest distribution and can’t see any significant differences. So, I’m looking at re-installing the emonpi but can’t now get a backup of the database as it’s not running … any suggestions appreciated!

Lookup how to change the debug levels and check the mariaDB logs.