In the previous post, we setup a very basic Exim SMTP server for relaying outgoing mail to GMail from your server. Now, we are going to look at troubleshooting your Exim installation, and dealing with issues that may come up.
Check the Exim logs
First off, the first thing any sysadmin should do when looking for what is causing headaches is to look in the log folder, usually under
/var/log. However, in
/var/log/exim4 is just the panic log (for errors), and the main log. The
paniclog file will show why the daemon can’t start, usually because of a mis-configuration. This would be your first clue. If the file size is 0 bytes, then check that Exim is even started, by executing (as root)
service exim4 status. It should read as a green
[ OK ] to indicate it’s started and working.
Check the queue
Next up, I’m going to steal some advice from Brad’s Exim Cheat Sheet, mainly in learning the exim command line.
Exim stores the messages in a spool, similar to how a printer will spool documents on the server, before sending them one-by-one to the printer. The Exim spool folder is, by default, at /var/spool/exim/. You’ll notice each message has the Message ID embedded in the filename, as well as a -D or -H for a header or message data file.
So, how do you know what’s happening? Assuming the server is running, you can run any of the commands listed below to get information about what’s going on:
exiwhat <== Tells you exactly what the Exim daemon is working on, or processing. Start here, every time.
exim -bpc <== Count the messages in the queue. If it’s greater than 0…
exim -bp <== More information, such as the time it was queued to go, the size, and if the message is
*** frozen ***. These messages tend to screw up the queue, if not managed. For example, you may see something like this (we’ll use it for the examples below):
39h 3.1K 1Wybln-0004EV-BD <> *** frozen ***
Removing frozen messages from the queue
Now with that, it also shows the recipient below it. If it’s a ‘noreply’ address, we can just go ahead and clear it out (since no one answers the ‘noreply’ addresses anyways), using one of these methods below:
exim -Mrm <message-id> <== You can list multiple message id’s to remove, or just one at a time. This is where I’d paste the
1Wybln-0004EV-BD from above. The other option, is I can remove every frozen message, by using
exiqgrep -z -I | xargs exim -Mrm
xargs command takes the output of the previous command, and puts them in as arguments in the following command. Very useful trick to learn!