# Problems with courier-imap....

## SJay

So, new server, new install of the email setup...

Everything is configured as my old server, 

using postfix, courier with mysql for userstorage. and roundcube.

```
 

net-libs/courier-authlib  0.62.2

net-mail/courier-imap    4.6.0

mail-mta/postfix  2.6.6

```

```

May  3 20:09:15 v2063 authdaemond: Installing libauthmysql

May  3 20:09:15 v2063 authdaemond: Installation complete: authmysql

```

```

May  3 20:04:04 v2063 imapd: Connection, ip=[127.0.0.1]

May  3 20:04:04 v2063 imapd: LOGIN FAILED, user=jonas, ip=[127.0.0.1]

May  3 20:04:04 v2063 imapd: authentication error: Input/output error

```

Doesnt even seem like it wants to login, imapd-ssl gives the same result....

The server receives emails and delivers them to the maildirs, so the mysql lookup is working fine...

Anyone got any experience with this?

----------

## erik258

Hi, I don't use courier anymore, having migrated to dovecot for the many configuration advantages, but I used courier exclusively until last august.  I think between the two of us we can probably get it working.  

You haven't provided a whole ton of information, but the part that interests me is the I/O Error message.   Searching on google turned up some promising archives from the mailing list.  Atop my selections for debugging is turning on verbose logging.  Do this for courier and you might get more descriptive messages in your logs.  

Failing that, I'd like to see the query you're using to pull members, and your authdaemond.conf from /etc/courier.  

I'm guessing that either 

* type-o in the query, i/o error refers to the socket or something

* some file or directory is missing (verbose logging should help this)

----------

## SJay

Hi and thanks for your swift reply.

I spent 5 hours googling and searching for this, all that turned up looked promising but in the end didnt make it.

Im not really sure on how to enable the verbose debugging, what i found was DEBUG_LOGIN=1/2 , and it wont post more with those on  :Sad: 

```

v2063 authlib # grep -v "#" authdaemonrc

authmodulelist="authmysql "

authmodulelistorig="authuserdb authpam authshadow authmysql authcustom authpipe"

daemons=5

authdaemonvar=/var/lib/courier/authdaemon

DEBUG_LOGIN=1

DEFAULTOPTIONS=""

LOGGEROPTS=""

```

```

v2063 authlib # grep -v "#" authmysqlrc

MYSQL_SERVER         127.0.0.1

MYSQL_USERNAME       root

MYSQL_PASSWORD       password

MYSQL_PORT           3306

MYSQL_DATABASE       mail

MYSQL_USER_TABLE     users

MYSQL_CRYPT_PWFIELD  password

MYSQL_DEFAULT_DOMAIN site.org

MYSQL_UID_FIELD      uid

MYSQL_GID_FIELD      gid

MYSQL_LOGIN_FIELD    login

MYSQL_HOME_FIELD     home

MYSQL_NAME_FIELD     name

MYSQL_MAILDIR_FIELD  maildir

MYSQL_QUOTA_FIELD    quota

```

```

main.cf

virtual_mailbox_domains = mysql:/etc/postfix/mysql_virtual_domains.cf

virtual_mailbox_maps = mysql:/etc/postfix/mysql_virtual_mailboxes.cf

```

```

/etc/postfix/mysql_virtual_mailboxes.cf

user = root

password = password

hosts = 127.0.0.1

dbname = mail

query = SELECT maildir FROM users WHERE login='%s'

/etc/postfix/mysql_virtual_domains.cf

user = root

password = password

hosts = 127.0.0.1

dbname = mail

query = SELECT domain FROM domains WHERE domain='%s'

```

```

mysql> show tables;

+----------------+

| Tables_in_mail |

+----------------+

| alias_maps     |

| domains        |

| users          |

+----------------+

3 rows in set (0.00 sec)

```

----------

## SJay

main.cf

```

v2063 postfix # grep -v "#"  main.cf

queue_directory = /var/spool/postfix

command_directory = /usr/sbin

daemon_directory = /usr/lib/postfix

data_directory = /var/lib/postfix

mail_owner = postfix

default_privs = nobody

myhostname = mail.site.org

myorigin = $myhostname

inet_interfaces = all

mydestination = $myhostname, localhost.$mydomain, localhost

unknown_local_recipient_reject_code = 550

debug_peer_level = 2

debugger_command =

         PATH=/bin:/usr/bin:/usr/local/bin:/usr/X11R6/bin

         ddd $daemon_directory/$process_name $process_id & sleep 5

sendmail_path = /usr/sbin/sendmail

newaliases_path = /usr/bin/newaliases

mailq_path = /usr/bin/mailq

setgid_group = postdrop

html_directory = /usr/share/doc/postfix-2.5.7/html

manpage_directory = /usr/share/man

sample_directory = /etc/postfix

readme_directory = /usr/share/doc/postfix-2.5.7/readme

virtual_mailbox_domains = mysql:/etc/postfix/mysql_virtual_domains.cf

virtual_mailbox_maps = mysql:/etc/postfix/mysql_virtual_mailboxes.cf

virtual_alias_maps = hash:/etc/postfix/virtual

virtual_gid_maps = static:2000

virtual_minimum_uid = 2000

virtual_uid_maps = static:2000

virtual_mailbox_base = /var/mail/vhosts

mailbox_transport = virtual

virtual_transport = virtual

smtpd_recipient_restrictions =

        reject_non_fqdn_recipient

        reject_non_fqdn_sender

        reject_unknown_recipient_domain

        permit_mynetworks

        permit_sasl_authenticated

        check_policy_service inet:127.0.0.1:2501

        reject_unauth_destination

        permit

smtpd_helo_restrictions = reject_unknown_helo_hostname

smtpd_sender_restrictions = reject_unknown_sender_domain

smtpd_data_restrictions = reject_unauth_pipelining

maildrop_destination_recipient_limit=1

```

master.cf

```

v2063 postfix # grep -v "#"  master.cf

smtp      inet  n       -       n       -       -       smtpd -v

pickup    fifo  n       -       n       60      1       pickup

cleanup   unix  n       -       n       -       0       cleanup

qmgr      fifo  n       -       n       300     1       qmgr

tlsmgr    unix  -       -       n       1000?   1       tlsmgr

rewrite   unix  -       -       n       -       -       trivial-rewrite

bounce    unix  -       -       n       -       0       bounce

defer     unix  -       -       n       -       0       bounce

trace     unix  -       -       n       -       0       bounce

verify    unix  -       -       n       -       1       verify

flush     unix  n       -       n       1000?   0       flush

proxymap  unix  -       -       n       -       -       proxymap

proxywrite unix -       -       n       -       1       proxymap

smtp      unix  -       -       n       -       -       smtp

relay     unix  -       -       n       -       -       smtp -o smtp_fallback_relay=

showq     unix  n       -       n       -       -       showq

error     unix  -       -       n       -       -       error

retry     unix  -       -       n       -       -       error

discard   unix  -       -       n       -       -       discard

local     unix  -       n       n       -       -       local

virtual   unix  -       n       n       -       -       virtual

lmtp      unix  -       -       n       -       -       lmtp

anvil     unix  -       -       n       -       1       anvil

scache    unix  -       -       n       -       1       scache

maildrop  unix  -       n       n       -       -       pipe

```

----------

## erik258

Well, let's see.  Since you can tell postfix is accepting and delivering mail correctly, that tells us two things.  

1) mysql side of things is fine;

2) postfix side of things is fine (except possibly for the SMTP authentication side of things).  

It seems to me that your postfix config corresponds to your courier config.  

It might be worth checking out authtest, which is apparently a way to test logins against courier's authdaemon.  

From the log excerpt you've included, it seems as though imapd is failing because the authenticatino daemon is failing on the backend.  Are you sure there aren't any more relevant log lines?

----------

## SJay

 *erik258 wrote:*   

> Well, let's see.  Since you can tell postfix is accepting and delivering mail correctly, that tells us two things.  
> 
> 1) mysql side of things is fine;
> 
> 2) postfix side of things is fine (except possibly for the SMTP authentication side of things).  
> ...

 

yep, i am  :Sad:  no other lines...

maybe i should rememerge the courier packages as they failed on diffrent stuff that i patched up before i got this error, 

first tls was complaining on some broken symlinks in the cert folder......

----------

## erik258

hey, that's not a bad idea.  Perhaps it would also pay to take a[nother] look 

at http://www.gentoo.org/doc/en/virt-mail-howto.xml

----------

## SJay

 *erik258 wrote:*   

> hey, that's not a bad idea.  Perhaps it would also pay to take a[nother] look 
> 
> at http://www.gentoo.org/doc/en/virt-mail-howto.xml

 

hehe yep... anyhow i decided to run with dovecot now.. runs nice  :Smile: 

----------

## erik258

Yeah, it's a lot more cooperative, huh?  One of the things I really like about dovecot is that the authentication is so very easy.  No more makeuserdb for me! (I use file-backed authentication).  It's also faster, too, according to the (admittedly biased) http://www.dovecot.org/list/dovecot/2007-January/018953.html

----------

