Reading Time: 3minutes
It's one of this days, when you'd wish to be dead and never born ever!
I experienced terrible problems with Qmail once AGAIN!
Most of the qmail administrators out there are probably aware, Everytime qmail stops working it's like
walking in a dark room without a light torch before you fix it up.
To fix a broken qmail your only friend could be patience. It's fucking insane seriously I more and more start hating qmail when it's broken.
I've experienced the following error messages today on our corporate qmail:
delivery xx: failure: Sorry._Although_I'm_listed_as_a_best-preference_MX_or_A_for_that_host,/it_isn't_in_my_control/locals_file,_so_I_don't_treat_it_as_local. as well as: delivery 232: deferral: Sorry,_I_wasn't_able_to_establish_an_SMTP_connection._(#4.4.1)/
A lot of this junk filled the qmail logs. I still am not completely sure the exact reasons
what caused the problems. However I fixed the situation tweakening some of the common
qmail and vpopmail configuration files and respectively their cdb files.
Here is the list of files I got to rebuild and the things I've did to resolve the qmail issues:
cd /home/vpopmail/domains; for i in *; do echo +$i-:$i:89:89:/home/vpopmail/domains/$i:-:: >>assign; done # backup old assign file just in case something goes wrong cp -rpf /var/qmail/users/assign /var/qmail/users/assign.bak mv assign /var/qmail/users/assign # backup virtualdomains list file cp -rpf /var/qmail/control/virtualdomains /var/qmail/control/virtualdomains.bak for i in *; do echo $i:$i >>virtualdomains; done mv virtualdomains /var/qmail/control/ # Make sure your /var/qmail/control/rcpthosts contains all the vpopmail domains # backup rcpthosts for laters cp -rpf /var/qmail/control/rcpthosts /var/qmail/control/rcpthosts.bak for i in *; do echo $i >>rcpthosts; done cp -rpf rcpthosts /var/qmail/control/ # backup morercpthosts cp -rpf morercpthosts /var/qmail/control/morercpthosts.bak # overwrite the old morercpthosts # in my case morercpthosts was missing all the vpopmail virtual domains # thus the domains missing the file wasn't able to receive mail cp -rpf rcpthosts /var/qmail/control/morercpthosts # Another problem if you're using qmail check user patch might be in /var/qmail/users/recipients # Thus rebuilding the recipients file is a good idea. # Rebuilding it might be done through qmail-vpopmail2recipients script # the script has a bug the last if statement, where two if's have to be commented to make it wokring # Below I'll put a link to a working version of the qmail-vpopmail2-recipients script # Another possible problem could be in /var/qmail/users/cdb # Therefore it might be a good idea to rebuild it with /var/qmail/bin/qmail-newu # Another thing to do is to rebuild the /var/qmail/control/morercpthosts.cdb file with the command /var/qmail/bin/qmail-newmrh # Other things I did was # to assure myself that /var/qmail/control/me contains my mail server host name # /var/qmail/control/locals should contain "localhost" as well as the FQDN (Fully Qualified Domain Name) (e.g. your domain name) # Also I checked my /etc/tcp.smtp and assured myself everything is correct there. # After which I executed qmailctl cdb # That rebuilded my /etc/tcp.smtp.cdb file # Well that was mostly what I did to fix my problems. # Another think that might be a good idea is to try cd /home/vpopmail/domains; for i in *; do /home/vpopmail/bin/vdominfo $i; done # If you observe some domain's domain info cannot be shown # then that might be due to some problem with your vpopmail # It might be a good idea to check your /var/qmail/bin/qmail-showctl # qmail-showctl is a handy diagnosis qmail tool # While looking over the command output # I had to make sure my cdb files are "Modified Recently" # and my virtualdomains are all showing up # THat's mostly what fixed qmail for me # Next I executed qmailctl stop; sleep 10; qmailctl start # that restarted my qmail # However qmail doesn't always start logging to /var/log/qmail directory right away # after restart # SOmetimes the qmail server needs a couple of restarts before it starts serving mail # Thus restarting it is always full of uncertancies and a lot of broken nerves!
I love qmail it absolutely works brilliant as long as it works, quite often
if you do even minor changes that usually means a broken qmail and qmail hell again!
I truly hope this post could be helpful to somebody out there
Here is a link to a working version of qmail-vpopmail2-recipients