2

I am editing an apache module on ubuntu and when I try and restart the server using service apache2 restart I am getting the following message:

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

running the command systemctl status apache2.service

● apache2.service - LSB: Apache2 web server
   Loaded: loaded (/etc/init.d/apache2; bad; vendor preset: enabled)
  Drop-In: /lib/systemd/system/apache2.service.d
           └─apache2-systemd.conf
   Active: failed (Result: exit-code) since Mon 2017-09-04 10:53:07 PDT; 3min 21s ago
     Docs: man:systemd-sysv-generator(8)
  Process: 2594 ExecStart=/etc/init.d/apache2 start (code=exited, status=1/FAILURE)

Sep 04 10:53:07 ubuntu apache2[2594]:  *
Sep 04 10:53:07 ubuntu apache2[2594]:  * The apache2 configtest failed.
Sep 04 10:53:07 ubuntu apache2[2594]: Output of config test was:
Sep 04 10:53:07 ubuntu apache2[2594]: apache2: Syntax error on line 140 of /etc/apache2/apache2.conf: Syntax error on line 2 o
Sep 04 10:53:07 ubuntu apache2[2594]: Action 'configtest' failed.
Sep 04 10:53:07 ubuntu apache2[2594]: The Apache error log may have more information.
Sep 04 10:53:07 ubuntu systemd[1]: apache2.service: Control process exited, code=exited status=1
Sep 04 10:53:07 ubuntu systemd[1]: Failed to start LSB: Apache2 web server.
Sep 04 10:53:07 ubuntu systemd[1]: apache2.service: Unit entered failed state.
Sep 04 10:53:07 ubuntu systemd[1]: apache2.service: Failed with result 'exit-code'.

and journalctl -xe

Sep 04 10:53:07 ubuntu systemd[1]: Starting LSB: Apache2 web server...
-- Subject: Unit apache2.service has begun start-up
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
-- 
-- Unit apache2.service has begun starting up.
Sep 04 10:53:07 ubuntu apache2[2594]:  * Starting Apache httpd web server apache2
Sep 04 10:53:07 ubuntu apache2[2594]:  *
Sep 04 10:53:07 ubuntu apache2[2594]:  * The apache2 configtest failed.
Sep 04 10:53:07 ubuntu apache2[2594]: Output of config test was:
Sep 04 10:53:07 ubuntu apache2[2594]: apache2: Syntax error on line 140 of /etc/apache2/apache2.conf: Syntax error on line 2 o
Sep 04 10:53:07 ubuntu apache2[2594]: Action 'configtest' failed.
Sep 04 10:53:07 ubuntu apache2[2594]: The Apache error log may have more information.
Sep 04 10:53:07 ubuntu systemd[1]: apache2.service: Control process exited, code=exited status=1
Sep 04 10:53:07 ubuntu systemd[1]: Failed to start LSB: Apache2 web server.
-- Subject: Unit apache2.service has failed
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
-- 
-- Unit apache2.service has failed.
-- 
-- The result is failed.
Sep 04 10:53:07 ubuntu systemd[1]: apache2.service: Unit entered failed state.
Sep 04 10:53:07 ubuntu systemd[1]: apache2.service: Failed with result 'exit-code'.
Sep 04 10:53:07 ubuntu polkitd(authority=local)[1030]: Unregistered Authentication Agent for unix-process:2581:81632 (system b
Sep 04 10:54:56 ubuntu systemd[1]: Starting Cleanup of Temporary Directories...
-- Subject: Unit systemd-tmpfiles-clean.service has begun start-up
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
-- 
-- Unit systemd-tmpfiles-clean.service has begun starting up.
Sep 04 10:54:56 ubuntu systemd-tmpfiles[2610]: [/usr/lib/tmpfiles.d/var.conf:14] Duplicate line for path "/var/log", ignoring.
Sep 04 10:54:56 ubuntu systemd[1]: Started Cleanup of Temporary Directories.
-- Subject: Unit systemd-tmpfiles-clean.service has finished start-up
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
-- 
-- Unit systemd-tmpfiles-clean.service has finished starting up.
-- 
-- The start-up result is done.
lines 2223-2262/2262 (END)

my apache2.conf is not 140 line because it is generated based on all the conf files of my modules.

Please how can I investigate further?

  • 2
    do apache2ctl -t this will point you to the error directly – Prince Adeyemi Sep 4 '17 at 23:23
2

How to fix Job for apache2.service failed because the control process exited with error code

There are many things that could go wrong which may prevent your apache web server from starting properly or at all. This can be just a semi-colon, an extra character or an invalid directory, etc.

To a fix the error, you must trace that **error first and simply correct it. *It's very simple than you thought, believe me.***

Try this:

Open your terminal and type:

apache2ctl -t

The above command will lead you to the error directly in question you will get an idea how to fix it, if not report your error here and we can all provide help.

I believe in a team work, hope this helps.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.