Matrix
Matrix

Reputation: 3369

apache2.service: Failed to run 'start' task: No such file or directory

I can't start my apache server on debian 9.

I tried reinstall :

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

but no change...

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 status 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 (I set loglevel to 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'.

what's wrong?

Upvotes: 3

Views: 9175

Answers (2)

IT nemesis
IT nemesis

Reputation: 11

Also, if there is systemd newly running and crap in /var/tmp/, you might have to clear up this crap and try running the service again.

In my case it turned out to be this (without apache2 running at the time):

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

Upvotes: 1

Nikolay Jambazov
Nikolay Jambazov

Reputation: 131

Maybe this is a problem with service 'tmp' directory. I has a similar error with systemd-resolved.service, and reason was missing '/var/tmp' directory after system migration. Check what temp directory the service is using and create it if necessary.

Upvotes: 7

Related Questions