Page 1 of 1

New Install with DB on remote host - debian-sys-maint

Posted: Sun Dec 20, 2020 2:40 am
by zxarr
I just installed zoneminder 1.35.16 on Ubuntu 20.04, without any issues, it seemed. Once installed, I migrated the newly created DB to a mysql VM where I keep most DB's. Zoneminder starts, I can add cameras, etc... but when I try to create a zone, nothing happens. The log states:

Code: Select all

Can't insert event: The user specified as a definer ('debian-sys-maint'@'localhost') does not exist. sql was (INSERT INTO Events ( MonitorId, StorageId, Name, StartDateTime, Width, Height, Cause, Notes, StateId, Orientation, Videoed, DefaultVideo, SaveJPEGs, Scheme ) VALUES ( 1, 2, 'New Event', from_unixtime( 1608431738 ), 2560, 1440, 'Continuous', '', 1, 1, 0, '', 3, 'Medium' ))  zm_event.cpp	line 111
I no longer have a mysql server on the zoneminder host, so I'm not really sure where zoneminder is getting this user from, aside from /etc/mysql/debian.cnf. Why would zoneminder be ignoring the zm.conf file for some DB calls?

I'm assuming I copied something over with the DB that includes this user, for whatever reason, so I did some searching and learned that some table views have a definer. If this is the issue, how do I find out? I tried a few commands I'd found online, but they listed 0 views in the DB.

Not sure where to go next. Any help would be appreciated.

Re: New Install with DB on remote host - debian-sys-maint

Posted: Sun Dec 20, 2020 4:45 pm
by bbunge
nano /etc/zm/zm.conf

ZM_DB_HOST=192.168.50.2

Make sure the ZM User has the right password and permissions on the remote database server.

Re: New Install with DB on remote host - debian-sys-maint

Posted: Sun Dec 20, 2020 8:06 pm
by zxarr
bbunge wrote: Sun Dec 20, 2020 4:45 pm nano /etc/zm/zm.conf

ZM_DB_HOST=192.168.50.2

Make sure the ZM User has the right password and permissions on the remote database server.
I set up this additional storage in the ZM gui and it appears in the database:
Image

Code: Select all

ZM_DB_HOST=mysql
# ZoneMinder database name
ZM_DB_NAME=zm
# ZoneMinder database user
ZM_DB_USER=zm
# ZoneMinder database password
ZM_DB_PASS=*************
And lastly, the zm mysql user has All Privileges with Grant on the zm DB.

It almost seems that somewhere in zoneminder the debian-sys-maint@localhost user is hard-coded. Even if I granted access in the remote DB, it would fail, as it's attempting to connect to localhost, instead of the 'mysql' server.

Re: New Install with DB on remote host - debian-sys-maint

Posted: Mon Dec 21, 2020 2:55 am
by zxarr
So I discovered a workaround.

I created a debian-sys-maint user on my remote database, with the password from my zoneminder system's /etc/mysql/debian.cnf.

This is still an issue, why would zoneminder be ignoring what's set in zm.conf?

Re: New Install with DB on remote host - debian-sys-maint

Posted: Sat Dec 26, 2020 3:09 pm
by rockedge
zxarr wrote:why would zoneminder be ignoring what's set in zm.conf?
Are there any config files in /etc/zm/conf.d that are overriding the zm.conf? If so the configurations in /etc/zm/conf.d/*.conf will override the zm.conf by design.

Something like "zmcustom.conf" or "any-name.conf" will be the culprit if this is the case.