# After upgrade, qmail stops working

## Kosmo

After doing an upgrade of world, my qmail has stopped listening on the smtp port. When started, i get following error... 

Anybody any ideas?

```
fileserver control # /etc/init.d/svscan start

 * Starting service scan...                                               [ ok ]

fileserver control # SERVICE(send), QMAILDUID(201), NOFILESGID(200) or QMAILLUID() is unset in ./run

LOG_OPTS: 

LOG_DEST: /var/log/qmail/qmail-send

Error in logging setup!

Some error detected in send, sleeping for 90 seconds for safety

SERVICE(smtp), QMAILDUID(201), NOFILESGID(200) or QMAILLUID() is unset in ./run

LOG_OPTS: 

LOG_DEST: 

Error in logging setup!

No CDB file found ()

Some error detected in smtp, sleeping for 90 seconds for safety

```

----------

## durian

 *Kosmo wrote:*   

> After doing an upgrade of world, my qmail has stopped listening on the smtp port. When started, i get following error... 
> 
> Anybody any ideas?
> 
> ```
> ...

 

Did you check if any configuration files were changed after the update (run etc-update)? It looks like a configuration error judging from the error messages.

-peter

----------

## newtonian

I did a emerge world last night.  

Today a transformer blew in the neighborhood and caused my mail server to reboot.

Now I get the same message as the user above.  

My guess is that it has to do with /service/qmail-smtpd/run and cdb here is what it looks like:

```

#!/bin/bash

# Gentoo Startup script for qmail's SMTP daemon

# $Header: /var/cvsroot/gentoo-x86/mail-mta/qmail/files/run-qmailsmtpd,v 1.3 2005/01/03 20:55:10 hansmi Exp $

#

# If you need to edit this file, please look at editing conf-smtpd and

# conf-common first.  If you still need to change this file, you should

# probably file a bug on the bugzilla saying what you wanted to change so that

# modification can be make possible via the configuration files

SERVICE=smtp

source /var/qmail/bin/qmail-config-system && \

exec /usr/bin/softlimit ${SOFTLIMIT_OPTS} \

    ${QMAIL_TCPSERVER_PRE} \

    /usr/bin/tcpserver ${TCPSERVER_OPTS} -x ${TCPSERVER_RULESCDB} \

    -c ${MAXCONN} -u ${QMAILDUID} -g ${NOFILESGID} \

    ${TCPSERVER_HOST} ${TCPSERVER_PORT} \

    ${QMAIL_SMTP_PRE} /var/qmail/bin/qmail-${SERVICE}d ${QMAIL_SMTP_POST} \

    2>&1

```

Do you think it has something to do with TCPSERVER_RULESCDB ?  Where would I set that?

Cheers,

----------

## newtonian

QMAILLUID was missing from my /var/qmail/control/conf-common

this is what the top portion of the file looks like now:

```

# Common Configuration file for all qmail daemons

# $Header: /var/cvsroot/gentoo-x86/mail-mta/qmail/files/conf-common,v 1.3 2005/02/14 12:26:31 robbat2 Exp $

# Qmail User IDS to run daemons as

QMAILDUID=`id -u qmaild`

NOFILESGID=`id -g qmaild`

QMAILLUID=`id -u qmaill`

```

To fix the problem I moved the conf-common to conf-common.old and ran emerge qmail.  

The emerge added the conf-common with the new QMAILLUID setting.

I wouldn't recommend doing a full emerge to fix the problem.  

The reason I did it was that I was in a panick.  I'd recommend just adding the 

QMAILLUID=`id -u qmaill` line to your old config file to fix the file.  

Make sure you compare the new config file with your current one to 

see if there is anything else you might be missing.

Cheers,

----------

## soth

I did that and still get 

```

 No CDB file found ()

Some error detected in smtp, sleeping for 90 seconds for safety

```

Looking for those cdb's... have tried to updat the database too...

----------

## newtonian

 *soth wrote:*   

> I did that and still get 
> 
> ```
> 
>  No CDB file found ()
> ...

 

I'm not a qmail pro, so if anybody else has some input feel free to jump in.

I'd suggest to tail all of the related log files and restart svscan.  

The log files should tell you which qmail variable you are missing.

I think there are 3 variables that are related to CDB (I could be wrong).

Cheers,

----------

## soth

Tailed all the files, still no more info...

I guess that this erratic conf inhibits the logging function... =/

Have any suggestion on how to create these .cdb in a correct way? 

I've tried

```

tcprules /var/qmail/users/tcp.qmail-smtp.cdb /var/qmail/users/.tcp.qmail-smtp.tmp < /etc/tcprules.d/tcp.qmail-smtp

tcprules /var/qmail/users/tcp.qmail-pop3.cdb /var/qmail/users/.tcp.qmail-pop3.tmp < /etc/tcprules.d/tcp.qmail-pop3

```

Which should be correct, no?

I have them in /etc/tcprules.d too...

Results:

```

ls -la /var/qmail/users/

total 24

drwxr-xr-x   2 root qmail 4096 Jun 30 16:29 .

drwxr-xr-x  10 root root  4096 Oct 26  2004 ..

-rw-r--r--   1 root root     0 Jun 30 15:44 .keep

-rwxr-xr-x   1 root root  2072 Jun 30 16:17 tcp.pop3.cdb

-rwxr-xr-x   1 root root  2072 Jun 30 16:29 tcp.qmail-pop3.cdb

-rwxr-xr-x   1 root root  2192 Jun 30 16:18 tcp.qmail-smtp.cdb

-rwxr-xr-x   1 root root  2192 Jun 30 16:17 tcp.smtp.cdb

ls -la /etc/tcprules.d/

total 26

drwxr-xr-x   2 root root 1024 Jun 30 15:49 .

drwxr-xr-x  61 root root 4096 Jun 30 15:44 ..

-rwxr-xr-x   1 root root  168 Feb 21 14:00 Makefile

-rwxr-xr-x   1 root root  335 Jun 30 15:44 tcp.qmail-pop3

-rwxr-xr-x   1 root root 2072 Jun 30 15:49 tcp.qmail-pop3.cdb

-rwxr-xr-x   1 root root  537 Jun 30 15:47 tcp.qmail-qmqp

-rwxr-xr-x   1 root root 2257 Jun 30 15:49 tcp.qmail-qmqp.cdb

-rwxr-xr-x   1 root root  916 Jun 30 15:47 tcp.qmail-qmtp

-rwxr-xr-x   1 root root 2255 Jun 30 15:49 tcp.qmail-qmtp.cdb

-rwxr-xr-x   1 root root 4213 Jun 30 15:47 tcp.qmail-smtp

-rwxr-xr-x   1 root root 2192 Jun 30 15:49 tcp.qmail-smtp.cdb

```

I 've tried with

```

chmod 644 /etc/tcprules.d/*

chmod 644 /var/qmail/users/*

```

too.

----------

## Praxxus

Check your /var/qmail/control/conf-common file, and see what TCPSERVER_RULESCDB is set to.  That is where qmail will be looking for your .cdb files.

Also, updating the .cdb databases should be as simple as:

```
cd /etc/tcprules.d

make
```

There is a Makefile in /etc/tcprules.d that should automagically take care of it all for you.  Yay!

----------

## eltech

 *Praxxus wrote:*   

> Check your /var/qmail/control/conf-common file, and see what TCPSERVER_RULESCDB is set to.  That is where qmail will be looking for your .cdb files.
> 
> Also, updating the .cdb databases should be as simple as:
> 
> ```
> ...

 Having the same issues here...

but updating the .cdb database doesnt work..

```
pcns tcprules.d # make

= CDBLIST:

```

whatever that means.. also 

/var/qmail/control/conf-common

does not have a 

TCPSERVER_RULESCDB

any other suggestions?

----------

## deboeck

 *eltech wrote:*   

> also 
> 
> /var/qmail/control/conf-common
> 
> does not have a 
> ...

 

Take a look at /var/qmail/supervise/qmail-smtpd/run, it should look like this:

```

#!/bin/bash

# Gentoo Startup script for qmail's SMTP daemon

# $Header: /var/cvsroot/gentoo-x86/mail-mta/qmail/files/run-qmailsmtpd,v 1.3 2005/01/03 20:55:10 hansmi Exp $

#

# If you need to edit this file, please look at editing conf-smtpd and

# conf-common first.  If you still need to change this file, you should

# probably file a bug on the bugzilla saying what you wanted to change so that

# modification can be make possible via the configuration files

SERVICE=smtp

source /var/qmail/bin/qmail-config-system && \

exec /usr/bin/softlimit ${SOFTLIMIT_OPTS} \

    ${QMAIL_TCPSERVER_PRE} \

    /usr/bin/tcpserver ${TCPSERVER_OPTS} -x ${TCPSERVER_RULESCDB} \

    -c ${MAXCONN} -u ${QMAILDUID} -g ${NOFILESGID} \

    ${TCPSERVER_HOST} ${TCPSERVER_PORT} \

    ${QMAIL_SMTP_PRE} /var/qmail/bin/qmail-${SERVICE}d ${QMAIL_SMTP_POST} \

    2>&1

```

The -x option tells tcpserver which .cdb file to use. As you can see, the file here is stored in the TCPSERVER_RULESCDB variable, which is defined in /var/qmail/control/conf-common. So if it's not there, create it: 

```
TCPSERVER_RULESCDB=/etc/tcprules.d/tcp.qmail-${SERVICE}.cdb
```

However, in the old days, the .cdb file for smtpd used to be /etc/tcp.smtp.cdb and /var/qmail/supervise/qmail-smtpd/run directly referred to it:

```
-x /etc/tcp.smtp.cdb
```

So check if this is the case and then either change it or create the .cdb file at that location.

Hope you got enough info now to solve the problem.

Steven

----------

## eltech

ok.. the problem is the conf-common file .. its more than just "QMAILLUID"

The way i fixed it was.. 

mv conf-common conf-common.orig

emerge qmail

it then put in a new file conf-common.. in place.. 

some of the changes were..

```

# Qmail User IDS to run daemons as

QMAILDUID=`id -u qmaild`

NOFILESGID=`id -g qmaild`

QMAILLUID=`id -u qmaill`

#  This tells tcpserver where to file the rules cdb file

[ -d /etc/tcprules.d/ ] && TCPSERVER_RULESCDB=/etc/tcprules.d/tcp.qmail-${SERVICE}.cdb

[ ! -f "${TCPSERVER_RULESCDB}" ] && TCPSERVER_RULESCDB=/etc/tcprules.d/tcp.${SERVICE}.cdb

# logging directives

LOG_OPTS="t" # 't' is for timestamp

LOG_MAXSIZE=2500000 # defalts to '99999' if empty

LOG_MAXCOUNT=10 # defaults to '10' if empty

# build LOG_OPTS from this

[ -n "${LOG_MAXSIZE}" ] && LOG_OPTS="${LOG_OPTS} s${LOG_MAXSIZE}"

[ -n "${LOG_MAXCOUNT}" ] && LOG_OPTS="${LOG_OPTS} n${LOG_MAXCOUNT}"

# directory to log to

LOG_DEST=/var/log/qmail/qmail-${SERVICE}d

```

but i could not get the .cdb files to create in the tcprules.d directory i just get the message: 

pcns tcprules.d # make

= CDBLIST: 

but you have to type: make tcp.qmail-smtp.cdb

hope this helps someone..

thanks for the leading help though  :Smile: 

----------

## eltech

deboeck yes.. it wasnt clear until i saw the new conf-common file after re-emerging qmail .. seems all well now.. thank you

----------

## soth

A lot of good help here!

I solved my problems through unmerge qmail, and then reinstalling it, using the queue-restore to get the queues working again, too. 

One of my problems was that qmail took the recieptadress from my hostname which was unqualified, I. E. 

```

hostname.domain.com

```

Instead of 

```

domain.com

```

I found the util for repairing the queue at:

http://pyropus.ca/software/queue-repair/

REALLY nice. I started on a script for checking it myself, and it's tedious, believe me =). Use this tool. It kicks...

Ummm... anything else... yes, the commandlines i used for the queue was this:

```

./queue_repair.py -t

./queue_repair.py --create --split 23  --bigtodo

```

Which is good if you have a default install of qmail an do a reinstall. Use --repair instead of --create if your queue is damaged. 

I think that's all...

----------

## soth

...and I think the title should contain [solved] now  :Cool: 

----------

## geforce

I've followed all the steps but it still don't work..

ps ax | grep tcpserver gives:

 *Quote:*   

> 24358 pts/1    S      0:00 /usr/bin/tcpserver -p -v -R -x /etc/tcprules.d/tcp.qmail-smtp.cdb -c 40 -u 201 -g 200 0.0.0.0 smtp relay-ctrl-check /var/qmail/bin/qmail-smtpd netrock.ca /var/vpopmail/bin/vchkpw /bin/true
> 
> 24476 pts/1    Z      0:00 [tcpserver] <defunct>
> 
> 24478 pts/1    R+     0:00 grep tcpserver

 

Is it supposed to work now ?

Because it wont for the moment.

Phil

----------

## newtonian

 *geforce wrote:*   

> 
> 
> ps ax | grep tcpserver gives:
> 
>  *Quote:*   24358 pts/1    S      0:00 /usr/bin/tcpserver -p -v -R -x /etc/tcprules.d/tcp.qmail-smtp.cdb -c 40 -u 201 -g 200 0.0.0.0 smtp relay-ctrl-check /var/qmail/bin/qmail-smtpd netrock.ca /var/vpopmail/bin/vchkpw /bin/true
> ...

 

I don't know enough about qmail to be of much help but I can give you the output of my working config, so you can compare the two.  Hopefully someone else will come along and give you some more helpful advice.

hawk david # ps ax | grep tcpserver

```

 5999 ?        S      0:02 /usr/bin/tcpserver -p -v -R -x /etc/tcprules.d/tcp.qmail-smtp.cdb -c 40 -u 201 -g 200 0.0.0.0 smtp /var/qmail/bin/qmail-smtpd mydomain.com /var/vpopmail/bin/vchkpw /bin/true

32338 pts/0    S+     0:00 grep tcpserver

```

for what it's worth I'm running:

 qmail 1.03-r15

 net-mail/vpopmail 5.4.6-r1

Cheers,

----------

## newtonian

 *geforce wrote:*   

> I've followed all the steps but it still don't work..
> 
> Is it supposed to work now ?
> 
> Phil

 

What output do you from your /var/log/everything/current log

or your qmail logs when you start svscan?

When I had the  problem listed above, I was getting an error message in /var/log/everything/current

when I started svscan.  That led me to the answer.

Cheers,

----------

## geforce

/var/log/qmail/qmail-smtp/current

 *Quote:*   

> @400000004313b20728010cfc tcpserver: status: 0/40
> 
> @400000004313b378248c683c tcpserver: status: 1/40
> 
> @400000004313b378248c77dc tcpserver: pid 24805 from 127.0.0.1
> ...

 

Well, at this point, I can send message trought SMTP from my local network and LocalHost, but it looks like it won't accept other connections ..

No, i'm not behind any kind of firewalls,  I'm on a compagny T1 Connection, and I know the network.

If someone understand something in this ...

Phil

----------

## newtonian

 *geforce wrote:*   

> 
> 
> Well, at this point, I can send message trought SMTP from my local network and LocalHost, but it looks like it won't accept other connections ..
> 
> Phil

 

Try sending mail from a non-local network and while tailing /var/log/qmail/qmail-smtp/current and /var/log/everything/current or any other log that you might think will contain error messages.

Try to telnet to the qmail server on port 25 from a non local connection and send a email message

via telnet and typed commands.  That way you can see where qmail is having problems.  

Once you get the error the server is replying with and post it back here.

Cheers,

----------

