# dovecot-2.0.2 and fetchmail:"MDA returned nonzero status 75"

## Havin_it

Hi,

So dovecot-2.0.2 has landed on my system, and after some initial panic, I reckoned I'd got the new config layout licked. However, apparently not as fetchmail is unable to deliver my mail using dovecot-lda, getting only the above (which seems to be a bit of a catch-all error code) in response.

There are several virtual mailboxes on the server, all with this basic format in /etc/fetchmailrc:

```
poll <external pop3 server> with proto POP3 auth password

       user '<pop3 username>' there with password '<pop3 password>' is '<local mailbox>' here options no rewrite

    mda  "clamassassin | spamc -s 8192000 | /usr/libexec/dovecot/dovecot-lda -d <local mailbox>"
```

Note: I've also tried removing the pipes through clamassassin and spamc, that makes no difference.

Here's the output of dovecot -n:

```
# 2.0.2: /etc/dovecot/dovecot.conf

# OS: Linux 2.6.35-gentoo-r5 i686 Gentoo Base System release 2.0.1 

auth_debug = yes

auth_verbose = yes

disable_plaintext_auth = no

listen = *

log_path = /var/log/dovecot.log

mail_debug = yes

mail_location = maildir:~/.maildir

maildir_very_dirty_syncs = yes

managesieve_notify_capability = mailto

managesieve_sieve_capability = comparator-i;octet comparator-i;ascii-casemap fileinto reject envelope encoded-character vacation subaddress comparator-i;ascii-numeric relational regex imap4flags copy include variables body enotify environment mailbox date

passdb {

  args = scheme=PLAIN username_format=%u /etc/dovecot/passwd

  driver = passwd-file

}

plugin {

  sieve = ~/.dovecot.sieve

  sieve_dir = ~/sieve

  sieve_global_path = /home/vmail/sieve

}

protocols = imap

service auth {

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

    mode = 0666

  }

  unix_listener auth-userdb {

    mode = 0666

  }

}

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

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

userdb {

  args = uid=vmail gid=vmail home=/home/vmail/%u

  driver = static

}

protocol lda {

  mail_plugins = sieve

}
```

Here's what I get in dovecot.log when fetchmail attempts to use lda:

```
Sep 16 16:20:55 auth: Debug: auth client connected (pid=32404)

Sep 16 16:20:55 auth: Debug: client in: AUTH    1       PLAIN   service=imap    secured lip=127.0.0.1   rip=127.0.0.1   lport=143       rport=53824

Sep 16 16:20:55 auth: Debug: client out: CONT   1

Sep 16 16:20:55 auth: Debug: client in: CONT<hidden>

Sep 16 16:20:55 auth: Debug: passwd-file(<mailboxname>,127.0.0.1): lookup: user=<mailboxname> file=/etc/dovecot/passwd

Sep 16 16:20:55 auth: Debug: client out: OK     1       user=<mailboxname>

Sep 16 16:20:55 auth: Debug: master in: REQUEST 1       32404   1       3db9a241db7872e1e1e4bb440c7690e7

Sep 16 16:20:55 auth: Debug: master out: USER   1       <mailboxname>        uid=1003        gid=451 home=/home/vmail/<mailboxname>

Sep 16 16:20:55 imap-login: Info: Login: user=<<mailboxname>>, method=PLAIN, rip=127.0.0.1, lip=127.0.0.1, mpid=32407, secured

Sep 16 16:20:55 imap(<mailboxname>): Debug: Effective uid=1003, gid=451, home=/home/vmail/<mailboxname>

Sep 16 16:20:55 imap(<mailboxname>): Debug: maildir++: root=/home/vmail/<mailboxname>/.maildir, index=, control=, inbox=/home/vmail/<mailboxname>/.maildir

Sep 16 16:21:05 imap(<mailboxname>): Info: Disconnected: Logged out bytes=5810/306552
```

I don't think it's a permissions issue as I tried running fetchmail as root, and I also know that lda *can* work because I am using it as a transport in postfix to route mail between local accounts and that works fine.  Maybe something is wrong in the sieve setup (I gather this has changed a bit, and I hardly knew what I was doing with that to begin with) or in the way fetchmail invokes lda (though looking at the manpage I don't see what could be wrong)?

Any ideas or tips for better debugging very welcome.

----------

## Havin_it

OK, wrong - it looks like it *is* a permission problem. When postfix uses dovecot-lda, it does so as the user/group vmail:vmail, which is the account under which all the virtual mailboxes live. Fetchmail however runs as fetchmail:fetchmail, which I think is why it fails. I tried invoking it directly like this:

```
echo "To: <local mail addr>

> From: root@localhost

> Subject: Test

> Blah blah blah

>

>." | /usr/libexec/dovecot/dovecot-lda -u <mailbox name>
```

If I run this as root (or vmail) the message is delivered; if I do it as a normal user it fails.

The question is how to resolve this, as fetchmail is supposed to be run as its own uid/gid.

----------

