# [SOLVED] how to solve tcpserver - netqmail courier-imap vpop

## gkaefer

Hi all,

I tried to setup netqmail server following twice without 100% success: http://www.gentoo.org/doc/en/qmail-howto.xml

I start in this sequence:

```
/etc/init.d/courier-imapd start

/etc/init.d/courier-imapd-ssl start

/etc/init.d/courier-pop3 start

/etc/init.d/courier-pop3-ssl start

/etc/init.d/svscan start
```

whitout error in console

After finishing "point 5 - netqmail (talking to the world)" I get following behaviour:

I can add a domain with vadddomain

I can add user to this domain with vadduser

I can use POP3/IMAP account with and without authentification 

I can use POP3/IMAP account with and without SSL authentification.

so far perfect.

BUT:

 *Quote:*   

> #more /var/log/qmail/qmail-pop3d/current | grep "address already used" | wc -l
> 
> 9069

 

... gives me many thousands error messages:

```
@4000000047ff63db35446404 tcpserver: fatal: unable to bind: address already used
```

so a Port conflict.

```
netstat -apn | egrep ^tcp | egrep LISTEN

tcp        0      0 0.0.0.0:993             0.0.0.0:*               LISTEN      3808/couriertcpd    

tcp        0      0 0.0.0.0:995             0.0.0.0:*               LISTEN      4110/couriertcpd    

tcp        0      0 127.0.0.1:3306          0.0.0.0:*               LISTEN      16219/mysqld        

tcp        0      0 0.0.0.0:110             0.0.0.0:*               LISTEN      13801/couriertcpd  <--- !!!

tcp        0      0 0.0.0.0:143             0.0.0.0:*               LISTEN      3749/couriertcpd    

tcp        0      0 0.0.0.0:209             0.0.0.0:*               LISTEN      13894/tcpserver     

tcp        0      0 0.0.0.0:628             0.0.0.0:*               LISTEN      13919/tcpserver     

tcp        0      0 127.0.0.1:53            0.0.0.0:*               LISTEN      13878/dnscache      

tcp        0      0 0.0.0.0:21              0.0.0.0:*               LISTEN      4627/proftpd: (acce 

tcp        0      0 0.0.0.0:25              0.0.0.0:*               LISTEN      13864/tcpserver     

tcp        0      0 :::80                   :::*                    LISTEN      4575/apache2        

tcp        0      0 :::22                   :::*                    LISTEN      4360/sshd           

tcp        0      0 :::443                  :::*                    LISTEN      4575/apache2 
```

so If I do /etc/init.d/courier-pop3d stop the above netstat command look following Port 110 replacesd by tcpserver and the errors in /var/log/qmail/qmail-pop3d/current are stopping.

```
netstat -apn | egrep ^tcp | egrep LISTEN

tcp        0      0 0.0.0.0:993             0.0.0.0:*               LISTEN      10932/couriertcpd   

tcp        0      0 0.0.0.0:995             0.0.0.0:*               LISTEN      13286/couriertcpd   

tcp        0      0 127.0.0.1:3306          0.0.0.0:*               LISTEN      16219/mysqld        

tcp        0      0 0.0.0.0:110             0.0.0.0:*               LISTEN      14118/tcpserver   <--- !!!

tcp        0      0 0.0.0.0:143             0.0.0.0:*               LISTEN      10873/couriertcpd   

tcp        0      0 0.0.0.0:209             0.0.0.0:*               LISTEN      11113/tcpserver     

tcp        0      0 0.0.0.0:628             0.0.0.0:*               LISTEN      11124/tcpserver     

tcp        0      0 127.0.0.1:53            0.0.0.0:*               LISTEN      11075/dnscache      

tcp        0      0 0.0.0.0:21              0.0.0.0:*               LISTEN      4627/proftpd: (acce 

tcp        0      0 0.0.0.0:25              0.0.0.0:*               LISTEN      11067/tcpserver     

tcp        0      0 :::80                   :::*                    LISTEN      4575/apache2        

tcp        0      0 :::22                   :::*                    LISTEN      4360/sshd           

tcp        0      0 :::443                  :::*                    LISTEN      4575/apache2 
```

BUT now:

POP3 account only works if SSL authentication for POP3 is enabled.

normal telnet 110 than now longer works:

```
telnet localhost 110

Trying 127.0.0.1...

Connected to localhost.

Escape character is '^]'.

+OK <14323.1207923284@mail.mydomain.at>

user postmaster@myemail.at

+OK 

pass xxxx

-ERR authorization failed

Connection closed by foreign host.
```

my /var/qmail/supervise/qmail-smtpd/run is currently default untouched after emerge:

```
#SERVICE=smtp

. /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
```

also untouched after emerge: /var/qmail/control/conf-common:

```
TCPSERVER_HOST=0.0.0.0
```

any idea how to fix that?

many thanks in advance,

GeorgLast edited by gkaefer on Thu Apr 17, 2008 11:13 am; edited 1 time in total

----------

## gkaefer

ok, it took some time...

ok the output of emerge netqmail gives the advise to do following:

```
emerge netqmail

output:

 * Messages for package mail-mta/netqmail-1.05-r8:

 * QA: stop using the bindnow-flags function ... simply drop it from your ebuild

 * To setup qmail to run out-of-the-box on your system, run:

 * emerge --config =mail-mta/netqmail-1.05-r8

 * 

 * To start qmail at boot you have to add svscan to your startup

 * and create the following links:

 * ln -s /var/qmail/supervise/qmail-send /service/qmail-send

 * ln -s /var/qmail/supervise/qmail-smtpd /service/qmail-smtpd

 * 

[b] * To start the pop3 server as well, create the following link:

 * ln -s /var/qmail/supervise/qmail-pop3d /service/qmail-pop3d[/b] * 

 * Additionally, the QMTP and QMQP protocols are supported, 

 * and can be started as:

 * ln -s /var/qmail/supervise/qmail-qmtpd /service/qmail-qmtpd

 * ln -s /var/qmail/supervise/qmail-qmqpd /service/qmail-qmqpd

 * 

 * Additionally, if you wish to run qmail right now, you should 

 * run this before anything else:

 * source /etc/profile

 * 

 * If you are looking for documentation, check those links:

 * http://www.gentoo.org/doc/en/qmail-howto.xml

 *   -- qmail/vpopmail Virtual Mail Hosting System Guide

 * http://www.lifewithqmail.com/

 *   -- Life with qmail

 * GNU info directory index is up-to-date.

 * IMPORTANT: 1 config files in '/var/qmail/control' need updating.

 * See the CONFIGURATION FILES section of the emerge

 * man page to learn how to update config files.
```

in combination with courier-imap pop3 service it brings you to my fault I had:

svscan and courier-imap complaining about port 25 occupied by an other service.

So - to solve the problem for me I did remove the symbolic link from /service pointing to svscan/qmail pop3d.

now it looks like:

```
ls -ltr /service/

total 0

lrwxrwxrwx 1 root root 32 Jun 23  2006 qmail-smtpd -> /var/qmail/supervise/qmail-smtpd

lrwxrwxrwx 1 root root 16 Mar 29 00:13 dnscachex -> ../var/dnscachex

lrwxrwxrwx 1 root root 15 Mar 29 00:22 dnscache -> ../var/dnscache

lrwxrwxrwx 1 root root 32 Mar 30 04:34 qmail-qmtpd -> /var/qmail/supervise/qmail-qmtpd

lrwxrwxrwx 1 root root 32 Mar 30 04:34 qmail-qmqpd -> /var/qmail/supervise/qmail-qmqpd

lrwxrwxrwx 1 root root 32 Apr 10 12:58 qmail-send -> /var/qmail/supervise/qmail-send/
```

what makes more sense / whats more useful:

to use qmails qmail-pop3d or to use courier-imap-pop3d?

regards,

Georg

----------

