Installation

Installing Webwork 2.12 on CentOS 7: Apache HTTP server failed to start

Installing Webwork 2.12 on CentOS 7: Apache HTTP server failed to start

by Hieu Nguyen -
Number of replies: 4
Need help in resolving the following error involving Apache when installing Webwork:

Setting up and enabling services.

Running [service mariadb start]...

Redirecting to /bin/systemctl start mariadb.service

Running [chkconfig mariadb on]...

Note: Forwarding request to 'systemctl enable mariadb.service'.

Running [service httpd start]...

Redirecting to /bin/systemctl start httpd.service

Job for httpd.service failed because the control process exited with error code. See "systemctl status httpd.service" and "journalctl -xe" for details.

Warning! The last command exited with an error: 'service httpd start' exited with value 1


We have logged the error message, if any. We suggest that you exit now and report the error at https://github.com/openwebwork/ww_install If you are certain the error is harmless, then you may continue the installation at your own risk.


Here's the error message when we try to start Apache:

[root@webwork03 /]# /sbin/service httpd start

Redirecting to /bin/systemctl start httpd.service

Job for httpd.service failed because the control process exited with error code. See "systemctl status httpd.service" and "journalctl -xe" for details.


[root@webwork03 /]# systemctl status httpd.service

● httpd.service - The Apache HTTP Server

Loaded: loaded (/usr/lib/systemd/system/httpd.service; enabled; vendor preset: disabled)

Active: failed (Result: exit-code) since Mon 2017-07-31 13:40:28 EDT; 23min ago

Docs: man:httpd(8)

man:apachectl(8)

Process: 10994 ExecStop=/bin/kill -WINCH ${MAINPID} (code=exited, status=1/FAILURE)

Process: 10992 ExecStart=/usr/sbin/httpd $OPTIONS -DFOREGROUND (code=exited, status=1/FAILURE)

Main PID: 10992 (code=exited, status=1/FAILURE)


Jul 31 13:40:28 webwork03.rowan.edu httpd[10992]: webwork.apache2-config: The webwork url on this site is /webwork2

Jul 31 13:40:28 webwork03.rowan.edu httpd[10992]: webwork.apache2-config: The webwork smtp server address is

Jul 31 13:40:28 webwork03.rowan.edu httpd[10992]: webwork.apache2-config: The webwork smtp server port is

Jul 31 13:40:28 webwork03.rowan.edu httpd[10992]: webwork.apache2-config: The webwork smtp server protocol is 'not ssl'

Jul 31 13:40:28 webwork03.rowan.edu systemd[1]: httpd.service: main process exited, code=exited, status=1/FAILURE

Jul 31 13:40:28 webwork03.rowan.edu kill[10994]: kill: cannot find process ""

Jul 31 13:40:28 webwork03.rowan.edu systemd[1]: httpd.service: control process exited, code=exited status=1

Jul 31 13:40:28 webwork03.rowan.edu systemd[1]: Failed to start The Apache HTTP Server.

Jul 31 13:40:28 webwork03.rowan.edu systemd[1]: Unit httpd.service entered failed state.

Jul 31 13:40:28 webwork03.rowan.edu systemd[1]: httpd.service failed.



In reply to Hieu Nguyen

Re: Installing Webwork 2.12 on CentOS 7: Apache HTTP server failed to start

by Danny Glin -
Most likely you are missing one or more perl modules, which is preventing apache from starting.

First suggestion is to run check_modules.pl (it's in /opt/webwork/webwork2/bin if it's not found in the path). If any perl modules are missing, they can usually be installed using either yum or CPAN. The yum packages are typically prefixed with "perl-", and the double-colons are replaced with dashes. For example, to install the module "File::Path", you would use the command
yum install perl-File-Path

If the package is not in yum, you can install it using the command:
cpan File::Path

The other approach is to try to dig into the error messages from apache. CentOS 7 switched to systemd to start services, and the error messages are less verbose. If you want better feedback, try starting apache manually by typing the following as root:
httpd

Most likely you will get an error message that is something to the effect of "Can't load package Package::Name", with the name of some perl package. This is what you will have to install for apache to start properly.
In reply to Danny Glin

Re: Installing Webwork 2.12 on CentOS 7: Apache HTTP server failed to start

by Hieu Nguyen -
Danny,

Thanks for the reply.

Tried running the check_modules.pl script as you suggested, however, all the modules are installed. Think the problem might be that it is only checking for the modules that are installed using yum and not modules installed using cpan. There seems to be modules that are unavailable from yum, so will look into using cpan to install the rest.
In reply to Danny Glin

Re: Installing Webwork 2.12 on CentOS 7: Apache HTTP server failed to start

by Ronak Desai -
Hi Danny,
I am working with Hieu Nguyen to install WeBWorK. While going through the webwork installer, I encounter the following errors in starting the apache server

To start the apache server, I type in "apachectl start" and the server fails to start:
[root@webwork03 bin]# apachectl start
Job for httpd.service failed because the control process exited with error code. See "systemctl status httpd.service" and "journalctl -xe" for details.

The error reported using journalctl -xe:
Aug 09 14:11:45 webwork03.rowan.edu httpd[304]: AH00526: Syntax error on line 12 of /etc/httpd/conf.d/webwork.conf:
Aug 09 14:11:45 webwork03.rowan.edu httpd[304]: Can't locate Email/Sender/Simple.pm in @INC (@INC contains: /opt/webwork/pg/lib /opt/webwork/webwork2/lib /us
Aug 09 14:11:45 webwork03.rowan.edu httpd[304]: webwork.apache2-config: WeBWorK server is starting
Aug 09 14:11:45 webwork03.rowan.edu httpd[304]: webwork.apache2-config: WeBWorK root directory set to /opt/webwork/webwork2 in webwork2/conf/webwork.apache2
Aug 09 14:11:45 webwork03.rowan.edu httpd[304]: webwork.apache2-config: The following locations and urls are set in webwork2/conf/site.conf
Aug 09 14:11:45 webwork03.rowan.edu httpd[304]: webwork.apache2-config: PG root directory set to /opt/webwork/pg
Aug 09 14:11:45 webwork03.rowan.edu httpd[304]: webwork.apache2-config: WeBWorK server userID is www-data
Aug 09 14:11:45 webwork03.rowan.edu httpd[304]: webwork.apache2-config: WeBWorK server groupID is wwdata
Aug 09 14:11:45 webwork03.rowan.edu httpd[304]: webwork.apache2-config: The webwork url on this site is http://webwork03.rowan.edu/webwork2
Aug 09 14:11:45 webwork03.rowan.edu httpd[304]: webwork.apache2-config: The webwork smtp server address is localhost
Aug 09 14:11:45 webwork03.rowan.edu httpd[304]: webwork.apache2-config: The webwork smtp server port is
Aug 09 14:11:45 webwork03.rowan.edu httpd[304]: webwork.apache2-config: The webwork smtp server protocol is 'not ssl'
Aug 09 14:11:45 webwork03.rowan.edu systemd[1]: httpd.service: main process exited, code=exited, status=1/FAILURE
Aug 09 14:11:45 webwork03.rowan.edu kill[306]: kill: cannot find process ""
Aug 09 14:11:45 webwork03.rowan.edu systemd[1]: httpd.service: control process exited, code=exited status=1
Aug 09 14:11:45 webwork03.rowan.edu systemd[1]: Failed to start The Apache HTTP Server.

I have already ran the file check_modules.pl and it says that all the required modules are found and loaded and the only thing that seems off are the following few lines:

Iterator::Util found and loaded
Prototype mismatch: sub main::from_json: none vs ($@) at (eval 519) line 2.
Prototype mismatch: sub main::to_json: none vs ($@) at (eval 519) line 2.
JSON found and loaded

To me, it seems that the modules installed using yum have been working fine, however, the ones installed using cpan have not. For example, yum does not have a perl-Email-Sender package available, so I installed it by typing the command:
cpan install Email::Sender::Simple.
However, the directory where these files are downloaded (/root/.cpan/build) is not included in @INC. My attempt to fix this problem was to modify the webwork.conf file at line 12 to include all the missing directories (by using: use lib "/root/.cpan/build/path/to/missingCpanDirectory";)
use lib "/root/.cpan/build/Email-Simple-2.213-0/lib"; to fix the Email::Sender::Simple issue for example.

While, this fixes this specific issue, we eventually encounter more errors that don't seem to be fixed by including more of these packages in webwork.conf. The output of journalctl -xe (after including some of these missing packages is):

-- Unit httpd.service has begun starting up.
Aug 09 15:10:34 webwork03.rowan.edu httpd[1595]: webwork.apache2-config: WeBWorK server is starting
Aug 09 15:10:34 webwork03.rowan.edu httpd[1595]: webwork.apache2-config: WeBWorK root directory set to /opt/webwork/webwork2 in webwork2/conf/webwork.apache2-config
Aug 09 15:10:34 webwork03.rowan.edu httpd[1595]: webwork.apache2-config: The following locations and urls are set in webwork2/conf/site.conf
Aug 09 15:10:34 webwork03.rowan.edu httpd[1595]: webwork.apache2-config: PG root directory set to /opt/webwork/pg
Aug 09 15:10:34 webwork03.rowan.edu httpd[1595]: webwork.apache2-config: WeBWorK server userID is www-data
Aug 09 15:10:34 webwork03.rowan.edu httpd[1595]: webwork.apache2-config: WeBWorK server groupID is wwdata
Aug 09 15:10:34 webwork03.rowan.edu httpd[1595]: webwork.apache2-config: The webwork url on this site is http://webwork03.rowan.edu/webwork2
Aug 09 15:10:34 webwork03.rowan.edu httpd[1595]: webwork.apache2-config: The webwork smtp server address is localhost
Aug 09 15:10:34 webwork03.rowan.edu httpd[1595]: webwork.apache2-config: The webwork smtp server port is
Aug 09 15:10:34 webwork03.rowan.edu httpd[1595]: webwork.apache2-config: The webwork smtp server protocol is 'not ssl'
Aug 09 15:10:34 webwork03.rowan.edu httpd[1595]: WebworkSOAP::WSDL: webwork_directory set to /opt/webwork/webwork2 via $WeBWorK::Constants::WEBWORK_DIRECTORY set in webwork.apache2-config
Aug 09 15:10:34 webwork03.rowan.edu httpd[1595]: WebworkSOAP::WSDL: rpc_url set to http://webwork03.rowan.edu/webwork2_rpc
Aug 09 15:10:34 webwork03.rowan.edu httpd[1595]: WebworkWebservice: webwork_directory set to /opt/webwork/webwork2 via $WeBWorK::Constants::WEBWORK_DIRECTORY set in webwork.apache2-config
Aug 09 15:10:34 webwork03.rowan.edu httpd[1595]: httpd (pid 16585) already running
Aug 09 15:10:34 webwork03.rowan.edu kill[1597]: kill: cannot find process ""
Aug 09 15:10:34 webwork03.rowan.edu systemd[1]: httpd.service: control process exited, code=exited status=1
Aug 09 15:10:34 webwork03.rowan.edu systemd[1]: Failed to start The Apache HTTP Server.

Here we don't even encounter where the error occurs, and I think it would be silly if our problem was solved by including more than 100 of these modules in the webwork.conf file. I am lost as to how to fix this problem and any help would be appreciated.

In reply to Ronak Desai

Re: Installing Webwork 2.12 on CentOS 7: Apache HTTP server failed to start

by Danny Glin -
I totally forgot that I had the same issue when I moved to CentOS 7.

For some reason CentOS 7 adds some configuration so that the root user has its own perl environment. This means that any packages that you install using CPAN are only available to the root user (as you discovered). This is a problem because apache runs as a different user, so it won't see these perl packages.

Luckily the fix is easy (once you figure out what's causing the problem):

Edit root's .bashrc file. Somewhere near the end there will be some lines about perl. Comment these out, so it looks something like this:

#PATH="/root/perl5/bin${PATH:+:${PATH}}"; export PATH;
#PERL5LIB="/root/perl5/lib/perl5${PERL5LIB:+:${PERL5LIB}}"; export PERL5LIB;
#PERL_LOCAL_LIB_ROOT="/root/perl5${PERL_LOCAL_LIB_ROOT:+:${PERL_LOCAL_LIB_ROOT}}"; export PERL_LOCAL_LIB_ROOT;
#PERL_MB_OPT="--install_base \"/root/perl5\""; export PERL_MB_OPT;
#PERL_MM_OPT="INSTALL_BASE=/root/perl5"; export PERL_MM_OPT;

Once you've saved the file, log out, and log back in as root (to make sure you have a fresh session), then install the necessary modules using CPAN. Now they should be installed in the proper system location.

As an aside, running check_modules.pl as the apache user may give you a different result than running it as root. To see if apache has access to the necessary perl modules, you could try running:
sudo -u apache check_modules.pl
(though I don't know if this is a true test, as it may not load the proper environment variables).