How does mariadb relate to mysqld?

NethServer Version: 7.4.1708
Module: mariadb
Hi,
when crawling through my NS, I was puzzled by mariadb vs mysql.
As far as I know, mariadb is the database of choice for NS. However, I find lots of files and references to mysql.
Even more, it gives me some problems:
I’ve installed Zoneminder (ZM) (via the @stephdl repo, thanks for that!), and sometimes after a reboot, ZM won’t start. I’ve looked into that, and here’s what I seem to have found:
(terminal output below, first the short version)

  • when asking for status of ZM, it reports a fail (some sql-statements can’t be inserted. DB related)

  • when asking status of mariadb, it reports ‘inactive, dead’. Maybe because mysql was initialized.

  • when asking status of mysqld, it reports active, running.

  • I manually stop service mysqld,

  • I manually start service mariadb (both succesfully).

  • After that I can start ZM manually succesfully.

So, it looks to me mysqld and mariadb are like aliases, but ZM only wants to start if the running service is named mariadb.
Is that indeed the case? And how to fix the starting of the db in such a way that ZM can proceed?
(I hope I clarified, if any other info is needed please ask)

root@helium:~> $ service mariadb status
Redirecting to /bin/systemctl status mariadb.service
● mariadb.service - MariaDB database server
Loaded: loaded (/usr/lib/systemd/system/mariadb.service; disabled; vendor preset: disabled)
Active: inactive (dead) since Mon 2018-02-12 21:10:33 CET; 19h ago
Main PID: 1484 (code=exited, status=0/SUCCESS)

Feb 12 21:07:53 helium.rolfbakker.nl systemd[1]: Starting MariaDB database server…
Feb 12 21:08:02 helium.rolfbakker.nl mariadb-prepare-db-dir[1070]: Database MariaDB is probably initialized in /var/lib/mysql already, nothing is done.
Feb 12 21:08:02 helium.rolfbakker.nl mariadb-prepare-db-dir[1070]: If this is not the case, make sure the /var/lib/mysql is empty before running mari…db-dir.
Feb 12 21:08:06 helium.rolfbakker.nl mysqld_safe[1484]: 180212 21:08:06 mysqld_safe Logging to ‘/var/log/mariadb/mariadb.log’.
Feb 12 21:08:06 helium.rolfbakker.nl mysqld_safe[1484]: 180212 21:08:06 mysqld_safe Starting mysqld daemon with databases from /var/lib/mysql
Feb 12 21:08:40 helium.rolfbakker.nl systemd[1]: Started MariaDB database server.
Hint: Some lines were ellipsized, use -l to show in full.

root@helium:~> $ service mysqld status
Redirecting to /bin/systemctl status mysqld.service
● mysqld.service - MariaDB database server
Loaded: loaded (/usr/lib/systemd/system/mysqld.service; enabled; vendor preset: disabled)
Active: active (running) since Mon 2018-02-12 21:08:40 CET; 19h ago
Main PID: 1482 (mysqld_safe)
CGroup: /system.slice/mysqld.service
├─1482 /bin/sh /usr/bin/mysqld_safe --basedir=/usr
└─3738 /usr/libexec/mysqld --basedir=/usr --datadir=/var/lib/mysql --plugin-dir=/usr/lib64/mysql/plugin --log-error=/var/log/mariadb/mariadb.log …

Feb 12 21:07:53 helium.rolfbakker.nl systemd[1]: Starting MariaDB database server…
Feb 12 21:08:02 helium.rolfbakker.nl mariadb-prepare-db-dir[1100]: Database MariaDB is probably initialized in /var/lib/mysql already, nothing is done.
Feb 12 21:08:02 helium.rolfbakker.nl mariadb-prepare-db-dir[1100]: If this is not the case, make sure the /var/lib/mysql is empty before running mari…db-dir.
Feb 12 21:08:06 helium.rolfbakker.nl mysqld_safe[1482]: 180212 21:08:06 mysqld_safe Logging to ‘/var/log/mariadb/mariadb.log’.
Feb 12 21:08:06 helium.rolfbakker.nl mysqld_safe[1482]: 180212 21:08:06 mysqld_safe Starting mysqld daemon with databases from /var/lib/mysql
Feb 12 21:08:40 helium.rolfbakker.nl systemd[1]: Started MariaDB database server.
Hint: Some lines were ellipsized, use -l to show in full.

root@helium:~> $ service mysqld stop
Redirecting to /bin/systemctl stop mysqld.service

root@helium:~> $ service mariadb start
Redirecting to /bin/systemctl start mariadb.service

root@helium:~> $ service mariadb status
Redirecting to /bin/systemctl status mariadb.service
● mariadb.service - MariaDB database server
Loaded: loaded (/usr/lib/systemd/system/mariadb.service; disabled; vendor preset: disabled)
Active: active (running) since Tue 2018-02-13 16:28:05 CET; 8s ago
Process: 20539 ExecStartPost=/usr/libexec/mariadb-wait-ready $MAINPID (code=exited, status=0/SUCCESS)
Process: 20507 ExecStartPre=/usr/libexec/mariadb-prepare-db-dir %n (code=exited, status=0/SUCCESS)
Main PID: 20538 (mysqld_safe)
CGroup: /system.slice/mariadb.service
├─20538 /bin/sh /usr/bin/mysqld_safe --basedir=/usr
└─20712 /usr/libexec/mysqld --basedir=/usr --datadir=/var/lib/mysql --plugin-dir=/usr/lib64/mysql/plugin --log-error=/var/log/mariadb/mariadb.log…

Feb 13 16:28:03 helium.rolfbakker.nl systemd[1]: Starting MariaDB database server…
Feb 13 16:28:03 helium.rolfbakker.nl mariadb-prepare-db-dir[20507]: Database MariaDB is probably initialized in /var/lib/mysql already, nothing is done.
Feb 13 16:28:03 helium.rolfbakker.nl mariadb-prepare-db-dir[20507]: If this is not the case, make sure the /var/lib/mysql is empty before running mar…db-dir.
Feb 13 16:28:03 helium.rolfbakker.nl mysqld_safe[20538]: 180213 16:28:03 mysqld_safe Logging to ‘/var/log/mariadb/mariadb.log’.
Feb 13 16:28:03 helium.rolfbakker.nl mysqld_safe[20538]: 180213 16:28:03 mysqld_safe Starting mysqld daemon with databases from /var/lib/mysql
Feb 13 16:28:05 helium.rolfbakker.nl systemd[1]: Started MariaDB database server.
Hint: Some lines were ellipsized, use -l to show in full.

root@helium:~> $ service mysqld status
Redirecting to /bin/systemctl status mysqld.service
● mysqld.service - MariaDB database server
Loaded: loaded (/usr/lib/systemd/system/mysqld.service; enabled; vendor preset: disabled)
Active: inactive (dead) since Tue 2018-02-13 16:27:58 CET; 39s ago
Main PID: 1482 (code=exited, status=0/SUCCESS)

Feb 12 21:07:53 helium.rolfbakker.nl systemd[1]: Starting MariaDB database server…
Feb 12 21:08:02 helium.rolfbakker.nl mariadb-prepare-db-dir[1100]: Database MariaDB is probably initialized in /var/lib/mysql already, nothing is done.
Feb 12 21:08:02 helium.rolfbakker.nl mariadb-prepare-db-dir[1100]: If this is not the case, make sure the /var/lib/mysql is empty before running mari…db-dir.
Feb 12 21:08:06 helium.rolfbakker.nl mysqld_safe[1482]: 180212 21:08:06 mysqld_safe Logging to ‘/var/log/mariadb/mariadb.log’.
Feb 12 21:08:06 helium.rolfbakker.nl mysqld_safe[1482]: 180212 21:08:06 mysqld_safe Starting mysqld daemon with databases from /var/lib/mysql
Feb 12 21:08:40 helium.rolfbakker.nl systemd[1]: Started MariaDB database server.
Feb 13 16:27:53 helium.rolfbakker.nl systemd[1]: Stopping MariaDB database server…
Feb 13 16:27:58 helium.rolfbakker.nl systemd[1]: Stopped MariaDB database server.
Hint: Some lines were ellipsized, use -l to show in full.

root@helium:~> $ service zoneminder start
Redirecting to /bin/systemctl start zoneminder.service

root@helium:~> $ service zoneminder status
Redirecting to /bin/systemctl status zoneminder.service
● zoneminder.service - ZoneMinder CCTV recording and security system
Loaded: loaded (/usr/lib/systemd/system/zoneminder.service; enabled; vendor preset: disabled)
Active: active (running) since Tue 2018-02-13 16:29:41 CET; 3s ago
Process: 20914 ExecStart=/usr/bin/zmpkg.pl start (code=exited, status=0/SUCCESS)
Main PID: 20930 (zmdc.pl)
CGroup: /system.slice/zoneminder.service
├─20930 /usr/bin/perl -wT /usr/bin/zmdc.pl startup
├─20983 /usr/bin/zmc -m 1
├─21000 /usr/bin/zmc -d /dev/video0
├─21003 /usr/bin/zma -m 2
├─21021 /usr/bin/zmc -m 4
├─21040 /usr/bin/zma -m 4
├─21043 /usr/bin/perl -wT /usr/bin/zmfilter.pl
├─21055 /usr/bin/perl -wT /usr/bin/zmaudit.pl -c
└─21063 /usr/bin/perl -wT /usr/bin/zmwatch.pl

Feb 13 16:29:42 helium.rolfbakker.nl zmwatch[21063]: INF [Watchdog starting]
Feb 13 16:29:42 helium.rolfbakker.nl zmfilter[21043]: INF [Scanning for events]
Feb 13 16:29:42 helium.rolfbakker.nl zmwatch[21063]: INF [Watchdog pausing for 30 seconds]
Feb 13 16:29:42 helium.rolfbakker.nl zma_m4[21040]: WAR [Waiting for capture daemon]
Feb 13 16:29:42 helium.rolfbakker.nl zma_m2[21003]: INF [USB-cam-1-voordeur: 031 - Gone into alarm state]
Feb 13 16:29:42 helium.rolfbakker.nl zma_m2[21003]: INF [USB-cam-1-voordeur: 031 - Opening new event 105767, alarm start]
Feb 13 16:29:43 helium.rolfbakker.nl zma_m2[21003]: INF [USB-cam-1-voordeur: 034 - Gone into alert state]
Feb 13 16:29:43 helium.rolfbakker.nl zma_m4[21040]: WAR [Waiting for capture daemon]
Feb 13 16:29:44 helium.rolfbakker.nl zma_m4[21040]: INF [In mode 3/1, warming up]
Feb 13 16:29:44 helium.rolfbakker.nl zma_m4[21040]: INF [Analysis fps (10.00) is lower than capturing fps (52.45), disabling adaptive skip feature]
root@helium:~> $

Hi @rolf,

I tested zoneminder now and just did

systemctl disable mysqld
systemctl enable mariadb

and it worked at least for the 3 reboots I tried…

You’re on the right track:

2 Likes

thanks @dnutan ,
but as @pnemenz added in that discussion: “and what does that mean to me”?
The link to the project card created by @davidep doesn’t work so I can’t see if it is regarded a bug, or if a workaround is available.
Does anyone know? Maybe @stephdl ?

Yes GitHub projects boards published at organization level still require an authenticated session on github. The card is still there,

I’d say it’s a (minor) bug.
zoneminder doesn’t come from @stephdl repo. It comes from zmrepo (zoneminder repo), and they have changed some things (for EL7: stable releases to rpmfusion, nightly builds to zmrepo), therefore the wiki will have to be updated.

I’ve tested a possible workaround:

systemctl disable --now mysqld
rm /usr/lib/systemd/system/mysqld.service
cd /usr/lib/systemd/system/ && ln -s mariadb.service mysqld.service
systemctl enable --now mysqld

it does not seem to cause any problem even when signaling mysql events, installing other modules requiring mariadb or after several reboots. Although a nethserver-mysql package update could break it.

Edit: is possible that after a reboot the mysqld service shows as “stopped” on server-manager (mariadb is running).
Updated the wiki.

1 Like

you’re right about the origin of the ZM-package. zmrepo is configured on my box.
I’ll try your workaround on my server; looks pretty straight-forward.
Thanks.