Page 1 of 1
Error while shutdown or reboot
Posted: Mon Sep 13, 2010 12:57 am
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
Posted: Mon Sep 13, 2010 11:15 am
by bumann
No idea?
Re: Error while shutdown or reboot
Posted: Mon Sep 13, 2010 8:32 pm
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.
Posted: Mon Sep 13, 2010 9:16 pm
by bumann
Thx for the info!
I canged to Debian ...
Greetings from Germany
Error reboot/restart!
Posted: Tue Sep 21, 2010 1:21 pm
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!!!
Posted: Tue Sep 21, 2010 1:44 pm
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.
shutdown order
Posted: Sun Sep 26, 2010 2:09 am
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).
Posted: Wed Oct 13, 2010 3:54 am
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
workaround
Posted: Fri Dec 24, 2010 5:10 pm
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.