dpkg error after zoneminder installation

Discussions related to the 1.36.x series of ZoneMinder
Post Reply
ob3ron
Posts: 5
Joined: Tue Oct 26, 2021 3:23 pm

dpkg error after zoneminder installation

Post 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!
dougmccrary
Posts: 1172
Joined: Sat Aug 31, 2019 7:35 am
Location: San Diego

Re: dpkg error after zoneminder installation

Post 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.
ob3ron
Posts: 5
Joined: Tue Oct 26, 2021 3:23 pm

Re: dpkg error after zoneminder installation

Post 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.
User avatar
iconnor
Posts: 2879
Joined: Fri Oct 29, 2010 1:43 am
Location: Toronto
Contact:

Re: dpkg error after zoneminder installation

Post 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
ob3ron
Posts: 5
Joined: Tue Oct 26, 2021 3:23 pm

Re: dpkg error after zoneminder installation

Post by ob3ron »

Ok, thanks iconnor. So clearing the mysql root password would be the workaround in the meantime?
Magic919
Posts: 1381
Joined: Wed Sep 18, 2013 6:56 am

Re: dpkg error after zoneminder installation

Post by Magic919 »

Making sure the DB can use the user/password in debian.cnf would be sensible.
-
ob3ron
Posts: 5
Joined: Tue Oct 26, 2021 3:23 pm

Re: dpkg error after zoneminder installation

Post 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.
Magic919
Posts: 1381
Joined: Wed Sep 18, 2013 6:56 am

Re: dpkg error after zoneminder installation

Post 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.
-
ob3ron
Posts: 5
Joined: Tue Oct 26, 2021 3:23 pm

Re: dpkg error after zoneminder installation

Post 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
Post Reply