Can't connect to local MySQL server with Fedora 3

Support and queries relating to all previous versions of ZoneMinder
Locked
TheWayne
Posts: 8
Joined: Mon Jun 07, 2004 10:05 pm
Location: Chicago
Contact:

Can't connect to local MySQL server with Fedora 3

Post by TheWayne »

I get the following message when trying to goign to ZoneMinder through the web interface :
Could not connect to database: Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (13)
This is a fresh install of Fedora 3, FFMPEG, PCRE-5.0 with all the updates installed for Fedora
mysql.sock does exist in /var/lib/mysql
I can access the database through a command line with the users I setup for Zoneminder but for some reason can't access them through the web interface. Also I don't get any errors when doing a zmpkg.pl start .
Not sure if it is a probelm with the new versions of MySQL,Apache, and MySQL-PHP on the Fedora 3 install :?:
Also running the script ./zm start comes up OK
I do get the following messages in the httpd error log:
[client 192.168.1.100] PHP Notice: import_request_variables(): No prefix specified - possible security hazard in /var/www/html/zm/zm.php on line 21
[client 192.168.1.100] PHP Warning: mysql_pconnect(): Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (13) in /var/www/html/zm/zm_db.php on line 21
User avatar
cordel
Posts: 5210
Joined: Fri Mar 05, 2004 4:47 pm
Location: /USA/Washington/Seattle

Post by cordel »

Hi Wayne,
I'd look at your logs in the /tmp and more spacificly the zmdc.log. I bet you'll find something in there that will say something like a missing perl module. You will also want to check that when you ran [perl zmconfig.pl] that you set the server to localhost and have the username and passwords correct with what you entered in the mysql comandline to setup your users. I have zm running on Fedora 3 and had no problem getting it installed but.... It locks up after a few minutes. Might be a problem in the kernel but I haven't had time lately to play with it. I'm also testing this on a Via proc so that could contribute as well.
Cordel
TheWayne
Posts: 8
Joined: Mon Jun 07, 2004 10:05 pm
Location: Chicago
Contact:

Post by TheWayne »

I checked the zmdc.log and has the following message :

Can't locate MIME/Entity.pm in @INC (@INC contains: /usr/lib/perl5/5.8.5/i386-linux-thread-multi /usr/lib/perl5/5.8.5 /usr/lib/perl5/site_perl/5.8.5/i386-linux-thread-multi /usr/lib/perl5/site_perl/5.8.4/i386-linux-thread-multi /usr/lib/perl5/site_perl/5.8.3/i386-linux-thread-multi /usr/lib/perl5/site_perl/5.8.2/i386-linux-thread-multi /usr/lib/perl5/site_perl/5.8.1/i386-linux-thread-multi /usr/lib/perl5/site_perl/5.8.0/i386-linux-thread-multi /usr/lib/perl5/site_perl/5.8.5 /usr/lib/perl5/site_perl/5.8.4 /usr/lib/perl5/site_perl/5.8.3 /usr/lib/perl5/site_perl/5.8.2 /usr/lib/perl5/site_perl/5.8.1 /usr/lib/perl5/site_perl/5.8.0 /usr/lib/perl5/site_perl /usr/lib/perl5/vendor_perl/5.8.5/i386-linux-thread-multi /usr/lib/perl5/vendor_perl/5.8.4/i386-linux-thread-multi /usr/lib/perl5/vendor_perl/5.8.3/i386-linux-thread-multi /usr/lib/perl5/vendor_perl/5.8.2/i386-linux-thread-multi /usr/lib/perl5/vendor_perl/5.8.1/i386-linux-thread-multi /usr/lib/perl5/vendor_perl/5.8.0/i386-linux-thread-multi /usr/lib/perl5/vendor_perl/5.8.5 /usr/lib/perl5/vendor_perl/5.8.4 /usr/lib/perl5/vendor_perl/5.8.3 /usr/lib/perl5/vendor_perl/5.8.2 /usr/lib/perl5/vendor_perl/5.8.1 /usr/lib/perl5/vendor_perl/5.8.0 /usr/lib/perl5/vendor_perl) at /usr/local/bin/zmfilter.pl line 87.
BEGIN failed--compilation aborted at /usr/local/bin/zmfilter.pl line 87.
'zmfilter.pl ' crashed at 04/12/15 19:03:09, exit status 2
snakebyte
Posts: 45
Joined: Sun Dec 07, 2003 1:51 am

Entity.pm

Post by snakebyte »

TheWayne,

As you must be aware, zoneminder relies heavily on perl. Entity.pm is one of the modules that it uses, so you'll need to load the appropriate rpm file. In this case, you need:
perl-MIME-tools

This is not included with Fedora. Fortunately for us a guy named Dag has created a bunch of rpms that are fedora (and other distros) compatible.
http://dag.wieers.com/home-made/apt/packages.php

You should be able to find the appropriate rpms to get zoneminder running from that site. Chances are you'll need to load other rpms in order to get things going. This isn't a complete list, but you'll probably need these as well:
perl-Archive-Zip
perl-IO-stringy
perl-MailTools
User avatar
cordel
Posts: 5210
Joined: Fri Mar 05, 2004 4:47 pm
Location: /USA/Washington/Seattle

perl modules

Post by cordel »

The easy way to install this modules is to use the
perl -MCPAN -eshell
Follow the instructions to set it up.
one of the options is what to do about depedancies : ask or follow
If you select follow it will install all required modules for the one you want to install.

Once this is done enter:
install MIME::Entity

That will get you started.
Cordel
User avatar
amit
Posts: 44
Joined: Wed Nov 17, 2004 11:35 am
Location: New Delhi

Post by amit »

atlast i have the answer ...
Disable httpd security from SELINUX in your security level...
In Fedora Core 3 it is enabled by default....

And by this you will learn about SELinux in Fedora...'

Hope it works.....
________
Nick Scheele
Last edited by amit on Tue Feb 01, 2011 2:25 am, edited 1 time in total.
TheWayne
Posts: 8
Joined: Mon Jun 07, 2004 10:05 pm
Location: Chicago
Contact:

Post by TheWayne »

Disabling selinux did it. This is my 3rd installation of Zoneminder under Fedora 3 and the 1st having security enhanced on since this was production and the first 2 where test systems. Thought it was an update I installed from Redhat . Thank you Amit for the tip.

Wayne
TheWayne
Posts: 8
Joined: Mon Jun 07, 2004 10:05 pm
Location: Chicago
Contact:

Post by TheWayne »

After getting the system alll configured and having it set for users required to login I was able to turn SELINUX back on with it's default settings and no problems. Must be the fact that users have to login now that is keeping SELINUX happy.

Wayne
sgtdawg
Posts: 17
Joined: Wed May 25, 2005 5:07 am
Location: Twin Cities, MN

similiar or same problem

Post by sgtdawg »

I think I'm having a similiar problem, but disabling SELinux and istalling perl module(s) didn't do anything.
When accessing the web interface locally or over te network I get the following error:

Code: Select all

Could not connect to database: Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (13)
I have used the steps listed to install missing perl module(s).
I used the selinux config file to turn off selinux.
checked status through selinuxconfig:

Code: Select all

#selinuxconfig
selinux state="disabled"
...
I have checked the location of the mysql.sock file. It is confiured through mysql to be at /var/lib/mysql/mysql.sock and is present.

I am wondering if I am using the wrong user or permission setting somewhere in zm or mysqld. I am brand new to zoneminder and am a bit lost.

These are some errors I picked out of /var/log files:

messages:

Code: Select all

May 25 16:04:19 dvr kernel: audit(1117055059.782:0): avc:  denied  { write } for 
pid=17175 exe=/usr/sbin/httpd name=mysql.sock dev=dm-0 ino=796495
scontext=root:system_r:httpd_t tcontext=root:object_r:var_lib_t tclass=sock_file
zmdc.log

Code: Select all

'zmwatch.pl' started at 05/05/25 15:55:02
'zmwatch.pl' starting at 05/05/25 15:55:02, pid = 19406
'zmfilter.pl ' crashed at 05/05/25 15:57:32, exit status 32
'zmfilter.pl' starting at 05/05/25 15:57:32, pid = 19412
'zmfilter.pl' started at 05/05/25 15:57:32
'zmaudit.pl -d 900 -y' crashed at 05/05/25 16:00:25, exit status 32
'zmaudit.pl -d 900 -y' started at 05/05/25 16:00:25
'zmaudit.pl -d 900 -y' starting at 05/05/25 16:00:25, pid = 19426
httpd/error_log

Code: Select all

[client 64.122.61.238] PHP Warning:  mysql_pconnect(): Can't connect to local MySQL
server through socket '/var/lib/mysql/mysql.sock' (13) in /usr/lib/zm/html/zm_db.php
on line 21
[client 127.0.0.1] PHP Warning:  mysql_pconnect(): Can't connect to local MySQL
server through socket '/var/lib/mysql/mysql.sock' (13) in /usr/lib/zm/html/zm_db.php
on line 21
httpd/access_log

Code: Select all

64.122.61.238 - - [25/May/2005:16:03:58 -0500] "GET /zm/ HTTP/1.1" 200 114 "-"
"Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.4.2) Gecko/20040308"
127.0.0.1 - - [25/May/2005:16:04:17 -0500] "GET /zm HTTP/1.0" 301 303 "-"
"Lynx/2.8.5dev.16 libwww-FM/2.14 SSL-MM/1.4.1 OpenSSL/0.9.7a"
mysqld.log

Code: Select all

050525 15:55:00  mysqld started
Cannot initialize InnoDB as 'innodb_data_file_path' is not set.
If you do not want to use transactional InnoDB tables, add a line
skip-innodb
to the [mysqld] section of init parameters in your my.cnf
or my.ini. If you want to use InnoDB tables, add to the [mysqld]
section, for example,
innodb_data_file_path = ibdata1:10M:autoextend
But to get good performance you should adjust for your hardware
the InnoDB startup options listed in section 2 at
http://www.innodb.com/ibman.html
/usr/libexec/mysqld: ready for connections
System:
Fedora Core 3 fresh workstation install
zm-1.21.0-10.FC3.SEL.CTU (with all dependencies)
mysql-server-3.23.58-16.FC3.1
httpd-2.0.52-3.1

httpd, mysqld, and zm services start and stop without errors

Any help would be greatly appreciated. I have run into some walls getting this up and running and can't wait to see it in action on this system.
User avatar
cordel
Posts: 5210
Joined: Fri Mar 05, 2004 4:47 pm
Location: /USA/Washington/Seattle

Post by cordel »

You might want to try referancing this theads:
pconect error:
http://www.zoneminder.com/forums/viewto ... qlpconnect
mysql.sock
http://www.zoneminder.com/forums/viewto ... mysql+sock


avc: denied { write } for
pid=17175 exe=/usr/sbin/httpd name=mysql.sock dev=dm-0 ino=796495
scontext=root:system_r:httpd_t tcontext=root:object_r:var_lib_t tclass=sock_file
Is an error created by SELinux disable it and reboot.
Regards,
Cordel
sgtdawg
Posts: 17
Joined: Wed May 25, 2005 5:07 am
Location: Twin Cities, MN

Post by sgtdawg »

I feel really stupid.

Reboot System.....problem solved!

I guess I was misled by the selinuxconf output. Should have known that it needed a restart, isn't it kernel level security.

Thanks for the simple solution!
Locked