Error while shutdown or reboot

Forum for questions and support relating to the 1.24.x releases only.
Locked
bumann
Posts: 31
Joined: Mon Sep 13, 2010 12:50 am
Location: Germany

Error while shutdown or reboot

Post by bumann »

Hi!
During i shutdown or reboot my box the error message is displayed:


Stopping Zoneminder: DBI connect('database=zm;host=localhost',zmuser#,...) failed:
Can't connect to local MySQL server through socket '/var/run/mysqld/mysyld.ock'
(2) at /usr/share/perl5/ZoneMinder/Config.pm line 89
Can't call method "prepare_cached" on an undefined value at /usr/share/perl5/ZoneMinder/Config.pm line 91.
BEGIN failed--compilation aborted at /usr/share/perl5/ZoneMinder/Config.pm line 100.
Compilation failed in require at /usr/share/perl5/ZoneMinder.pm line 33.
BEGINN failed--compilation aborted at /usr/share/perl5/ZoneMinder.pm line 33.
Compilation failed in require at /usr/bin/zmpkg.pl line 45.
BEGINN failed--compilation aborted at /usr/bin/zmpkg.pl line 45.
Zoneminder already stopped


But when i STOP ZoneMinder during the Box is running, there is no error.
ZoneMinder is working good when the box is running . But I want to have no error messages in my system.
It runs on Ubuntu server 10.4!
Can anybody help me please?!

Greetings from Germany
bumann
Posts: 31
Joined: Mon Sep 13, 2010 12:50 am
Location: Germany

Post by bumann »

No idea?
vanbosco
Posts: 11
Joined: Fri Feb 02, 2007 8:02 pm
Location: Italy

Re: Error while shutdown or reboot

Post by vanbosco »

bumann wrote:Hi!
During i shutdown or reboot my box the error message is displayed:


Stopping Zoneminder: DBI connect('database=zm;host=localhost',zmuser#,...) failed:
Can't connect to local MySQL server through socket '/var/run/mysqld/mysyld.ock'
(2) at /usr/share/perl5/ZoneMinder/Config.pm line 89
Can't call method "prepare_cached" on an undefined value at /usr/share/perl5/ZoneMinder/Config.pm line 91.
BEGIN failed--compilation aborted at /usr/share/perl5/ZoneMinder/Config.pm line 100.
Compilation failed in require at /usr/share/perl5/ZoneMinder.pm line 33.
BEGINN failed--compilation aborted at /usr/share/perl5/ZoneMinder.pm line 33.
Compilation failed in require at /usr/bin/zmpkg.pl line 45.
BEGINN failed--compilation aborted at /usr/bin/zmpkg.pl line 45.
Zoneminder already stopped


But when i STOP ZoneMinder during the Box is running, there is no error.
ZoneMinder is working good when the box is running . But I want to have no error messages in my system.
It runs on Ubuntu server 10.4!
Can anybody help me please?!

Greetings from Germany
Same problem here with xubuntu 10.04 and 10.10.
This error cause to have a lot of "new event", one more for every video source on every reboot.
I think that the problem is that mysql stop before zm but i don't have find a way to change the order of stopping these services during reboot.
With *buntu 9.10 everythings is working fine.
bumann
Posts: 31
Joined: Mon Sep 13, 2010 12:50 am
Location: Germany

Post by bumann »

Thx for the info!
I canged to Debian ...
Greetings from Germany
redebeer
Posts: 11
Joined: Mon Jan 18, 2010 8:47 am
Location: South Africa, Durban

Error reboot/restart!

Post by redebeer »

Only recently have i started experiencing this same issue.
If i hit ctrl+alt+F7 after bootup i get the same thing at startup...to which i also have to start ZM manually...i do this by entering a line into the local startup script of ubuntu (the sleep thing doesnt work for me)...

But yeah...it is a matter of mysql starting/stopping to early/late or to close to ZM starting

If someone finds/has a cure/workaround, please assist!!!
mastertheknife
Posts: 678
Joined: Wed Dec 16, 2009 4:32 pm
Location: Israel

Post by mastertheknife »

Yeah, it seems MySQL is shutting down before ZM.
Maybe its possible to change the order of shutdown, but it varies from distro to distro.
pdanilchik
Posts: 8
Joined: Tue Jul 27, 2010 3:15 am

shutdown order

Post by pdanilchik »

Isn't the shutdown order just set by the symbolic links at /etc/rc0.d/ ? And the reboot ones at /etc/rc6.d/ for reboot ?? The only thing is... I don't see a symbolic link to shut down mysql so likely it is happening external to this before everything else? !? Or possibly the error has to do with network/filesystem sockets being closed ahead of ZM shutting down??

Has anyone tried renaming any to change the order of execution to see if the problem goes away? I would try but am unable to physically get to my server if something went awry (can't risk it now).

If a solution exists it would be great to know the specifics of what worked. I too see those errors (Ubuntu 10.04 LTS Server AMD64 with ZM 1.24.2).
ccisadmin
Posts: 1
Joined: Wed Oct 13, 2010 3:49 am

Post by ccisadmin »

You just need to shutdown zoneminder before mysqld.

For centos 5 .. this worked for me:

Code: Select all

cd /etc/rc6.d/
ln -s /etc/init.d/zm K33zm
:D
vanbosco
Posts: 11
Joined: Fri Feb 02, 2007 8:02 pm
Location: Italy

workaround

Post by vanbosco »

On my system with ubuntu 10.10 this change of /etc/init/mysql.conf solve the problem.

Code: Select all

# MySQL Service

description     "MySQL Server"
author          "Mario Limonciello <superm1@ubuntu.com>"

start on (net-device-up
          and local-filesystems
	  and runlevel [2345])
stop on runlevel [016]

respawn

env HOME=/etc/mysql
umask 007

# The default of 5 seconds is too low for mysql which needs to flush buffers
kill timeout 300

pre-start script
    #Sanity checks
    [ -r $HOME/my.cnf ]
    [ -d /var/run/mysqld ] || install -m 755 -o mysql -g root -d /var/run/mysqld
    # Load AppArmor profile
    if aa-status --enabled 2>/dev/null; then
        apparmor_parser -r /etc/apparmor.d/usr.sbin.mysqld || true
    fi
    LC_ALL=C BLOCKSIZE= df --portability /var/lib/mysql/. | tail -n 1 | awk '{ exit ($4<4096) }'
end script

exec /usr/sbin/mysqld

post-start script
   for i in `seq 1 30` ; do
        /usr/bin/mysqladmin --defaults-file="${HOME}"/debian.cnf ping && {
            exec "${HOME}"/debian-start
            # should not reach this line
            exit 2
        }
        sleep 1
    done
    exit 1
end script

pre-stop script
    # wait 30 sec for zoneminder to stop
    for i in `seq 1 30` ; do
    	if  [ -e /var/lock/zm ] ; then
		sleep 1
	fi
    done
end script
I have added the pre-stop script that wait for at least 30 second to stop mysql if zm is running.
Locked