Set as fillows: mail_location = maildir:/var/vmail/%d/%n/Maildir
Dovecot error record for every mailbox:
Error: autoexpunge: Couldn't create dovecot.autoexpunge.lock lock: file_create_locked(/var/vmail/<full_email>/dovecot.autoexpunge.lock) failed: safe_mkstemp(/var/vmail/<full_email>/dovecot.autoexpunge.lock) failed: No such file or directory
The problem is it tries to create /var/vmail/<full_email>/dovecot.autoexpunge.lock WITHOUT checking for existence and creating <full_email> dir in it.
This leads to No such file or directory error.
If I do mkdir /var/vmail/<full_email> then errors are not thrown and lockfile is created and then deleted ok.
There is NO settings regarding autoexpunge lockfiles. CONTROL option pointing to other dir does not work either.
I had this same exact problem when migrating from Dovecot's LDA to LMTP. Turns out it was a bad SQL CONCAT() query (no idea why the error wasn't produced when using the LDA?)
Anyhow, I was pointed in the right direction and checked the user's settings via
doveadm user [email protected]which listed the user's home as/var/vmail/[email protected]. This was related to Dovecot's SQL lookup query in/usr/local/etc/dovecot/dovecot-sql.conf.ext. My previous query was:user_query = SELECT CONCAT('/var/vmail/', maildir) as home, 110 AS uid, 110 AS gid, CONCAT('*:bytes=', quota) AS quota_rule FROM mailbox WHERE username = '%u' AND active = '1'As you can see, the CONCAT() for "home" was merging both "/var/vmail" and "maildir" (which was [email protected].) Simply removing the CONCAT() for "home" and specifying it using Dovecot's variables resolved the issue:
user_query = SELECT '/var/vmail/%d/%n' as home, 110 AS uid, 110 AS gid, CONCAT('*:bytes=', quota) AS quota_rule FROM mailbox WHERE username = '%u' AND active = '1'Hope this helps!