apache2.service:无法运行“启动”任务:没有此类文件或目录

时间:2018-09-04 16:04:29

标签: apache debian apache2 systemd

我无法在debian 9上启动我的apache服务器。

我尝试重新安装:

sudo apt-get autoremove --purge apache2 && sudo apt-get install apache2

但没有变化...

Job for apache2.service failed because of unavailable resources or another system error.
See "systemctl status apache2.service" and "journalctl -xe" for details.
invoke-rc.d: initscript apache2, action "restart" failed.

systemctl状态apache2.service

● apache2.service - The Apache HTTP Server
   Loaded: loaded (/lib/systemd/system/apache2.service; enabled; vendor preset: enabled)
   Active: failed (Result: resources)

journalctl -xeu apache2.service (我将loglevel设置为debug mod)

Sep 05 11:45:44 systemd[1]: apache2.service: Failed with result 'resources'.
Sep 05 11:50:26 systemd[1]: apache2.service: Changed dead -> failed
Sep 05 11:50:27 systemd[1]: apache2.service: Trying to enqueue job apache2.service/stop/replace
Sep 05 11:50:27 systemd[1]: apache2.service: Installed new job apache2.service/stop as 1415
Sep 05 11:50:27 systemd[1]: apache2.service: Enqueued job apache2.service/stop as 1415
Sep 05 11:50:27 systemd[1]: apache2.service: Job apache2.service/stop finished, result=done
Sep 05 11:50:27 systemd[1]: apache2.service: Changed dead -> failed
Sep 05 11:50:30 systemd[1]: apache2.service: Failed to run 'start' task: No such file or directory
Sep 05 11:50:30 systemd[1]: Failed to start The Apache HTTP Server.
-- Subject: Unit apache2.service has failed
-- Defined-By: systemd
-- Support: https://www.debian.org/support
-- 
-- Unit apache2.service has failed.
-- 
-- The result is failed.
Sep 05 11:50:30 systemd[1]: apache2.service: Failed with result 'resources'.

怎么了?

2 个答案:

答案 0 :(得分:1)

也许这是服务'tmp'目录的问题。我在systemd-resolved.service中也遇到类似的错误,并且在系统迁移后丢失了'/ var / tmp'目录。检查服务使用的临时目录,并在必要时创建它。

答案 1 :(得分:0)

此外,如果/ var / tmp /中有新运行的systemd和废话,则可能必须清除此废话并尝试再次运行服务。

在我的情况下,结果是这样的(当时没有运行apache2):

root@www:/var/tmp # ls -al
total 32
drwxrwxrwt  8 root root 4096 Dec 15 12:48 .
drwxr-xr-x 14 root root 4096 Jul  8 21:43 ..
drwx------  2 root root 4096 Dec 15 12:48 systemd-private-1dcdfe608b6c41f387936225d86126c7-apache2.service-L0KeaS
drwx------  2 root root 4096 Dec  8 03:09 systemd-private-39294ac7bf4b44198d87d45660dcbac2-phpsessionclean.service-4ShLZm
drwx------  2 root root 4096 Dec 15 04:00 systemd-private-451ad0c3bfe6435891a80a6c714a222b-apache2.service-YQyZes
drwx------  2 root root 4096 Dec 15 07:09 systemd-private-451ad0c3bfe6435891a80a6c714a222b-phpsessionclean.service-5L25TU
drwx------  3 root root 4096 Dec 15 03:53 systemd-private-68bc1493e8804c968af642a2319c4e79-apache2.service-RY1iLF
相关问题