Skip to main content

httpd.service error after cPanel update, but works after restart service

Comments

13 comments

  • cPRex Jurassic Moderator

    Hey there!  Can you try running these commands to see if Apache starts normally afterward?

    cp /etc/apache2/conf/http.conf{,.bak-`date +%Y%m%d`}
    /scripts/rebuildhttpdconf
    /scripts/restartsrv_httpd

     

     
     

     

     

    0
  • clopezi

    Hi!

    Yes, after a minute we detected the issue, we have restarted Apache from web interface without any kind of changes or rebuilds, and works perfectly.

    That's why I think it's a bug because Apache was restarted after cPanel update meanwhile httpd.conf was still on the oven, sounds possible?

    0
  • cPRex Jurassic Moderator

    Alright, so let's see if we can reproduce it - does it happen again after you run "/scripts/upcp --force" ?  If so, are you able to rebuilt the configuration and have it work well after that?

    0
  • clopezi

    I don't know how to reproduce because we we were doing nothing. Apache stopped working, we connected to the server and restart Apache, and everything was working again. So we followed the logs to find that, cPanel was updating on that moment and after the update, triggered a restart with error, so we have checked cPanel log and journal:

    [2024-05-21 15:41:46 +0200]: “/usr/local/cpanel/scripts/restartsrv_nginx reload” called by (1503021 - /usr/local/cpanel/scripts/ea-nginx)
    [2024-05-21 15:48:22 +0200] info [whostmgrd] Successfully verified signature for cpanel (key types: release).
    [2024-05-21 15:48:28 +0200] info [Cpanel::HttpUtils::ApRestart] Unable to read PID from /run/apache2/httpd.pid. Force restart activated.
    [2024-05-21 15:48:28 +0200]: “/usr/local/cpanel/scripts/restartsrv_httpd --start” called by (1516944 - /usr/local/cpanel/bin/safeapacherestart - safeaprestart - forced restart)
    [2024-05-21 15:48:28 +0200]: “/usr/local/cpanel/scripts/restartsrv_apache_php_fpm --graceful” called by (1516948 - /usr/local/cpanel/scripts/restartsrv_httpd --start)
    [2024-05-21 15:48:28 +0200]: “/usr/local/cpanel/scripts/restartsrv_apache_php_fpm --graceful” called by (1516948 - /usr/local/cpanel/scripts/restartsrv_httpd --start)
    [2024-05-21 15:48:28 +0200]: “/usr/local/cpanel/scripts/restartsrv_apache_php_fpm --graceful” called by (1516960 - /usr/local/cpanel/scripts/restartsrv_httpd --no-verbose)
    [2024-05-21 15:48:28 +0200]: “/usr/local/cpanel/scripts/restartsrv_apache_php_fpm --graceful” called by (1516960 - /usr/local/cpanel/scripts/restartsrv_httpd --no-verbose)
    [2024-05-21 15:48:29 +0200] info [restartsrv_httpd] systemd failed to start the service “httpd” (The “/usr/bin/systemctl restart httpd.service --no-ask-password” command (process 1516959) reported error number 1 when it ended.): Job for httpd.service failed because the control process exited with error code.
    See "systemctl status httpd.service" and "journalctl -xe" for details.

    [2024-05-21 15:48:29 +0200]: “/usr/local/cpanel/scripts/restartsrv_apache_php_fpm --graceful” called by (1516979 - /usr/local/cpanel/scripts/restartsrv_httpd --no-verbose)
    [2024-05-21 15:48:29 +0200]: “/usr/local/cpanel/scripts/restartsrv_apache_php_fpm --graceful” called by (1516979 - /usr/local/cpanel/scripts/restartsrv_httpd --no-verbose)
    [2024-05-21 15:48:29 +0200] info [restartsrv_httpd] systemd failed to start the service “httpd” (The “/usr/bin/systemctl restart httpd.service --no-ask-password” command (process 1516978) reported error number 1 when it ended.): Job for httpd.service failed because the control process exited with error code.
    See "systemctl status httpd.service" and "journalctl -xe" for details.
    May 21 15:41:45 xxx.com systemd[1]: httpd.service: Main process exited, code=exited, status=1/FAILURE
    May 21 15:41:45 xxx.com systemd[1]: httpd.service: Failed with result 'exit-code'.
    May 21 15:48:28 xxx.com systemd[1]: Starting Apache web server managed by cPanel EasyApache...
    May 21 15:48:29 xxx.com restartsrv_httpd[1516976]: httpd: Syntax error on line 3830 of /etc/apache2/conf/httpd.conf: </VirtualHost>sions> directive missing cl>
    May 21 15:48:29 xxx.com systemd[1]: httpd.service: Control process exited, code=exited status=1
    May 21 15:48:29 xxx.com systemd[1]: httpd.service: Failed with result 'exit-code'.
    May 21 15:48:29 xxx.com systemd[1]: Failed to start Apache web server managed by cPanel EasyApache.
    May 21 15:48:29 xxx.com systemd[1]: Starting Apache web server managed by cPanel EasyApache...
    May 21 15:48:29 xxx.com restartsrv_httpd[1516995]: httpd: Syntax error on line 3830 of /etc/apache2/conf/httpd.conf: </VirtualHost>sions> directive missing cl>
    May 21 15:48:29 xxx.com systemd[1]: httpd.service: Control process exited, code=exited status=1
    May 21 15:48:29 xxx.com systemd[1]: httpd.service: Failed with result 'exit-code'.
    May 21 15:48:29 xxx.com systemd[1]: Failed to start Apache web server managed by cPanel EasyApache.
    May 21 15:48:29 xxx.com systemd[1]: Starting Apache web server managed by cPanel EasyApache...
    May 21 15:48:29 xxx.com systemd[1]: httpd.service: Can't open PID file /run/apache2/httpd.pid (yet?) after start: No such file or directory
    May 21 15:48:30 xxx.com systemd[1]: Started Apache web server managed by cPanel EasyApache.

    The very next minute, we connected to the server, restarted Apache and everything was working fine again. If now I go to the line of the error (3830), there's no such thing there. 

    Hence, my suspicion is that perhaps that file was being generated at that very moment, and a few seconds later, it had already changed.

    But we weren't doing anything on the server, let alone modifying httpd.conf.

    Regards,

    0
  • cPRex Jurassic Moderator

    It could just be a one-time event, and if that's the case, we'll likely never get more details. 

    0
  • clopezi

    Sadly it's not the first time, this happened once a month more or les, but it's the first time we look into it. If this happen again, we will write here again.

    Thanks

    0
  • cPRex Jurassic Moderator

    And manually running the rebuild/restart/forced update all works fine?  I was just hoping we could recreate the issue instead of it happening by itself at an inconvenient time.

    0
  • clopezi

    Yes, when we detected the failure, we reboot Apache from WHM and restart without any problem. I suspect that if we had left the 5 minutes, tailwatch would have successfully restarted the service. That is, the failure occurs at that precise moment, but by restarting Apache a few seconds later, the problem no longer exists (and the line in httpd.conf has changed).

    0
  • cPRex Jurassic Moderator

    So the Apache conf does change after the restart?

    0
  • clopezi

    Not exactly. I can't really know.

    My suspicion is that httpd.conf was in some kind of re-generation when Apache was restarted, because the error says:

    May 21 15:48:29 xxx.com restartsrv_httpd[1516995]: httpd: Syntax error on line 3830 of /etc/apache2/conf/httpd.conf: </VirtualHost>sions> directive missing cl>

    And if I go to line 3830 of httpd.conf right now, or yesterday when the event happened, after 5 minutes, it says

      <IfModule userdir_module>

    So clearly, when Apache restarted and failed, the file was being generated at that time, or something like that. I checked with ls, and the file is now dated a few hours ago today. That is, it is a live file. And yesterday, within Apache autostart, it was supposed to be generated. And that caused the error. A few seconds later, the error was gone.

    0
  • cPRex Jurassic Moderator

    Well that's the thing - I wouldn't expect a *restart* of the service to also perform a *rebuild* of the conf file.

    Earlier I posted three commands to make a backup and restart the service - running those works well?  If so, it would be best to get a copy of the broken Apache configuration file before making any changes so you can compare the whole file, as I wouldn't expect the line numbers to have the same content after a rebuild has happened.

    0
  • clopezi

    Yes, those commands works fine, the httpd.conf is generated well and the service it's restarted without problems.

    I would like to catch the httpd.conf in bad state, but it's not possible, because when we connected to the server 30 seconds after the failure, the httpd.conf file was ok in that moment. Only have a bad formation in the very second that apache was restarting. I think.

    0
  • cPRex Jurassic Moderator

    I don't have a good explanation for that behavior, especially if we aren't able to catch it.

    0

Please sign in to leave a comment.