Netdot
Netdot copied to clipboard
Apache 2.4.10 unable to start
Installing netdot 1.0.7 on debian jessie with libperl 5.20 apache did not start after. Apache did not show any messages than [pid 21877] AH01574: module apreq_module is already loaded, skipping
The solution was to add "PerlSwitches -I/usr/local/netdot/lib" in the <Perl> section of netdot_apache24_local.conf . Hope can you place the line in the right place.
Part of netdot_apache24_local.conf
Add Netdot's libraries to @INC
PerlSwitches -I/usr/local/netdot/lib
use Netdot::Mason;
Override SiteControl's login method
use Netdot::SiteControlLoginWrapper; </Perl>
Hello @neozerosv could you paste your apache config? I have PerlSwitches line in my config, but I think I might have put it in the wrong section... Apache starts, but my errors are [Wed Apr 26 13:40:53.887914 2017] [perl:error] [pid 4537:tid 140553427207936] [client 172.16.179.100:43426] failed to resolve handler Netdot::Mason': Can't locate Netdot/Mason.pm in @INC (you may need to install the Netdot::Mason module) (@INC contains: /etc/perl /usr/local/lib/x86_64-linux-gnu/perl/5.22.1 /usr/local/share/perl/5.22.1 /usr/lib/x86_64-linux-gnu/perl5/5.22 /usr/share/perl5 /usr/lib/x86_64-linux-gnu/perl/5.22 /usr/share/perl/5.22 /usr/local/lib/site_perl . /etc/apache2) at (eval 61) line 2.\n`
When I access http://server/netdot I get error 403 forbidden
This is my apache2 config, i have removed the comments from the original.
PerlModule ModPerl::Util PerlModule Apache2::Request PerlModule Apache2::RequestRec PerlModule Apache2::RequestIO PerlModule Apache2::RequestUtil PerlModule Apache2::ServerUtil PerlModule Apache2::Connection PerlModule Apache2::Log PerlModule Apache::Session PerlModule APR::Table PerlModule ModPerl::Registry PerlModule "Apache2::Const => ':common'" PerlModule "APR::Const => ':common'" PerlModule Apache2::SiteControl PerlModule HTML::Mason::ApacheHandler PerlSwitches -I/usr/local/netdot/lib
<Perl> PerlSwitches -I/usr/local/netdot/lib use Netdot::Mason; use Netdot::SiteControlLoginWrapper; </Perl>
Alias /netdot "/usr/local/netdot/htdocs/" PerlSetVar MasonPreamble "use utf8;" AddDefaultCharset utf-8 PerlSetVar NetdotPath "/netdot/" PerlSetVar NetdotLoginScript /netdot/login.html PerlSetVar NetdotCache 1 PerlSetVar NetdotTemporarySessionExpires +2h PerlAddAuthzProvider user Apache2::SiteControl->authz_handler <Directory /usr/local/netdot/htdocs/> AddType text/html .html SetHandler perl-script PerlHandler Netdot::Mason AuthType Apache2::SiteControl AuthName Netdot Require valid-user <FilesMatch (.css|.js)$> SetHandler default-handler </FilesMatch> <FilesMatch (.css|title.png)$> Require all granted </FilesMatch> <Files login.html> Require all granted </Files> <Files NetdotLogin> Require all granted PerlHandler Netdot::SiteControlLoginWrapper->login </Files> PerlSetVar SiteControlMethod Netdot::AuthLocal PerlSetVar AccessControllerDebug 1 PerlSetVar AuthCookieDebug 1 PerlSetVar SiteControlDebug 1 PerlSetVar SiteControlManagerFactory Netdot::NetdotPermissionFactory PerlSetVar SiteControlSessions /usr/local/netdot/tmp/sessions PerlSetVar SiteControlLocks /usr/local/netdot/tmp/sessions/locks PerlAuthenHandler Apache2::SiteControl->authenticate PerlSetVar UserObjectPasswordKey "Netdot gets the last laugh" </Directory>`
I tried the exact same configuration, web server loads, but as soon as I go to netdot site, apache2 uses up all my CPU, and the page doesnt load.
I ended up downgrading to ubuntu 14.04 lts which works fine out of the box.
Here are the patches I needed to make Netdot work under ubuntu 16.04; debian jessie may or may not have the same issues.
Patch to /etc/init.d/apache2
--- apache2.orig 2017-03-21 13:36:56.712133397 +0000
+++ apache2 2017-03-21 13:37:35.928572194 +0000
@@ -159,8 +159,12 @@
fi
if apache_conftest ; then
+ # Utterly horrible workaround for https://osl.uoregon.edu/redmine/issues/1904
+ a2disconf netdot
$APACHE2CTL start
apache_wait_start $?
+ a2enconf netdot
+ $APACHE2CTL graceful
return $?
else
APACHE2_INIT_MESSAGE="The apache2$DIR_SUFFIX configtest failed."
Patch to /usr/share/perl5/Class/DBI.pm
# Needed for mysql 5.7
# https://osl.uoregon.edu/redmine/issues/1911
# Patch taken from:
# https://rt.cpan.org/Public/Bug/Display.html?id=118491
--- Class/DBI.pm.orig 2007-10-04 21:27:07.000000000 +0000
+++ Class/DBI.pm 2017-03-24 12:01:07.829877222 +0000
@@ -597,6 +597,7 @@
sub _auto_increment_value {
my $self = shift;
+ my $sth = shift;
my $dbh = $self->db_Main;
# Try to do this in a standard method. Fall back to MySQL/SQLite
@@ -607,6 +608,7 @@
my $id = $dbh->last_insert_id(undef, undef, $self->table, undef) # std
|| $dbh->{mysql_insertid} # mysql
|| eval { $dbh->func('last_insert_rowid') }
+ || $sth->{'mysql_insertid'} # Added for MySQL 5.7
or $self->_croak("Can't get last insert id");
return $id;
}
@@ -623,7 +625,7 @@
$self->_bind_param($sth, \@columns);
$sth->execute(values %$data);
my @primary_columns = $self->primary_columns;
- $data->{ $primary_columns[0] } = $self->_auto_increment_value
+ $data->{ $primary_columns[0] } = $self->_auto_increment_value($sth)
if @primary_columns == 1
&& !defined $data->{ $primary_columns[0] };
};
The first patch is a total frig for a mod_perl segfault. I wouldn't touch mod_perl with a bargepole but we don't really have any alternative for netdot.
fwiw, the patch to DBI.pm is needed on Ubuntu 18.04 as well.