服务在启动时超时,但可以手动启动,这可能是什么问题?

服务在启动时超时,但可以手动启动,这可能是什么问题?

我最近安装了 apche2 和 php7.1-fpm 并将它们添加到启动

systemctl enable apache2
systemctl enable php7.1-fpm

重启系统后systemctl status显示如下:

sudo systemctl  status apache2.service php7.1-fpm.service

● apache2.service - The Apache HTTP Server
 Loaded: loaded (/lib/systemd/system/apache2.service; enabled; vendor 
preset: enabled)
 Active: failed (Result: timeout) since Mon 2017-12-25 18:53:43 CET; 
  10min ago
  Process: 468 ExecStart=/usr/sbin/apachectl start (code=killed, 
signal=TERM)

Dez 25 18:53:33 drupal-PC systemd[1]: Starting The Apache HTTP 
Server...
Dez 25 18:53:43 drupal-PC apachectl[468]: AH00558: apache2: Could not 
reliably determine the server's fully qualified do
Dez 25 18:53:43 drupal-PC systemd[1]: apache2.service: Start operation 
timed out. Terminating.
Dez 25 18:53:43 drupal-PC systemd[1]: Failed to start The Apache HTTP 
Server.
Dez 25 18:53:43 drupal-PC systemd[1]: apache2.service: Unit entered 
failed state.
Dez 25 18:53:43 drupal-PC systemd[1]: apache2.service: Failed with 
result 'timeout'.

● php7.1-fpm.service - The PHP 7.1 FastCGI Process Manager
 Loaded: loaded (/lib/systemd/system/php7.1-fpm.service; enabled; 
 vendor preset: enabled)
  Active: failed (Result: timeout) since Mon 2017-12-25 18:53:43 CET; 
  10min ago
    Docs: man:php-fpm7.1(8)
   Process: 463 ExecStart=/usr/sbin/php-fpm7.1 --nodaemonize --fpm-
 config /etc/php/7.1/fpm/php-fpm.conf (code=killed, sig
 Main PID: 463 (code=killed, signal=TERM)

 Dez 25 18:53:33 drupal-PC systemd[1]: Starting The PHP 7.1 FastCGI 
 Process Manager...
 Dez 25 18:53:43 drupal-PC systemd[1]: php7.1-fpm.service: Start 
 operation timed out. Terminating.
Dez 25 18:53:43 drupal-PC systemd[1]: Failed to start The PHP 7.1 
FastCGI Process Manager.
Dez 25 18:53:43 drupal-PC systemd[1]: php7.1-fpm.service: Unit entered 
failed state.
Dez 25 18:53:43 drupal-PC systemd[1]: php7.1-fpm.service: Failed with 
result 'timeout'.

如果我手动启动服务,一切都会正常。问题出在哪里?

答案1

看起来这个问题很老了,但是对于像我这样遇到同样问题的人来说 - 有一个

DefaultTimeoutStartSec
DefaultTimeoutStopSec

负责在全局选项/etc/systemd/system.conf

或者

TimeoutStartSec
TimeoutStopSec

.service在链接的各个文件中/etc/systemd/system,在我的系统中默认设置为15s.改变60s解决问题

相关内容