# [SOLVE] Upgrade dovecot-1 to dovecot-2.2: Mail delivery brok

## hoacker

Hi everybody.

This is my second evening asking google, reading and trying to fix my mail server but I just can't get it. 

After roughly half a years of not updating my server I took a heart and updated last weekend. One of the updates was dovecot-1.2.17

 to dovecot-2.2.13-r1. As I see from emerge log I tried updating to dovecot-2.0 in may 2011 but reverted to dovecot-1.2. because of problems which I ran into last weekend again, most likely.

Current setup: 

```
net-mail/dovecot-2.2.13-r1  USE="bzip2 caps imapc kerberos maildir mysql ssl tcpd zlib -cydir -doc -ipv6 -ldap -lucene -lz4 -lzma -managesieve -mbox -mdbox -pam -pop3c -postgres -sdbox (-selinux) -sieve -solr -sqlite -static-libs -suid -vpopmail"

dev-libs/cyrus-sasl-2.1.26-r3:2  USE="berkdb gdbm kerberos mysql pam ssl -authdaemond -java -ldapdb -openldap -postgres -sample -sqlite -srp -static-libs -urandom"

mail-mta/postfix-2.10.3  USE="berkdb dovecot-sasl mysql sasl ssl -cdb -doc -hardened -ldap -ldap-bind -mbox -memcached -nis -pam -postgres (-selinux) -sqlite -vda"

```

I followed this guide to migrate config files: http://wiki2.dovecot.org/Upgrading/2.0.

Now I have authentication problems. 

I had cyrus-sasl compile with USE=-pam but got the following error. I got rid of this message with USE=pam:

```
saslauthd[2939]: set_auth_mech   : unknown authentication mechanism: pam
```

Postfix trying to deliver mail show these messages:

```
Aug 25 19:51:21 localhost dovecot: lda: Error: userdb lookup(*email-address removed*): Request timed out

Aug 25 19:51:21 localhost dovecot: lda: Fatal: Internal error occurred. Refer to server log for more information.

Aug 25 19:51:22 localhost postfix/pipe[3460]: 4CB05888E37: to=<*email-address removed*>, relay=dovecot, delay=7522, delays=6578/788/0/156, dsn=4.3.0, status=deferred (temporary failure)
```

Login via IMAP fails:

```
[19:31:05] IMAP4< * CAPABILITY IMAP4rev1 LITERAL+ SASL-IR LOGIN-REFERRALS ID ENABLE IDLE STARTTLS AUTH=PLAIN 

[19:31:05] IMAP4< 1 OK Pre-login capabilities listed, post-login capabilities have more. 

[19:31:05] IMAP4> Logging *email-address removed* to *server-address removed* using LOGIN

** IMAP Fehler auf *server-address removed*: stream error

** IMAP4-Verbindung unterbrochen

[19:32:35] IMAP4< Error logging in to *server-address removed*

```

dovecot -n:

```

# 2.2.13: /etc/dovecot/dovecot.conf

# OS: Linux 3.12.13-gentoo x86_64 Gentoo Base System release 2.2 reiserfs

disable_plaintext_auth = no

first_valid_gid = 12

first_valid_uid = 8

last_valid_gid = 12

last_valid_uid = 8

listen = *

mail_gid = mail

mail_location = maildir:/var/mail/%d/%n/Maildir/:INDEX=/var/mail/%d/%n/indexes

mail_uid = mail

passdb {

  args = /etc/dovecot/dovecot-sql.conf

  driver = sql

}

protocols = imap

service auth {

  unix_listener /var/spool/postfix/private/auth {

    group = postfix

    mode = 0660

    user = postfix

  }

  unix_listener auth-master {

    group = mail

    mode = 0600

    user = mail

  }

  user = nobody

}

ssl_cert = </etc/ssl/dovecot/server.pem

ssl_key = </etc/ssl/dovecot/server.key

userdb {

  driver = passwd

}

userdb {

  args = /etc/dovecot/dovecot-sql.conf

  driver = sql

}

protocol imap {

  mail_plugins = quota imap_quota

}

protocol pop3 {

  mail_plugins = quota

}

protocol lda {

  mail_plugins = quota

  postmaster_address = *email address removed*

}

```

Anybody can help?Last edited by hoacker on Mon Aug 25, 2014 6:52 pm; edited 1 time in total

----------

## hoacker

Seems I found the problem (why does it always happen shortly after I posted in this forum?). I uncommented the "user" line in /etc/dovecot/conf.d/10-master.conf

```

service auth {

  # [..]

  # Auth process is run as this user.

  user = $default_internal_user

}

```

I can IMAP and the mails are coming in...

----------

## hoacker

No, still doesn't work but getting closer.

I get this error:

```
localhost dovecot: auth: Error: net_connect_unix(auth-worker) in directory /run/dovecot failed: Permission denied (euid=65534(nobody) egid=65534(nobody) missing +r perm: /run/dovecot/auth-worker, dir owned by 0:0 mode=0755)
```

File permissions:

```
srw-------  1 dovecot root       0 25. Aug 20:37 auth-worker
```

I tried different entries in conf.d/10-master.conf but could't figure out the right one. Current:

```
service auth-worker {

  user = dovecot

  unix_listener auth-worker {

    user = dovecot

  }

}

```

EDIT:

OK, found the culplit. Changed dovecot.conf from

```
service auth {

  [..]

  user = nobody

}
```

to

```
service auth {

  [..]

  user = dovecot

}
```

----------

