zmpkg.pl errors

Support and queries relating to all previous versions of ZoneMinder
Locked
regulatre
Posts: 4
Joined: Tue Jul 27, 2004 11:28 pm

zmpkg.pl errors

Post by regulatre »

OK so I can get video when I manually start zmc -d 0, but things still aren't quite right. I'm running Slackware 10, with latest versions of most applications, including perl... 2.6.7...

The problem is that when I run zmpkg.pl start, several errors are logged. I'm including a link to a HTTP location containing all of my ZM error logs and other relevant information.

It looks like there is a problem with my perl configuration (too new!?) please help!

http://67.167.143.228/errors-zm/

root@existent:/var/log/zm# tail zmpkg.log
Executing: su apache /usr/local/bin/zmdc.pl check
/usr/local/bin/zmdc.pl: line 38: /usr/local/bin: Is a directory
/usr/local/bin/zmdc.pl: line 39: /var/www/htdocs/zm/: Is a directory
/usr/local/bin/zmdc.pl: line 40: use: command not found
/usr/local/bin/zmdc.pl: line 41: use: command not found
/usr/local/bin/zmdc.pl: line 42: use: command not found
/usr/local/bin/zmdc.pl: line 43: use: command not found
/usr/local/bin/zmdc.pl: line 46: BEGIN: command not found
/usr/local/bin/zmdc.pl: line 50: syntax error near unexpected token `('
/usr/local/bin/zmdc.pl: line 50: ` my $dbh = DBI->connect( "DBI:mysql:database=".ZM_DB_NAME.";host=".ZM_DB_SERVER, ZM_DB_USERA, ZM_DB_PASSA );'
root@existent:/var/log/zm#
User avatar
davide
Posts: 78
Joined: Mon Mar 22, 2004 1:04 am
Location: Italy

Post by davide »

I don't think the problem is in perl.. I think this code will work for every version up to come...

Code: Select all

use constant ZM_PATH_BIN => "/usr/local/bin";   
use constant ZM_PATH_WEB => "/var/www/html/zm"; 
looking at http://67.167.143.228/errors-zm/zmpkg.log.txt I noticed you had problems with executing shell commands as user apache and with permissions.

in my LFS distro I had similar problems, I solved editing the sub execute in zmpkg.pl as follow:

Code: Select all

sub execute
{
        my $command = shift;
        my ( $name ) = getpwuid( $> );
        if ( $name ne ZM_WEB_USER )
        {
        #       $command = "su ".ZM_WEB_USER." --shell=/bin/sh --command='$command'";
                 $command = "su ".ZM_WEB_USER." -c '$command'";
        }
        print( STDERR "Executing: $command\n" );
        return( qx( $command ) );
}
(only 1 line edited)

and I told my system that the user apache should use the bash shell:

Code: Select all

usermod -s /bin/bash apache
I hope it helps
regulatre
Posts: 4
Joined: Tue Jul 27, 2004 11:28 pm

Post by regulatre »

Thank you for your response.
Although I thought I had made that change to the bash commandline, I re-checked after reading your post, and found that I neglected to use the "-c" option. After making that change, and running zmpkg.pl as the apache user, I find that ZM is working great!!!

Problem solved.



davide wrote:I don't think the problem is in perl.. I think this code will work for every version up to come...

Code: Select all

use constant ZM_PATH_BIN => "/usr/local/bin";   
use constant ZM_PATH_WEB => "/var/www/html/zm"; 
looking at http://67.167.143.228/errors-zm/zmpkg.log.txt I noticed you had problems with executing shell commands as user apache and with permissions.

in my LFS distro I had similar problems, I solved editing the sub execute in zmpkg.pl as follow:

Code: Select all

sub execute
{
        my $command = shift;
        my ( $name ) = getpwuid( $> );
        if ( $name ne ZM_WEB_USER )
        {
        #       $command = "su ".ZM_WEB_USER." --shell=/bin/sh --command='$command'";
                 $command = "su ".ZM_WEB_USER." -c '$command'";
        }
        print( STDERR "Executing: $command\n" );
        return( qx( $command ) );
}
(only 1 line edited)

and I told my system that the user apache should use the bash shell:

Code: Select all

usermod -s /bin/bash apache
I hope it helps
kpmin
Posts: 20
Joined: Sat Jul 31, 2004 7:25 pm

Post by kpmin »

I installed the zm 1.19.5, and is working except for the zmpkg.pl.
I can only start from the web console clicking 'stopped' to start the zm.

I tried changing the zmpkg.pl as described above and in other forums, but still zmpkg.pl does not work. I get the following error in /tmp/zmpkg.log when I tried both -c option and --shell option.

----------
Command: start
Executing: su apache -c '/usr/local/bin/zmdc.pl check'
Your account has expired; please contact your system administrator
su: incorrect password

Command: start
Executing: su apache --shell=/bin/sh --command='/usr/local/bin/zmdc.pl check'
Your account has expired; please contact your system administrator
su: incorrect password
-----------

I tried "usermod -s /bin/bash apache", and I also tried resetting the apache password, but it does not work.

I have zm on RH 9.0 kernel, but I installed the apache2.0.52, and PHP 5.0.2. Also, I recompiled the 2.4.20 kernel.

My question is "is this related to PAM(pluggable authentication module)"?
Could you please give me some hint or guide where to look?

Thank you.
Locked