Mar 25 12:30:16 linux-4v2w systemd[1]: apache2.service: main process exited, code=exited, status=1/FAILURE
Mar 25 12:30:16 linux-4v2w start_apache2[4157]: httpd (no pid file) not running
Mar 25 12:30:17 linux-4v2w systemd[1]: Failed to start The Apache Webserver.
Mar 25 12:30:17 linux-4v2w systemd[1]: Unit apache2.service entered failed state.
sudo journalctl -b -x -u apache2-- Logs begin at Tue 2014-03-25 12:29:19 IST, end at Tue 2014-03-25 12:51:07 IST. --
Mar 25 12:30:14 linux-4v2w systemd[1]: Starting The Apache Webserver...
-- Subject: Unit apache2.service has begun with start-up
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
--
-- Unit apache2.service has begun starting up.
Mar 25 12:30:16 linux-4v2w systemd[1]: apache2.service: main process exited, code=exited, status=1/FAILURE
Mar 25 12:30:16 linux-4v2w start_apache2[4157]: httpd (no pid file) not running
Mar 25 12:30:17 linux-4v2w systemd[1]: Failed to start The Apache Webserver.
-- Subject: Unit apache2.service has failed
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
-- Documentation: http://www.freedesktop.org/wiki/Software/systemd/catalog/be02cf6855d2428ba40df7e9d022f03d
--
-- Unit apache2.service has failed.
--
-- The result is failed.
Mar 25 12:30:17 linux-4v2w systemd[1]: Unit apache2.service entered failed state.
Mar 25 12:48:47 linux-4v2w systemd[1]: Stopped The Apache Webserver.
-- Subject: Unit apache2.service has finished shutting down
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
-- Documentation: http://www.freedesktop.org/wiki/Software/systemd/catalog/9d1aaa27d60140bd96365438aad20286
--
-- Unit apache2.service has finished shutting down.
Mar 25 12:49:20 linux-4v2w systemd[1]: Starting The Apache Webserver...
-- Subject: Unit apache2.service has begun with start-up
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
--
-- Unit apache2.service has begun starting up.
Mar 25 12:49:20 linux-4v2w systemd[1]: apache2.service: main process exited, code=exited, status=1/FAILURE
Mar 25 12:49:21 linux-4v2w start_apache2[8810]: httpd (no pid file) not running
Mar 25 12:49:21 linux-4v2w systemd[1]: Failed to start The Apache Webserver.
-- Subject: Unit apache2.service has failed
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
-- Documentation: http://www.freedesktop.org/wiki/Software/systemd/catalog/be02cf6855d2428ba40df7e9d022f03d
--
-- Unit apache2.service has failed.
--
-- The result is failed.
Mar 25 12:49:21 linux-4v2w systemd[1]: Unit apache2.service entered failed state.
That error message (“start_apache2[4157]: httpd (no pid file) not running”) means that you tried to STOP apache when it was not running, so it doesn’t help at all in finding out what’s wrong.
Can you please START apache and then query the status?
sudo systemctl start apache2.service
sudo systemctl status apache2.service
No. You don’t have to explicitely install those. They are part of the standard “apache2” package.
Just add them to /etc/sysconfig/apache2 (APACHE_MODULES) either with a text editor or YaST->System->/etc/sysconfig editor, or use “a2enmod” which does that for you.
Check the error log for apache if you want to find out exactly what is going on. If you can’t find the pid file it means it’s not running and did not crash so as to leave a pid file there.
The error log’s location should be mentioned in the configuration file httpd.conf in /etc/apache2.
In my case it’s in /var/log/apache2/error_log
By taking a look there I found out that apache was trying to load two incompatible modules and that was causing the error when trying to start the apache2 service.
I had to edit the /etc/sysconfig/apache2 file in order to remove one of the two and then the service started without any more issues.
It was strange because neither service apache2 status, or the other two commands “systemctl status apache2.service -l” or “journalctl -b -x -u apache2” suggested by the status message produced any relevant output. But we should always check the error and access logs. Always. I totally wasted 2 days looking in the dark for this, I could have corrected everything in 10 mins or less.
I came here looking for answers, didn’t find any but I am leaving one here in case anyone else comes back.
GL everyone, it management is not as easy as it seems especially if you are a jack of all trades like me. We all need to be thorough to make sure we are not waisting our time so it can be hard.
Yannis.