Apache failed to start LSB: Apache2 web server












0















When I start apache then it gives me below error -



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


I executed below command -



 systemctl status apache2.service


I got below error



  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 Wed 2017-05-31 17:01:40 IST; 1min 34s ago
Docs: man:systemd-sysv-generator(8)
Process: 11884 ExecStop=/etc/init.d/apache2 stop (code=exited, status=0/SUCCESS)
Process: 3171 ExecReload=/etc/init.d/apache2 reload (code=exited, status=0/SUCCESS)
Process: 12696 ExecStart=/etc/init.d/apache2 start (code=exited, status=1/FAILURE)

May 31 17:01:40 itadmin systemd[1]: Starting LSB: Apache2 web server...
May 31 17:01:40 itadmin apache2[12696]: * Starting Apache httpd web server apache2
May 31 17:01:40 itadmin apache2[12696]: mktemp: failed to create file via template ‘/tmp/tmp.XXXXXXXXXX’: Read-only file system
May 31 17:01:40 itadmin apache2[12696]: /etc/init.d/apache2: 72: /etc/init.d/apache2: cannot create : Directory nonexistent
May 31 17:01:40 itadmin apache2[12696]: *
May 31 17:01:40 itadmin apache2[12696]: * The apache2 configtest failed.
May 31 17:01:40 itadmin systemd[1]: apache2.service: Control process exited, code=exited status=1
May 31 17:01:40 itadmin systemd[1]: Failed to start LSB: Apache2 web server.
May 31 17:01:40 itadmin systemd[1]: apache2.service: Unit entered failed state.
May 31 17:01:40 itadmin systemd[1]: apache2.service: Failed with result 'exit-code'.


I am not understanding anything. Please anyone can help me?










share|improve this question














bumped to the homepage by Community 5 hours ago


This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.
















  • did you try to run sudo systemctl status apache2.service? it seems that mktemp has no right privilege to create temporary file

    – Lety
    May 31 '17 at 15:37











  • @Lety - yes there was permission issue

    – Jesni Johnson
    Jun 1 '17 at 7:17











  • this askubuntu.com/questions/647527/… could help

    – Lety
    Jun 1 '17 at 8:04
















0















When I start apache then it gives me below error -



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


I executed below command -



 systemctl status apache2.service


I got below error



  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 Wed 2017-05-31 17:01:40 IST; 1min 34s ago
Docs: man:systemd-sysv-generator(8)
Process: 11884 ExecStop=/etc/init.d/apache2 stop (code=exited, status=0/SUCCESS)
Process: 3171 ExecReload=/etc/init.d/apache2 reload (code=exited, status=0/SUCCESS)
Process: 12696 ExecStart=/etc/init.d/apache2 start (code=exited, status=1/FAILURE)

May 31 17:01:40 itadmin systemd[1]: Starting LSB: Apache2 web server...
May 31 17:01:40 itadmin apache2[12696]: * Starting Apache httpd web server apache2
May 31 17:01:40 itadmin apache2[12696]: mktemp: failed to create file via template ‘/tmp/tmp.XXXXXXXXXX’: Read-only file system
May 31 17:01:40 itadmin apache2[12696]: /etc/init.d/apache2: 72: /etc/init.d/apache2: cannot create : Directory nonexistent
May 31 17:01:40 itadmin apache2[12696]: *
May 31 17:01:40 itadmin apache2[12696]: * The apache2 configtest failed.
May 31 17:01:40 itadmin systemd[1]: apache2.service: Control process exited, code=exited status=1
May 31 17:01:40 itadmin systemd[1]: Failed to start LSB: Apache2 web server.
May 31 17:01:40 itadmin systemd[1]: apache2.service: Unit entered failed state.
May 31 17:01:40 itadmin systemd[1]: apache2.service: Failed with result 'exit-code'.


I am not understanding anything. Please anyone can help me?










share|improve this question














bumped to the homepage by Community 5 hours ago


This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.
















  • did you try to run sudo systemctl status apache2.service? it seems that mktemp has no right privilege to create temporary file

    – Lety
    May 31 '17 at 15:37











  • @Lety - yes there was permission issue

    – Jesni Johnson
    Jun 1 '17 at 7:17











  • this askubuntu.com/questions/647527/… could help

    – Lety
    Jun 1 '17 at 8:04














0












0








0


0






When I start apache then it gives me below error -



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


I executed below command -



 systemctl status apache2.service


I got below error



  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 Wed 2017-05-31 17:01:40 IST; 1min 34s ago
Docs: man:systemd-sysv-generator(8)
Process: 11884 ExecStop=/etc/init.d/apache2 stop (code=exited, status=0/SUCCESS)
Process: 3171 ExecReload=/etc/init.d/apache2 reload (code=exited, status=0/SUCCESS)
Process: 12696 ExecStart=/etc/init.d/apache2 start (code=exited, status=1/FAILURE)

May 31 17:01:40 itadmin systemd[1]: Starting LSB: Apache2 web server...
May 31 17:01:40 itadmin apache2[12696]: * Starting Apache httpd web server apache2
May 31 17:01:40 itadmin apache2[12696]: mktemp: failed to create file via template ‘/tmp/tmp.XXXXXXXXXX’: Read-only file system
May 31 17:01:40 itadmin apache2[12696]: /etc/init.d/apache2: 72: /etc/init.d/apache2: cannot create : Directory nonexistent
May 31 17:01:40 itadmin apache2[12696]: *
May 31 17:01:40 itadmin apache2[12696]: * The apache2 configtest failed.
May 31 17:01:40 itadmin systemd[1]: apache2.service: Control process exited, code=exited status=1
May 31 17:01:40 itadmin systemd[1]: Failed to start LSB: Apache2 web server.
May 31 17:01:40 itadmin systemd[1]: apache2.service: Unit entered failed state.
May 31 17:01:40 itadmin systemd[1]: apache2.service: Failed with result 'exit-code'.


I am not understanding anything. Please anyone can help me?










share|improve this question














When I start apache then it gives me below error -



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


I executed below command -



 systemctl status apache2.service


I got below error



  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 Wed 2017-05-31 17:01:40 IST; 1min 34s ago
Docs: man:systemd-sysv-generator(8)
Process: 11884 ExecStop=/etc/init.d/apache2 stop (code=exited, status=0/SUCCESS)
Process: 3171 ExecReload=/etc/init.d/apache2 reload (code=exited, status=0/SUCCESS)
Process: 12696 ExecStart=/etc/init.d/apache2 start (code=exited, status=1/FAILURE)

May 31 17:01:40 itadmin systemd[1]: Starting LSB: Apache2 web server...
May 31 17:01:40 itadmin apache2[12696]: * Starting Apache httpd web server apache2
May 31 17:01:40 itadmin apache2[12696]: mktemp: failed to create file via template ‘/tmp/tmp.XXXXXXXXXX’: Read-only file system
May 31 17:01:40 itadmin apache2[12696]: /etc/init.d/apache2: 72: /etc/init.d/apache2: cannot create : Directory nonexistent
May 31 17:01:40 itadmin apache2[12696]: *
May 31 17:01:40 itadmin apache2[12696]: * The apache2 configtest failed.
May 31 17:01:40 itadmin systemd[1]: apache2.service: Control process exited, code=exited status=1
May 31 17:01:40 itadmin systemd[1]: Failed to start LSB: Apache2 web server.
May 31 17:01:40 itadmin systemd[1]: apache2.service: Unit entered failed state.
May 31 17:01:40 itadmin systemd[1]: apache2.service: Failed with result 'exit-code'.


I am not understanding anything. Please anyone can help me?







command-line server apache2






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked May 31 '17 at 12:46









Jesni JohnsonJesni Johnson

112




112





bumped to the homepage by Community 5 hours ago


This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.







bumped to the homepage by Community 5 hours ago


This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.















  • did you try to run sudo systemctl status apache2.service? it seems that mktemp has no right privilege to create temporary file

    – Lety
    May 31 '17 at 15:37











  • @Lety - yes there was permission issue

    – Jesni Johnson
    Jun 1 '17 at 7:17











  • this askubuntu.com/questions/647527/… could help

    – Lety
    Jun 1 '17 at 8:04



















  • did you try to run sudo systemctl status apache2.service? it seems that mktemp has no right privilege to create temporary file

    – Lety
    May 31 '17 at 15:37











  • @Lety - yes there was permission issue

    – Jesni Johnson
    Jun 1 '17 at 7:17











  • this askubuntu.com/questions/647527/… could help

    – Lety
    Jun 1 '17 at 8:04

















did you try to run sudo systemctl status apache2.service? it seems that mktemp has no right privilege to create temporary file

– Lety
May 31 '17 at 15:37





did you try to run sudo systemctl status apache2.service? it seems that mktemp has no right privilege to create temporary file

– Lety
May 31 '17 at 15:37













@Lety - yes there was permission issue

– Jesni Johnson
Jun 1 '17 at 7:17





@Lety - yes there was permission issue

– Jesni Johnson
Jun 1 '17 at 7:17













this askubuntu.com/questions/647527/… could help

– Lety
Jun 1 '17 at 8:04





this askubuntu.com/questions/647527/… could help

– Lety
Jun 1 '17 at 8:04










1 Answer
1






active

oldest

votes


















0














I also encountered the same error (while working with Saltstack) and managed to solve it. There are four ways.





  1. For some reason your /etc/apache2/envvars is missing:

    To solve this, you can create the file manually and add the default envvars content below



    sudo vim /etc/apache2/envvars


    # envvars - default environment variables for apache2ctl

    # this won't be correct after changing uid
    unset HOME

    # for supporting multiple apache2 instances
    if [ "${APACHE_CONFDIR##/etc/apache2-}" != "${APACHE_CONFDIR}" ] ; then
    SUFFIX="-${APACHE_CONFDIR##/etc/apache2-}"
    else
    SUFFIX=
    fi

    # Since there is no sane way to get the parsed apache2 config in scripts, some
    # settings are defined via environment variables and then used in apache2ctl,
    # /etc/init.d/apache2, /etc/logrotate.d/apache2, etc.
    export APACHE_RUN_USER=www-data
    export APACHE_RUN_GROUP=www-data
    # temporary state file location. This might be changed to /run in Wheezy+1
    export APACHE_PID_FILE=/var/run/apache2/apache2$SUFFIX.pid
    export APACHE_RUN_DIR=/var/run/apache2$SUFFIX
    export APACHE_LOCK_DIR=/var/lock/apache2$SUFFIX
    # Only /var/log/apache2 is handled by /etc/logrotate.d/apache2.
    export APACHE_LOG_DIR=/var/log/apache2$SUFFIX

    ## The locale used by some modules like mod_dav
    export LANG=C
    ## Uncomment the following line to use the system default locale instead:
    #. /etc/default/locale

    export LANG

    ## The command to get the status for 'apache2ctl status'.
    ## Some packages providing 'www-browser' need '--dump' instead of '-dump'.
    #export APACHE_LYNX='www-browser -dump'

    ## If you need a higher file descriptor limit, uncomment and adjust the
    ## following line (default is 8192):
    #APACHE_ULIMIT_MAX_FILES='ulimit -n 65536'

    ## If you would like to pass arguments to the web server, add them below
    ## to the APACHE_ARGUMENTS environment.
    #export APACHE_ARGUMENTS=''

    ## Enable the debug mode for maintainer scripts.
    ## This will produce a verbose output on package installations of web server modules and web application
    ## installations which interact with Apache
    #export APACHE2_MAINTSCRIPT_DEBUG=1


    Then restart apache service as usual.



    sudo service apache2 restart



  2. If your envvars file is ok then it may be a case of missing packages. Reinstall the missing packages using below command, then restart the Apache service.



    sudo apt-get -o DPkg::Options::="--force-confmiss" --reinstall install apache2
    sudo service apache2 restart



  3. Alternatively you can uninstall Apache and all its config files then reinstall it.



    sudo apt-get purge apache2
    sudo apt-get install apache2



  4. And finally if all the options above don't work, you can try installing package libapache2-mod-php7.0 or disable the PHP7 module by running



    sudo a2dismod php7.0







share|improve this answer





















  • 1





    Your link does not work anymore, and this is the reason why we don't like links. you have a 30000 character limit for your answer, this should be enough to put the contents into your answer itself. This way you ensure your answer to be valid for a long time.

    – Videonauth
    Nov 8 '17 at 14:00













Your Answer








StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "89"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});

function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});


}
});














draft saved

draft discarded


















StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f920719%2fapache-failed-to-start-lsb-apache2-web-server%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown

























1 Answer
1






active

oldest

votes








1 Answer
1






active

oldest

votes









active

oldest

votes






active

oldest

votes









0














I also encountered the same error (while working with Saltstack) and managed to solve it. There are four ways.





  1. For some reason your /etc/apache2/envvars is missing:

    To solve this, you can create the file manually and add the default envvars content below



    sudo vim /etc/apache2/envvars


    # envvars - default environment variables for apache2ctl

    # this won't be correct after changing uid
    unset HOME

    # for supporting multiple apache2 instances
    if [ "${APACHE_CONFDIR##/etc/apache2-}" != "${APACHE_CONFDIR}" ] ; then
    SUFFIX="-${APACHE_CONFDIR##/etc/apache2-}"
    else
    SUFFIX=
    fi

    # Since there is no sane way to get the parsed apache2 config in scripts, some
    # settings are defined via environment variables and then used in apache2ctl,
    # /etc/init.d/apache2, /etc/logrotate.d/apache2, etc.
    export APACHE_RUN_USER=www-data
    export APACHE_RUN_GROUP=www-data
    # temporary state file location. This might be changed to /run in Wheezy+1
    export APACHE_PID_FILE=/var/run/apache2/apache2$SUFFIX.pid
    export APACHE_RUN_DIR=/var/run/apache2$SUFFIX
    export APACHE_LOCK_DIR=/var/lock/apache2$SUFFIX
    # Only /var/log/apache2 is handled by /etc/logrotate.d/apache2.
    export APACHE_LOG_DIR=/var/log/apache2$SUFFIX

    ## The locale used by some modules like mod_dav
    export LANG=C
    ## Uncomment the following line to use the system default locale instead:
    #. /etc/default/locale

    export LANG

    ## The command to get the status for 'apache2ctl status'.
    ## Some packages providing 'www-browser' need '--dump' instead of '-dump'.
    #export APACHE_LYNX='www-browser -dump'

    ## If you need a higher file descriptor limit, uncomment and adjust the
    ## following line (default is 8192):
    #APACHE_ULIMIT_MAX_FILES='ulimit -n 65536'

    ## If you would like to pass arguments to the web server, add them below
    ## to the APACHE_ARGUMENTS environment.
    #export APACHE_ARGUMENTS=''

    ## Enable the debug mode for maintainer scripts.
    ## This will produce a verbose output on package installations of web server modules and web application
    ## installations which interact with Apache
    #export APACHE2_MAINTSCRIPT_DEBUG=1


    Then restart apache service as usual.



    sudo service apache2 restart



  2. If your envvars file is ok then it may be a case of missing packages. Reinstall the missing packages using below command, then restart the Apache service.



    sudo apt-get -o DPkg::Options::="--force-confmiss" --reinstall install apache2
    sudo service apache2 restart



  3. Alternatively you can uninstall Apache and all its config files then reinstall it.



    sudo apt-get purge apache2
    sudo apt-get install apache2



  4. And finally if all the options above don't work, you can try installing package libapache2-mod-php7.0 or disable the PHP7 module by running



    sudo a2dismod php7.0







share|improve this answer





















  • 1





    Your link does not work anymore, and this is the reason why we don't like links. you have a 30000 character limit for your answer, this should be enough to put the contents into your answer itself. This way you ensure your answer to be valid for a long time.

    – Videonauth
    Nov 8 '17 at 14:00


















0














I also encountered the same error (while working with Saltstack) and managed to solve it. There are four ways.





  1. For some reason your /etc/apache2/envvars is missing:

    To solve this, you can create the file manually and add the default envvars content below



    sudo vim /etc/apache2/envvars


    # envvars - default environment variables for apache2ctl

    # this won't be correct after changing uid
    unset HOME

    # for supporting multiple apache2 instances
    if [ "${APACHE_CONFDIR##/etc/apache2-}" != "${APACHE_CONFDIR}" ] ; then
    SUFFIX="-${APACHE_CONFDIR##/etc/apache2-}"
    else
    SUFFIX=
    fi

    # Since there is no sane way to get the parsed apache2 config in scripts, some
    # settings are defined via environment variables and then used in apache2ctl,
    # /etc/init.d/apache2, /etc/logrotate.d/apache2, etc.
    export APACHE_RUN_USER=www-data
    export APACHE_RUN_GROUP=www-data
    # temporary state file location. This might be changed to /run in Wheezy+1
    export APACHE_PID_FILE=/var/run/apache2/apache2$SUFFIX.pid
    export APACHE_RUN_DIR=/var/run/apache2$SUFFIX
    export APACHE_LOCK_DIR=/var/lock/apache2$SUFFIX
    # Only /var/log/apache2 is handled by /etc/logrotate.d/apache2.
    export APACHE_LOG_DIR=/var/log/apache2$SUFFIX

    ## The locale used by some modules like mod_dav
    export LANG=C
    ## Uncomment the following line to use the system default locale instead:
    #. /etc/default/locale

    export LANG

    ## The command to get the status for 'apache2ctl status'.
    ## Some packages providing 'www-browser' need '--dump' instead of '-dump'.
    #export APACHE_LYNX='www-browser -dump'

    ## If you need a higher file descriptor limit, uncomment and adjust the
    ## following line (default is 8192):
    #APACHE_ULIMIT_MAX_FILES='ulimit -n 65536'

    ## If you would like to pass arguments to the web server, add them below
    ## to the APACHE_ARGUMENTS environment.
    #export APACHE_ARGUMENTS=''

    ## Enable the debug mode for maintainer scripts.
    ## This will produce a verbose output on package installations of web server modules and web application
    ## installations which interact with Apache
    #export APACHE2_MAINTSCRIPT_DEBUG=1


    Then restart apache service as usual.



    sudo service apache2 restart



  2. If your envvars file is ok then it may be a case of missing packages. Reinstall the missing packages using below command, then restart the Apache service.



    sudo apt-get -o DPkg::Options::="--force-confmiss" --reinstall install apache2
    sudo service apache2 restart



  3. Alternatively you can uninstall Apache and all its config files then reinstall it.



    sudo apt-get purge apache2
    sudo apt-get install apache2



  4. And finally if all the options above don't work, you can try installing package libapache2-mod-php7.0 or disable the PHP7 module by running



    sudo a2dismod php7.0







share|improve this answer





















  • 1





    Your link does not work anymore, and this is the reason why we don't like links. you have a 30000 character limit for your answer, this should be enough to put the contents into your answer itself. This way you ensure your answer to be valid for a long time.

    – Videonauth
    Nov 8 '17 at 14:00
















0












0








0







I also encountered the same error (while working with Saltstack) and managed to solve it. There are four ways.





  1. For some reason your /etc/apache2/envvars is missing:

    To solve this, you can create the file manually and add the default envvars content below



    sudo vim /etc/apache2/envvars


    # envvars - default environment variables for apache2ctl

    # this won't be correct after changing uid
    unset HOME

    # for supporting multiple apache2 instances
    if [ "${APACHE_CONFDIR##/etc/apache2-}" != "${APACHE_CONFDIR}" ] ; then
    SUFFIX="-${APACHE_CONFDIR##/etc/apache2-}"
    else
    SUFFIX=
    fi

    # Since there is no sane way to get the parsed apache2 config in scripts, some
    # settings are defined via environment variables and then used in apache2ctl,
    # /etc/init.d/apache2, /etc/logrotate.d/apache2, etc.
    export APACHE_RUN_USER=www-data
    export APACHE_RUN_GROUP=www-data
    # temporary state file location. This might be changed to /run in Wheezy+1
    export APACHE_PID_FILE=/var/run/apache2/apache2$SUFFIX.pid
    export APACHE_RUN_DIR=/var/run/apache2$SUFFIX
    export APACHE_LOCK_DIR=/var/lock/apache2$SUFFIX
    # Only /var/log/apache2 is handled by /etc/logrotate.d/apache2.
    export APACHE_LOG_DIR=/var/log/apache2$SUFFIX

    ## The locale used by some modules like mod_dav
    export LANG=C
    ## Uncomment the following line to use the system default locale instead:
    #. /etc/default/locale

    export LANG

    ## The command to get the status for 'apache2ctl status'.
    ## Some packages providing 'www-browser' need '--dump' instead of '-dump'.
    #export APACHE_LYNX='www-browser -dump'

    ## If you need a higher file descriptor limit, uncomment and adjust the
    ## following line (default is 8192):
    #APACHE_ULIMIT_MAX_FILES='ulimit -n 65536'

    ## If you would like to pass arguments to the web server, add them below
    ## to the APACHE_ARGUMENTS environment.
    #export APACHE_ARGUMENTS=''

    ## Enable the debug mode for maintainer scripts.
    ## This will produce a verbose output on package installations of web server modules and web application
    ## installations which interact with Apache
    #export APACHE2_MAINTSCRIPT_DEBUG=1


    Then restart apache service as usual.



    sudo service apache2 restart



  2. If your envvars file is ok then it may be a case of missing packages. Reinstall the missing packages using below command, then restart the Apache service.



    sudo apt-get -o DPkg::Options::="--force-confmiss" --reinstall install apache2
    sudo service apache2 restart



  3. Alternatively you can uninstall Apache and all its config files then reinstall it.



    sudo apt-get purge apache2
    sudo apt-get install apache2



  4. And finally if all the options above don't work, you can try installing package libapache2-mod-php7.0 or disable the PHP7 module by running



    sudo a2dismod php7.0







share|improve this answer















I also encountered the same error (while working with Saltstack) and managed to solve it. There are four ways.





  1. For some reason your /etc/apache2/envvars is missing:

    To solve this, you can create the file manually and add the default envvars content below



    sudo vim /etc/apache2/envvars


    # envvars - default environment variables for apache2ctl

    # this won't be correct after changing uid
    unset HOME

    # for supporting multiple apache2 instances
    if [ "${APACHE_CONFDIR##/etc/apache2-}" != "${APACHE_CONFDIR}" ] ; then
    SUFFIX="-${APACHE_CONFDIR##/etc/apache2-}"
    else
    SUFFIX=
    fi

    # Since there is no sane way to get the parsed apache2 config in scripts, some
    # settings are defined via environment variables and then used in apache2ctl,
    # /etc/init.d/apache2, /etc/logrotate.d/apache2, etc.
    export APACHE_RUN_USER=www-data
    export APACHE_RUN_GROUP=www-data
    # temporary state file location. This might be changed to /run in Wheezy+1
    export APACHE_PID_FILE=/var/run/apache2/apache2$SUFFIX.pid
    export APACHE_RUN_DIR=/var/run/apache2$SUFFIX
    export APACHE_LOCK_DIR=/var/lock/apache2$SUFFIX
    # Only /var/log/apache2 is handled by /etc/logrotate.d/apache2.
    export APACHE_LOG_DIR=/var/log/apache2$SUFFIX

    ## The locale used by some modules like mod_dav
    export LANG=C
    ## Uncomment the following line to use the system default locale instead:
    #. /etc/default/locale

    export LANG

    ## The command to get the status for 'apache2ctl status'.
    ## Some packages providing 'www-browser' need '--dump' instead of '-dump'.
    #export APACHE_LYNX='www-browser -dump'

    ## If you need a higher file descriptor limit, uncomment and adjust the
    ## following line (default is 8192):
    #APACHE_ULIMIT_MAX_FILES='ulimit -n 65536'

    ## If you would like to pass arguments to the web server, add them below
    ## to the APACHE_ARGUMENTS environment.
    #export APACHE_ARGUMENTS=''

    ## Enable the debug mode for maintainer scripts.
    ## This will produce a verbose output on package installations of web server modules and web application
    ## installations which interact with Apache
    #export APACHE2_MAINTSCRIPT_DEBUG=1


    Then restart apache service as usual.



    sudo service apache2 restart



  2. If your envvars file is ok then it may be a case of missing packages. Reinstall the missing packages using below command, then restart the Apache service.



    sudo apt-get -o DPkg::Options::="--force-confmiss" --reinstall install apache2
    sudo service apache2 restart



  3. Alternatively you can uninstall Apache and all its config files then reinstall it.



    sudo apt-get purge apache2
    sudo apt-get install apache2



  4. And finally if all the options above don't work, you can try installing package libapache2-mod-php7.0 or disable the PHP7 module by running



    sudo a2dismod php7.0








share|improve this answer














share|improve this answer



share|improve this answer








edited Nov 14 '17 at 8:05









Dan

7,08434573




7,08434573










answered Nov 8 '17 at 13:43









Stephen OduorStephen Oduor

12




12








  • 1





    Your link does not work anymore, and this is the reason why we don't like links. you have a 30000 character limit for your answer, this should be enough to put the contents into your answer itself. This way you ensure your answer to be valid for a long time.

    – Videonauth
    Nov 8 '17 at 14:00
















  • 1





    Your link does not work anymore, and this is the reason why we don't like links. you have a 30000 character limit for your answer, this should be enough to put the contents into your answer itself. This way you ensure your answer to be valid for a long time.

    – Videonauth
    Nov 8 '17 at 14:00










1




1





Your link does not work anymore, and this is the reason why we don't like links. you have a 30000 character limit for your answer, this should be enough to put the contents into your answer itself. This way you ensure your answer to be valid for a long time.

– Videonauth
Nov 8 '17 at 14:00







Your link does not work anymore, and this is the reason why we don't like links. you have a 30000 character limit for your answer, this should be enough to put the contents into your answer itself. This way you ensure your answer to be valid for a long time.

– Videonauth
Nov 8 '17 at 14:00




















draft saved

draft discarded




















































Thanks for contributing an answer to Ask Ubuntu!


  • Please be sure to answer the question. Provide details and share your research!

But avoid



  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.


To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f920719%2fapache-failed-to-start-lsb-apache2-web-server%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

數位音樂下載

When can things happen in Etherscan, such as the picture below?

格利澤436b