Score:0

How to get a more verbose error message with service apache2 start

de flag

I have the task to transfer apache settings from an old linux system to a new system (Ubuntu 20.04.5 LTS). After copying the /etc/apache2 folders to the new server and restarting the apache I had some problems which were caused by missing libraries in the config files. I fixed those and

$ sudo /usr/sbin/apachectl -t
Syntax OK

gives me the ok on my configuration files.

However when I try to start the apache again this happens:

$ sudo service apache2 start
Job for apache2.service failed because the control process exited with error code.
See "systemctl status apache2.service" and "journalctl -xe" for details.

journalctl -xe has nothing and v goves me the following:

$ systemctl status apache2.service
● apache2.service - The Apache HTTP Server
     Loaded: loaded (/lib/systemd/system/apache2.service; enabled; vendor preset: enabled)
     Active: failed (Result: exit-code) since Thu 2022-10-13 16:05:54 UTC; 50s ago
       Docs: https://httpd.apache.org/docs/2.4/
    Process: 41669 ExecStart=/usr/sbin/apachectl start (code=exited, status=1/FAILURE)

So the informations basically "you have an error because you have an error"

How can I get the apache start more verbose to get hints what the problem might be?

I already had a look here

ru flag
Use the journal. `journalctl -u apache2.service -n 50` should get you the lines you want to look at, and is a more accurate form of journalctl that gets you Apache data. This is where you'll find error output;
Calamity Jane avatar
de flag
@David regrettably I am not the "real" admin of this system and also not the person allowed to make the decisions. If that were the case I would e.g. install the 289 security updates on the other server, which is an 16.04. It is a poor company, when a developer is more competent in apache adminstration as the responsible admin. In short: Yes you are right, I wish I could.
Calamity Jane avatar
de flag
@ThomasWard thank you that helped! ... Oct 13 16:02:43 gl-p-euw4a-pucintra5 apachectl[41648]: no listening sockets available, shutting down Oct 13 16:02:43 gl-p-euw4a-pucintra5 apachectl[41648]: AH00015: Unable to open logs Oct 13 16:02:43 gl-p-euw4a-pucintra5 apachectl[41645]: Action 'start' failed. Oct 13 16:02:43 gl-p-euw4a-pucintra5 apachectl[41645]: The Apache error log may have more information. Although it is poetry that it first says it cannot open the logs and the advises me to look in the logs :D But I guess this is my error!
Calamity Jane avatar
de flag
@ThomasWard do you want to post this as an answer?
ru flag
yep i'll do so.
David avatar
cn flag
Thank you @Calamity Jane I see there was nothing wrong with my comment.
Score:2
ru flag

The problem with the recommendations by systemd in 20.04 and elsewhere is that you're not guaranteed to get data in the logs that's useful with those. journalctl -xe includes extra noise and junk not related to Apache, and systemctl status will only get you the last run/load stanza which will not give you useful information.

To really find out what you're having a problem with, you need to use journalctl but with different options. Run journalctl -u apache2.service -n 50 to get the last 50 lines from the journal logs. Increase that number 50 to however many lines oyu need to get the error messages.

(Note that in 22.04 and later, the systemd error output indicates to add u to the arguments and specify the service that failed to get service-specific logs.)


from your comments you indicated you found these errors following these instructions:

Oct 13 16:02:43 gl-p-euw4a-pucintra5 apachectl[41648]: no listening sockets available, shutting down
Oct 13 16:02:43 gl-p-euw4a-pucintra5 apachectl[41648]: AH00015: Unable to open logs
Oct 13 16:02:43 gl-p-euw4a-pucintra5 apachectl[41645]: Action 'start' failed.
Oct 13 16:02:43 gl-p-euw4a-pucintra5 apachectl[41645]: The Apache error log may have more information.

You can chase that error down in separate discussion threads here or simple Google, but at least you know the error you're running into now!

I sit in a Tesla and translated this thread with Ai:

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.