zm_database_init broken on SUSE Tumbleweed?

Forum for questions and support relating to the 1.34.x releases only.
Post Reply
ChristoSnake
Posts: 4
Joined: Mon May 11, 2020 1:15 pm
Location: Pretoria, ZA

zm_database_init broken on SUSE Tumbleweed?

Post by ChristoSnake »

Hi all...

I upgraded ZM to v1.34.12 yesterday and it's refused to start since then. Running jounalctl -xe after a failed start tells me the following:

Code: Select all

May 11 15:21:09 megaserver systemd[1]: Starting ZoneMinder Video Surveillance System...
-- Subject: A start job for unit zm.service has begun execution
-- Defined-By: systemd
-- Support: https://lists.freedesktop.org/mailman/listinfo/systemd-devel
-- 
-- A start job for unit zm.service has begun execution.
-- 
-- The job identifier is 15008.
May 11 15:21:09 megaserver zm_database_init[3862]: INFO: when db is correctly installed and you just reinstalled rpm, then answer all questions with 'n'
May 11 15:21:09 megaserver zm_database_init[3862]: Error:  User root needed to execute database init
May 11 15:21:09 megaserver systemd[1]: zm.service: Control process exited, code=exited, status=3/NOTIMPLEMENTED
-- Subject: Unit process exited
-- Defined-By: systemd
-- Support: https://lists.freedesktop.org/mailman/listinfo/systemd-devel
-- 
-- An ExecStartPre= process belonging to unit zm.service has exited.
-- 
-- The process' exit code is 'exited' and its exit status is 3.
May 11 15:21:09 megaserver systemd[1]: zm.service: Failed with result 'exit-code'.
-- Subject: Unit failed
-- Defined-By: systemd
-- Support: https://lists.freedesktop.org/mailman/listinfo/systemd-devel
-- 
-- The unit zm.service has entered the 'failed' state with result 'exit-code'.
May 11 15:21:09 megaserver systemd[1]: Failed to start ZoneMinder Video Surveillance System.
-- Subject: A start job for unit zm.service has failed
-- Defined-By: systemd
-- Support: https://lists.freedesktop.org/mailman/listinfo/systemd-devel
-- 
-- A start job for unit zm.service has finished with a failure.
-- 
-- The job identifier is 15008 and the job result is failed.
/etc/zm.conf contains the correct database user info for SUSE:

Code: Select all

# ZoneMinder database name
ZM_DB_NAME=zm

# ZoneMinder database user
ZM_DB_USER=zm_admin

# ZoneMinder database password
ZM_DB_PASS=<My super secret database password!>
Running zmupdate.pl is a happy activity:

Code: Select all

megaserver:/etc # zmupdate.pl

Database already at version 1.34.12, update skipped.
... but executing zm_database_init (as root) is much less so:

Code: Select all

megaserver:/etc # zm_database_init
INFO: when db is correctly installed and you just reinstalled rpm, then answer all questions with 'n'
database is already installed. if you want to recreate the database drop it manually!!
Too few arguments.
Error:  Command 'systemctl restart ' returned non-zero exit status 1.
Some more background:
  • /root/.my.cnf contains the root user's valid password.
  • zm_admin user has been granted all necessary rights to the zm database.
  • I've been unable to find any additional info in the logs.
Any ideas from the cleverer folks on the forum?

Oh, and since it's my very first post - thank you very much to all who contribute to Zoneminder and this forum! :D

Regards,
Christo (the snake man)
Regards,
Christo (the snake man)
ChristoSnake
Posts: 4
Joined: Mon May 11, 2020 1:15 pm
Location: Pretoria, ZA

Re: zm_database_init broken on SUSE Tumbleweed?

Post by ChristoSnake »

I managed to apply a workaround to get my Zoneminder running again :D

Because the failure occurs when executing zm_database_init from the zm.service file, and because I was convinced that the database is up to date & that my zm_admin user has the correct rights to it, I commented the "execstartpre" line from the startup script.

Zoneminder now starts, and everything seems fine. My RTSP streams are running, the log file is quiet and a quick walk test shows that the modect functionality is also working as expected.

Let's hope that it's a temporary problem related to my server that will be resolved by a future OS (or Zoneminder?) update...
Regards,
Christo (the snake man)
User avatar
knight-of-ni
Posts: 2406
Joined: Thu Oct 18, 2007 1:55 pm
Location: Shiloh, IL

Re: zm_database_init broken on SUSE Tumbleweed?

Post by knight-of-ni »

ZoneMinder on OpenSuse is managed by a third party that seldom visits the forum here. In particular, we did not write zm_database_init. You should contact the package maintainer for support. If there is a problem with something the maintainer wrote, I'm sure he would like to know about it.
Visit my blog for ZoneMinder related projects using the Raspberry Pi, Orange Pi, Odroid, and the ESP8266
All of these can be found at https://zoneminder.blogspot.com/
ChristoSnake
Posts: 4
Joined: Mon May 11, 2020 1:15 pm
Location: Pretoria, ZA

Re: zm_database_init broken on SUSE Tumbleweed?

Post by ChristoSnake »

Thanks for the reply! I've already contacted Dirk and he's undertaken to look into it for me...

Just for clarity, do other distros also make use of zm_database_init, or is it a SUSE-only "feature"?
Regards,
Christo (the snake man)
User avatar
knight-of-ni
Posts: 2406
Joined: Thu Oct 18, 2007 1:55 pm
Location: Shiloh, IL

Re: zm_database_init broken on SUSE Tumbleweed?

Post by knight-of-ni »

zm_database_init is a script that only exists in the OpenSuse package you are using. It does not exist in our source tree:
https://github.com/ZoneMinder/zoneminder
Visit my blog for ZoneMinder related projects using the Raspberry Pi, Orange Pi, Odroid, and the ESP8266
All of these can be found at https://zoneminder.blogspot.com/
ChristoSnake
Posts: 4
Joined: Mon May 11, 2020 1:15 pm
Location: Pretoria, ZA

Fixed: zm_database_init broken on SUSE Tumbleweed?

Post by ChristoSnake »

Thanks to the packager, this has been fixed...

In case anybody else runs into a similar issue in future, it was caused by the /etc/zm_database_init.conf that lost some of its configuration settings. The zm_database_init script assists SUSE users by automating the database creation & update steps that are manually performed in other distros.

In my case the file lost its "apache-service" setting. Adding it back in solved the issue:

Code: Select all

[ZmDatabaseInit]
mysql-host = localhost
mysql-bin = /usr/bin/mysql
database-initialized = yes
mysql-config = /root/.my.cnf
apache-service = apache2.service
allow-execution-only-as-root = yes

[ZoneMinder]
data-install-path = /usr/share/zoneminder
configuration-file = /etc/zm.conf
lock-file = %(data-install-path)s/lock
version-file = %(data-install-path)s/version
create-database-sql-file = %(data-install-path)s/db/zm_create.sql
path-to-zmupdate = /usr/bin/zmupdate.pl
backup-database-during-zmudpate = yes
web-path = /usr/share/zoneminder/www
cgi-path = /usr/lib/zoneminder/cgi-bin
old-events-dir = /srv/www/htdocs/zm/events
new-events-dir = /var/lib/zoneminder/events
Thanks again, Dirk!
Regards,
Christo (the snake man)
Post Reply