How to debug services in Debian if they fail to start
I have a new Debian unstable based distro with apache2 on it. Apache itself is working fine. If i use
sudo service apache2 start
it comes up and everything goes well.
But the service for it fails to start every boot.
How to trace the error here?
etc/log/apache2/error.log:
[Sun Jan 15 14:51:06.685936 2017] [mpm_prefork:notice] [pid 2208] AH00169: caught SIGTERM, shutting down
[Sun Jan 15 14:51:47.842447 2017] [mpm_prefork:notice] [pid 2200] AH00163: Apache/2.4.23 (Debian) configured -- resuming normal operations
[Sun Jan 15 14:51:48.145808 2017] [core:notice] [pid 2200] AH00094: Command line: '/usr/sbin/apache2'
[Sun Jan 15 14:55:25.766188 2017] [mpm_prefork:notice] [pid 3257] AH00163: Apache/2.4.23 (Debian) configured -- resuming normal operations
[Sun Jan 15 14:55:25.801736 2017] [core:notice] [pid 3257] AH00094: Command line: '/usr/sbin/apache2'
[Sun Jan 15 16:08:15.031691 2017] [mpm_prefork:notice] [pid 2316] AH00163: Apache/2.4.23 (Debian) configured -- resuming normal operations
[Sun Jan 15 16:08:15.043756 2017] [core:notice] [pid 2316] AH00094: Command line: '/usr/sbin/apache2'
[Mon Jan 16 11:26:33.007967 2017] [mpm_prefork:notice] [pid 2278] AH00163: Apache/2.4.23 (Debian) configured -- resuming normal operations
[Mon Jan 16 11:26:33.013972 2017] [core:notice] [pid 2278] AH00094: Command line: '/usr/sbin/apache2'
[Tue Jan 17 08:07:35.149382 2017] [mpm_prefork:notice] [pid 3517] AH00163: Apache/2.4.23 (Debian) configured -- resuming normal operations
[Tue Jan 17 08:07:35.152372 2017] [core:notice] [pid 3517] AH00094: Command line: '/usr/sbin/apache2'
What other files would be helpful to debug the service failure?
- Check that service enabled by run
systemctl --no-page -t service -a | grep apache2
- If it disabled, enable it and start:
systemctl enable apache2 && systemctl start apache2
- Check that service works
systemctl status apache2
- If need you can check apache2.service related logs with:
journalctl --no-page -u apache2.service
Note.-f
key works withjournalctl
well as withtail
There is no failure the system is working as designed. It sounds like you probably just need to enable the service so it starts at boot.
systemctl enable service
You may want to spend some time with the systemctl/systemd documentation.