Page 1 of 1

dpkg error after zoneminder installation

Posted: Tue Oct 26, 2021 3:39 pm
by ob3ron
I have ZoneMinder up and running well, however there's an issue with dpkg where every time I upgrade any package on my system, it throws an error and I have to manually restart the zoneminder service:

Code: Select all

Errors were encountered while processing:
 zoneminder
E: Sub-process /usr/bin/dpkg returned an error code (1)
A package failed to install.  Trying to recover:
Setting up zoneminder (1.36.10-focal1) ...
detected systemd
Detected db service is mysql.service
Checking for db
mysqladmin: connect to server at 'localhost' failed
error: 'Access denied for user 'root'@'localhost' (using password: NO)'
Creating zm db
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO)
cat: write error: Broken pipe
Error creating db.
dpkg: error processing package zoneminder (--configure):
 installed zoneminder package post-installation script subprocess returned error exit status 1
Errors were encountered while processing:
 zoneminder
Obviously something went awry in my installation, and I don't want dpkg to re-create the zm database. Nor should it be trying to log in as root with no password. Searching has led me to look at /etc/zm/zm.conf and /lib/systemd/system/zoneminder.service but neither of those seem to be the source of the issue. Are you able to point me to where I would be able to fix this?

I'm on Mint 20.2 MATE. Thanks!

Re: dpkg error after zoneminder installation

Posted: Tue Oct 26, 2021 7:25 pm
by dougmccrary
That is supposed to work.
It's not trying to recreate the the DB, it's trying to update the structure.
I don't have the fix at hand, but it's on here somewhere.

Re: dpkg error after zoneminder installation

Posted: Thu Oct 28, 2021 1:50 pm
by ob3ron
Thanks. Any idea what search terms I might be able to use to find an answer? I don't seem to be able to turn anything up.

Re: dpkg error after zoneminder installation

Posted: Thu Oct 28, 2021 4:47 pm
by iconnor
The issue here is that you have set a root password for mysql instead of allowing it to use /etc/mysql/debian.cnf to auth. So ZM cannot do anything.

The problem is that we exit instead of trying to continue.

I will make it handle this a little more gracefully in .11

Re: dpkg error after zoneminder installation

Posted: Thu Oct 28, 2021 10:33 pm
by ob3ron
Ok, thanks iconnor. So clearing the mysql root password would be the workaround in the meantime?

Re: dpkg error after zoneminder installation

Posted: Fri Oct 29, 2021 6:22 am
by Magic919
Making sure the DB can use the user/password in debian.cnf would be sensible.

Re: dpkg error after zoneminder installation

Posted: Fri Oct 29, 2021 2:59 pm
by ob3ron
There is no user or password in /etc/mysql/debian.cnf -- I'm out of my depth with mysql configuration, and zoneminder settings, so trying to look through every config file that I can find is not proving to be useful.

I have cleared the mysql root password. I'm hoping that zoneminder is not going to recreate the database on the next dpkg run, and lose all my settings.

Re: dpkg error after zoneminder installation

Posted: Fri Oct 29, 2021 3:07 pm
by Magic919
If you are concerned, you should back it up. Look at mysqldump, it's pretty simple and good for the future.

The ZM DB scripts will start for checking for DB presence, then move on to making alterations where one exists. It's pretty standard stuff.

Re: dpkg error after zoneminder installation

Posted: Fri Oct 29, 2021 4:05 pm
by ob3ron
Thanks. Yes, I created a database backup, cleared the mysql root password, and ran dpkg, and everything worked with no errors.

Looking forward to the next zoneminder version to be able to set a root password again. :D