unsuccessful ZM installation

Forum for questions and support relating to the 1.30.x releases only.
Locked
ranagustavo
Posts: 8
Joined: Wed Oct 11, 2017 9:13 pm

unsuccessful ZM installation

Post by ranagustavo »

Hi,

since a couple of days, I'm trying to install ZM 1.30.4-xenial1 on a recently set up Ubuntu Server 16.04.
I've installed Ubuntu Server with LAMP and followed meticulously the instructions given on the relevant ZoneMinder Wiki page ("the easy way / 16.04 / 1.30.4"). https://wiki.zoneminder.com/Ubuntu_Serv ... e_easy_way

Since first attempt, there seems to be a problem with the database, especially with user / password, as there always appears:
"DBI connect('database=zm;host=localhost','zmuser',...) failed: Access denied for user 'zmuser'@'localhost' (using password: YES)"
when installing (as root): apt install zoneminder (see below)

I've tried this with mySQL, then with MariaDB, changed root password and mySQL root password, deleted and re-added zm database / zmuser etc. and always left zm.conf untouched with default zmuser/zmpass. Always followed wiki's instructions.

Any suggestions?
Regards,
Stefan


DBI connect('database=zm;host=localhost','zmuser',...) failed: Access denied for user 'zmuser'@'localhost' (using password: YES) at /usr/share/perl5/ZoneMinder/Config.pm line 106.
Can't connect to db at /usr/share/perl5/ZoneMinder/Config.pm line 129.
BEGIN failed--compilation aborted at /usr/share/perl5/ZoneMinder/Config.pm line 129.
Compilation failed in require at /usr/bin/zmupdate.pl line 71.
BEGIN failed--compilation aborted at /usr/bin/zmupdate.pl line 71.
dpkg: Fehler beim Bearbeiten des Paketes zoneminder (--configure):
Unterprozess installiertes post-installation-Skript gab den Fehlerwert 255 zurück
bbunge
Posts: 2934
Joined: Mon Mar 26, 2012 11:40 am
Location: Pennsylvania

Re: unsuccessful ZM installation

Post by bbunge »

It is possible you missed something in the install instructions.

1. if you are not sure you are logged in as root or super user add sudo to the beginning of each command

2. Install a minimal system using a net install CD: https://help.ubuntu.com/community/Insta ... /MinimalCD Install only LAMP, OpenSSH Server and system utilities.

3. Once your Ubuntu is set up and updated do the rest of the installs from a terminal on another PC. Putty (http://www.putty.org/) works well in Windows and you can copy the commands from the WIKI web page and paste, right click, into Putty.

4. Make sure you do the MySQL or Mariadb changes before you run the Zoneminder install!

5. Trust the instructions: https://wiki.zoneminder.com/Ubuntu_Serv ... e_easy_way
Yes, there are other ways to do things but time and again we have verified that this install procedure works! Time permitting I try to go over the installs once a week to insure some well meaning techie has not changed something he or she feels could be better. I've only been doing software documentation for 25+ years and I still make mistakes.

So, try again with a fresh Ubuntu install and read the instructions.
SteveGilvarry
Posts: 494
Joined: Sun Jun 29, 2014 1:12 pm
Location: Melbourne, AU

Re: unsuccessful ZM installation

Post by SteveGilvarry »

Didn't see any mention of confirming that the zmuser account was actually working fine connecting directly to mysql? Maybe check that, before you go around again.
Production Zoneminder 1.37.x (Living dangerously)
Random Selection of Cameras (Dahua and Hikvision)
ranagustavo
Posts: 8
Joined: Wed Oct 11, 2017 9:13 pm

Re: unsuccessful ZM installation

Post by ranagustavo »

Logging in to mysql as zmuser with zmpass seems to work:

root@ubuntu:~# mysql -u zmuser -p
Enter password:
Welcome to the MariaDB monitor. Commands end with ; or \g.
Your MariaDB connection id is 100
Server version: 10.0.31-MariaDB-0ubuntu0.16.04.2 Ubuntu 16.04

Copyright (c) 2000, 2017, Oracle, MariaDB Corporation Ab and others.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

MariaDB [(none)]>
ranagustavo
Posts: 8
Joined: Wed Oct 11, 2017 9:13 pm

Re: unsuccessful ZM installation

Post by ranagustavo »

Hi,

[...]
bbunge wrote: Thu Oct 12, 2017 12:51 am So, try again with a fresh Ubuntu install and read the instructions.
To be honest, this is not really possible at the moment, as the PC is abroad in a holiday cottage, > 1000 miles from here.

Last week I set up the "fresh" downloaded Ubuntu from a USB drive there with Lamp and openSSH, nothing more. Meanwhile I returned home and did the zm installation over my (router-) VPN and PuTTY (Windows). Through the whole process I logged in with sudo -i and followed the instructions, eg. apt update/upgrade/dist-upgrade, added sql_mode = NO_ENGINE_SUBSTITUTION ... The only mistake I remember was to install the mysql password verification plugin at first attempt, which drove me almost crazy. I could deinstall it after some google search.

It would be really helpful if there was another way to reset the installation without losing my SSH-access.

Thanks in advance
Stefan
bbunge
Posts: 2934
Joined: Mon Mar 26, 2012 11:40 am
Location: Pennsylvania

Re: unsuccessful ZM installation

Post by bbunge »

Try this:

Replace MySQL with Mariadb: https://wiki.zoneminder.com/Ubuntu_Serv ... _installed

If you do not want to use the old zm database do:
Create Zoneminder database in MySQL (Note: this also creates the default Zoneminder user and permissions in MySQL)

mysql -uroot -p < /usr/share/zoneminder/db/zm_create.sql

mysql -uroot -p -e "grant all on zm.* to 'zmuser'@localhost identified by 'zmpass';"

mysqladmin -uroot -p reload

All this can be done over VPN. You may want to consider adding Webmin to manage the system: http://www.webmin.com/deb.html
ranagustavo
Posts: 8
Joined: Wed Oct 11, 2017 9:13 pm

Re: unsuccessful ZM installation

Post by ranagustavo »

Hi bbunge,

I had already changed to Mariadb and now repeated your instructions to create a new zm database (which also was done by me before).

The installation of webmin succeeded but the zoneminder error persists:
apt-show-versions (0.22.7) wird eingerichtet ...
** initializing cache. This may take a while **
webmin (1.850) wird eingerichtet ...
Webmin install complete. You can now login to https://ubuntu:10000/
as root with your root password, or as any user who can use sudo
to run commands as root.
zoneminder (1.30.4-xenial1) wird eingerichtet ...
DBI connect('database=zm;host=localhost','zmuser',...) failed: Access denied for user 'zmuser'@'localhost' (using password: YES) at /usr/share/perl5/ZoneMinder/Config.pm line 106.
Can't connect to db at /usr/share/perl5/ZoneMinder/Config.pm line 129.
BEGIN failed--compilation aborted at /usr/share/perl5/ZoneMinder/Config.pm line 129.
Compilation failed in require at /usr/bin/zmupdate.pl line 71.
BEGIN failed--compilation aborted at /usr/bin/zmupdate.pl line 71.
dpkg: Fehler beim Bearbeiten des Paketes zoneminder (--configure):
Unterprozess installiertes post-installation-Skript gab den Fehlerwert 255 zurück
Trigger für systemd (229-4ubuntu19) werden verarbeitet ...
Trigger für ureadahead (0.100.0-19) werden verarbeitet ...
Fehler traten auf beim Bearbeiten von:
zoneminder
E: Sub-process /usr/bin/dpkg returned an error code (1)
root@ubuntu:/home/stefan#
sorry for my ubuntu in German language, but you'll recognize the errors, I guess.

If there's no other way, zoneminder has to wait until my next vacation (which probably won't be until next year :cry: )

Nevertheless, Thank you very much.
Stefan
User avatar
knight-of-ni
Posts: 2404
Joined: Thu Oct 18, 2007 1:55 pm
Location: Shiloh, IL

Re: unsuccessful ZM installation

Post by knight-of-ni »

You system is returning access denied for the zmuser account.... so the next thing to try is to manually login with that account from the command line to see what happens:

Code: Select all

mysql -uzmuser -p
If that succeeds (I suspect it won't), then make sure you can view the tables:

Code: Select all

use zm;
show tables;
exit;
If that fails, we need to see the entire output of the command previously given:

Code: Select all

mysql -uroot -p -e "grant all on zm.* to 'zmuser'@localhost identified by 'zmpass';"
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/
ranagustavo
Posts: 8
Joined: Wed Oct 11, 2017 9:13 pm

Re: unsuccessful ZM installation

Post by ranagustavo »

root@ubuntu:/home/stefan# mysql -u zmuser -p
Enter password:
Welcome to the MariaDB monitor. Commands end with ; or \g.
Your MariaDB connection id is 52
Server version: 10.0.31-MariaDB-0ubuntu0.16.04.2 Ubuntu 16.04

Copyright (c) 2000, 2017, Oracle, MariaDB Corporation Ab and others.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

MariaDB [(none)]> use zm;
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A

Database changed
MariaDB [zm]> show tables;
+----------------+
| Tables_in_zm |
+----------------+
| Config |
| ControlPresets |
| Controls |
| Devices |
| Events |
| Filters |
| Frames |
| Groups |
| Logs |
| MonitorPresets |
| Monitors |
| Servers |
| States |
| Stats |
| TriggersX10 |
| Users |
| ZonePresets |
| Zones |
+----------------+
18 rows in set (0.00 sec)

MariaDB [zm]>
then...
root@ubuntu:/home/stefan# mysql -uroot -p -e "grant all on zm.* to 'zmuser'@localhost identified by 'zmpass';"
Enter password:
root@ubuntu:/home/stefan#
Nothing seems to happen! (I use the same password for root@ubuntu (sudo su) and for root in mySQL). Even if y type an erroneous password, no response.
User avatar
knight-of-ni
Posts: 2404
Joined: Thu Oct 18, 2007 1:55 pm
Location: Shiloh, IL

Re: unsuccessful ZM installation

Post by knight-of-ni »

So from the mysql side, the account credentials are set up correctly.

Please post the contents of /etc/zm/zm.conf
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/
ranagustavo
Posts: 8
Joined: Wed Oct 11, 2017 9:13 pm

Re: unsuccessful ZM installation

Post by ranagustavo »

Code: Select all

# ==========================================================================
#
# ZoneMinder Base Configuration, $Date$, $Revision$
#
# ==========================================================================
#
# This file is generated by 'configure'. Care should be taken if manually
# editing this file as an changes may be overwritten by subsequent configuration
# or installations.
#

# Path to installed data directory, used mostly for finding DB upgrade scripts
ZM_PATH_DATA=/usr/share/zoneminder

# Path to ZoneMinder binaries
ZM_PATH_BIN=/usr/bin

# Path to ZoneMinder libraries (none at present, for future use)
ZM_PATH_LIB=/usr/lib/x86_64-linux-gnu

# Path to ZoneMinder configuration (this file only at present)
ZM_PATH_CONF=/etc/zm

# Path to ZoneMinder web files
ZM_PATH_WEB=/usr/share/zoneminder/www

# Path to ZoneMinder cgi files
ZM_PATH_CGI=/usr/lib/zoneminder/cgi-bin

# Username and group that web daemon (httpd/apache) runs as
ZM_WEB_USER=www-data
ZM_WEB_GROUP=www-data

# ZoneMinder database type: so far only mysql is supported
ZM_DB_TYPE=mysql

# ZoneMinder database hostname or ip address and optionally port or unix socket
# Acceptable formats include hostname[:port], ip_address[:port], or localhost:unix_socket
ZM_DB_HOST=localhost

# ZoneMinder database name
ZM_DB_NAME=zm

# ZoneMinder database user
ZM_DB_USER=zmuser

# ZoneMinder database password
ZM_DB_PASS==zmpass

# Do NOT set ZM_SERVER_HOST if you are not using Multi-Server
# You have been warned
#
# The name specified here must have a corresponding entry
# in the Servers tab under Options
ZM_SERVER_HOST=
hm, is it normal that there are two "=" in front of the password?
ranagustavo
Posts: 8
Joined: Wed Oct 11, 2017 9:13 pm

Re: unsuccessful ZM installation

Post by ranagustavo »

btw:

zm.conf has owner: root , group is www-data and chmod is 0740

Having deleted one of the "=", i came to:
root@ubuntu:/home/stefan# apt install zoneminder
Paketlisten werden gelesen... Fertig
Abhängigkeitsbaum wird aufgebaut.
Statusinformationen werden eingelesen.... Fertig
»zoneminder« ist bereits die neuste Version (1.30.4-xenial1).
0 aktualisiert, 0 neu installiert, 0 zu entfernen und 1 nicht aktualisiert.
1 nicht vollständig installiert oder entfernt.
Nach dieser Operation werden 0 B Plattenplatz zusätzlich benutzt.
Möchten Sie fortfahren? [J/n] j
zoneminder (1.30.4-xenial1) wird eingerichtet ...

Database already at version 1.30.4, update aborted.


Freshening configuration in database
Loading config from DB
Saving config to DB
Done Updating, starting ZoneMinder
zoneminder.service is a disabled or a static unit, not starting it.
root@ubuntu:/home/stefan#
I don't understand the last line "not starting it" but will try to go on with the setup (Wiki)
ranagustavo
Posts: 8
Joined: Wed Oct 11, 2017 9:13 pm

Re: unsuccessful ZM installation

Post by ranagustavo »

it works! Problem solved. THANK YOU VERY MUCH.
Locked