What is the correct way to configure the mail_location option for Mailidr format?
Short version:
What is the correct way to configure the mail_location option for Mailidr format?
I've long had it setup this way:
mail_location = maildir:/var/vmail/%d/%n
based on this guide:
https://www.linode.com/docs/email/postfix/email-with-postfix-dovecot-and-mys...
Is that correct?
Longer version:
After upgrading from Dovecot v2.0.x to v2.2.x yesterday I'm coming to the conclusion that I've got it configured wrong. This is probably compounded by my bright idea of explicitly setting the path separator prior to the upgrade like so:
separator = .
Because we're using Maildir I thought it would be useful to explicitly set the separator value to what the default is for Maildir. I figured this would be a good way to remind myself what the separator is by default. I also figured while I was merging the conf changes between v2.0 and v2.2 I could roll that additional change in also. Looks like that was a bad idea to include unnecessary changes until things had stabilized. I should know better; I was too optimistic for my own good.
Here is an example error message I ran into:
stat(/var/vmail/example.com/username/.dovecot.lda-dupes/tmp) failed:
Not a directory
which is nearly identical (other than leading path) to what is shown here:
http://www.dovecot.org/list/dovecot/2010-April/048227.html
Steffen Kaiser responded with, "You should not (must not) have home == maildir root." That is when I double-checked the guide that I mentioned above and found that I had followed their directions exactly for that conf setting. Looking at some other guides/tutorials shows something more like:
mail_location = maildir:/var/vmail/%d/%n/Maildir
I assume the latter is how it's supposed to be done? If so, that would explain the problems I've had with Sieve scripts in the past until I explicitly set 'sieve_dir' like so:
sieve_dir = /var/vmail/sieve/%d/%n/sieve_dir
I did review the official docs here:
http://wiki2.dovecot.org/MailLocation/Maildir
but I didn't find where it explicitly warns against setting home == maildir root. It should probably be apparent, but it wasn't to me when I first configured that setting.
Thanks in advance for your help. If it turns out that the linode.com guide is wrong I'll create a Pull request to have that guide updated.
On October 21, 2014 6:18:07 PM deoren Dovecot-mailing-list@whyaskwhy.org wrote:
mail_location = maildir:/var/vmail/%d/%n/Maildir sieve_dir = /var/vmail/sieve/%d/%n/sieve_dir
mail_location = maildir:/var/vmail/%d/%n/.maildir sieve_dir = /var/vmail/%d/%n/.sieve
More simple, and more easy to tarball backup
On 10/21/2014 11:44 AM, Benny Pedersen wrote:
On October 21, 2014 6:18:07 PM deoren Dovecot-mailing-list@whyaskwhy.org wrote:
mail_location = maildir:/var/vmail/%d/%n/Maildir sieve_dir = /var/vmail/sieve/%d/%n/sieve_dir
mail_location = maildir:/var/vmail/%d/%n/.maildir sieve_dir = /var/vmail/%d/%n/.sieve
More simple, and more easy to tarball backup
Thank you for the advice. Can you comment re these two approaches for configuring the 'mail_location' option? I assume the first is simply wrong?
mail_location = maildir:/var/vmail/%d/%n mail_location = maildir:/var/vmail/%d/%n/.maildir
Also, why do you use the '.maildir' folder name instead of 'Maildir'? Is that so it doesn't appear in the ls output by default? Some other reason perhaps?
I agree that having the sieve scripts in a different location than the mail content is less than ideal. When the sieve scripts were originally stored in the /var/vmail/%d/%n directory they showed up within Thunderbird as folders, so to get things working again quickly I made sure to move the sieve scripts completely outside of where the mail content was stored.
The cause was likely the 'mail_location' option being misconfigured (assuming that it really is, I'm still trying to nail that down), so once that is resolved I'm planning on moving them back.
Thanks for the reply. I'm hoping rearranging the mail content will be just as easy to do.
On October 21, 2014 7:04:38 PM deoren Dovecot-mailing-list@whyaskwhy.org wrote:
On 10/21/2014 11:44 AM, Benny Pedersen wrote:
On October 21, 2014 6:18:07 PM deoren Dovecot-mailing-list@whyaskwhy.org wrote:
mail_location = maildir:/var/vmail/%d/%n/Maildir sieve_dir = /var/vmail/sieve/%d/%n/sieve_dir
mail_location = maildir:/var/vmail/%d/%n/.maildir sieve_dir = /var/vmail/%d/%n/.sieve
More simple, and more easy to tarball backup
Thank you for the advice. Can you comment re these two approaches for configuring the 'mail_location' option? I assume the first is simply wrong?
mail_location = maildir:/var/vmail/%d/%n mail_location = maildir:/var/vmail/%d/%n/.maildir
Also, why do you use the '.maildir' folder name instead of 'Maildir'? Is that so it doesn't appear in the ls output by default? Some other reason perhaps?
I agree that having the sieve scripts in a different location than the mail content is less than ideal. When the sieve scripts were originally stored in the /var/vmail/%d/%n directory they showed up within Thunderbird as folders, so to get things working again quickly I made sure to move the sieve scripts completely outside of where the mail content was stored.
The cause was likely the 'mail_location' option being misconfigured (assuming that it really is, I'm still trying to nail that down), so once that is resolved I'm planning on moving them back.
Thanks for the reply. I'm hoping rearranging the mail content will be just as easy to do.
I just remember to use $HOME or ~ fetched here from mysql or static args, thus all none existing temp dirs will not be a problem, and it fits with maildrop and procmail, still running dovecot 1.2.17 with gentoo
So $HOME/.maildir $HOME/.sieve
Yes it will hide dirs in ls, but you can list hidded dirs with a option
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1
On Tue, 21 Oct 2014, deoren wrote:
What is the correct way to configure the mail_location option for Mailidr format?
mail_location = maildir:<path>
I've long had it setup this way:
mail_location = maildir:/var/vmail/%d/%n
Is that correct?
any path is OK, as long:
- it identifies the mail storage uniquely for the user,
- does not store any other information in it.
Here is an example error message I ran into:
stat(/var/vmail/example.com/username/.dovecot.lda-dupes/tmp) failed: Not a directory
That's because you use $HOME == Maildir root.
Looking at some other guides/tutorials shows something more like:
mail_location = maildir:/var/vmail/%d/%n/Maildir
"Maildir" is the default name for "Maildir"-type mail storeage root. No more, no less. If Dovecot is automatically detecting the type of storage, it probes for this directory name in $HOME.
I assume the latter is how it's supposed to be done? If so, that would
No, you are not "supposed" to do so.
I did review the official docs here:
http://wiki2.dovecot.org/MailLocation/Maildir
but I didn't find where it explicitly warns against setting home == maildir root. It should probably be apparent, but it wasn't to me when I first
it applies to all mail storages.
Steffen Kaiser -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.11 (GNU/Linux)
iQEVAwUBVEdc13z1H7kL/d9rAQIoSAf/WwdI10EmJbVfDGz+UJgE44kmNjicpiVt DJlkQyYp66s955UmepLMXfvRSZ5KeCAVOXZs1Oe1LYTKqmjzIOyFGBjDcoYGfIIV 6nEABpWUGTHjEuCpGfY/IvFlFE1gYUojKC2zrTFk1P3brvZ3nIBMrZ6hEOjh3bQJ 3m0SsOuu+9ZYvSxNt2EaVa7EkbTZdmLRN1K21JUDDoTXJ+myMsT3z2gJF+Gnr6Cr IppGlYRmVfSQ9E3Kpq7RxoJ4O29uIJa+dWB2fJYsctGxFrR4q6v6yZ//UuZWSrDo 7sdZUaugq2Y7nlimZKhsqsa/ly6AFlSfpto/Cc7AG7JEqpIG2vJKLw== =lNuJ -----END PGP SIGNATURE-----
On 10/22/2014 2:29 AM, Steffen Kaiser wrote:
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1
On Tue, 21 Oct 2014, deoren wrote:
What is the correct way to configure the mail_location option for Mailidr format?
mail_location = maildir:<path>
I've long had it setup this way:
mail_location = maildir:/var/vmail/%d/%n
Is that correct?
any path is OK, as long:
- it identifies the mail storage uniquely for the user,
- does not store any other information in it.
Here is an example error message I ran into:
stat(/var/vmail/example.com/username/.dovecot.lda-dupes/tmp) failed: Not a directory
That's because you use $HOME == Maildir root.
Looking at some other guides/tutorials shows something more like:
mail_location = maildir:/var/vmail/%d/%n/Maildir
"Maildir" is the default name for "Maildir"-type mail storeage root. No more, no less. If Dovecot is automatically detecting the type of storage, it probes for this directory name in $HOME.
I assume the latter is how it's supposed to be done? If so, that would
No, you are not "supposed" to do so.
I did review the official docs here:
http://wiki2.dovecot.org/MailLocation/Maildir
but I didn't find where it explicitly warns against setting home == maildir root. It should probably be apparent, but it wasn't to me when I first
it applies to all mail storages.
- -- Steffen Kaiser
Thanks for the reply and for answering my questions.
Just to make sure I understand properly, I have a few additional questions that I am hoping will cement really drive the point home so to speak. Regarding the guide that I followed, it suggests the following userdb and mail_location configuration:
userdb { driver = static args = uid=vmail gid=vmail home=/var/mail/vhosts/%d/%n }
mail_location = maildir:/var/mail/vhosts/%d/%n
This results in the $HOME == Maildir root situation which you mentioned shouldn't be done, correct? Instead mail_location should point to some other directory, perhaps one of:
- mail_location = /var/mail/vhosts/%d/%n/Maildir
- mail_location = ~/Maildir
If I understand properly the mail_location doesn't have to be a subdirectory within the home directory, it just typically is in common examples? If so, that guide should probably be updated to use one of the above mail_location settings. If you will confirm that is the case I'll submit a GitHub pull request as previously mentioned so it can be corrected.
Apologies if this is rehashing what you've already said, I'm just looking to make sure I understand this 100%.
So for cases where I have made the mistake like I mentioned above, how would I (properly) fix the problem?
After stopping Dovecot, I ended up doing this:
#1) service dovecot stop #2) cd /var/vmail/example.com/username/ #3) mkdir Maildir #4) mv -i * Maildir/ #5) mv -i .* Maildir/ #6) chown -R vmail:vmail /var/vmail/example.com/username/ #7) service dovecot start
which moved the content into the Maildir subfolder and fixed permissions back to what is specified in the conf files. I also adjusted mail_location like so:
mail_location = maildir:~/Maildir
and I made sure that the home setting is configured as /var/vmail/%d/%n
That seems to work fine, but I still got error messages like this when using doveadm search
"Error: Syncing mailbox dovecot.lda-dupes failed: Internal error occurred."
In my testing I found that I could move the file from this location:
/var/vmail/example.com/username/Maildir/.dovecot.ldap-dupes
to this one:
/var/vmail/example.com/username/.dovecot.ldap-dupes
choosing to overwrite the file if it should be there and the error message would not be generated anymore. This suggests that I shouldn't have moved it in the first place.
Looking through the mailing list archives I found a message thread titled "Lifetime of redirect info stored by Sieve in .dovecot.lda-dupes" which indicates that the Message-ID and recipient of forwarded messages are stored in .dovecot.ldap-dupes files. I do forward mail daily from the two accounts where doveadm search generates the errors, so it sounds like I would probably be OK to just nuke the file in this location:
/var/vmail/example.com/username/Maildir/.dovecot.ldap-dupes
and let it be auto-generated in the proper location the next time mail is forwarded. Can you confirm whether that is the case?
I appreciate your help.
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1
On Wed, 22 Oct 2014, deoren wrote:
On 10/22/2014 2:29 AM, Steffen Kaiser wrote:
On Tue, 21 Oct 2014, deoren wrote:
What is the correct way to configure the mail_location option for Mailidr format?
mail_location = maildir:<path>
I've long had it setup this way:
mail_location = maildir:/var/vmail/%d/%n
Is that correct?
any path is OK, as long:
- it identifies the mail storage uniquely for the user,
- does not store any other information in it.
Here is an example error message I ran into:
stat(/var/vmail/example.com/username/.dovecot.lda-dupes/tmp) failed: Not a directory
That's because you use $HOME == Maildir root.
Looking at some other guides/tutorials shows something more like:
mail_location = maildir:/var/vmail/%d/%n/Maildir
"Maildir" is the default name for "Maildir"-type mail storeage root. No more, no less. If Dovecot is automatically detecting the type of storage, it probes for this directory name in $HOME.
I assume the latter is how it's supposed to be done? If so, that would
No, you are not "supposed" to do so.
I did review the official docs here:
http://wiki2.dovecot.org/MailLocation/Maildir
but I didn't find where it explicitly warns against setting home == maildir root. It should probably be apparent, but it wasn't to me when I first
it applies to all mail storages. Thanks for the reply and for answering my questions.
Just to make sure I understand properly, I have a few additional questions that I am hoping will cement really drive the point home so to speak. Regarding the guide that I followed, it suggests the following userdb and mail_location configuration:
userdb { driver = static args = uid=vmail gid=vmail home=/var/mail/vhosts/%d/%n }
mail_location = maildir:/var/mail/vhosts/%d/%n
This results in the $HOME == Maildir root situation which you mentioned shouldn't be done, correct? Instead mail_location should point to some other directory,
Yes!
perhaps one of:
- mail_location = /var/mail/vhosts/%d/%n/Maildir
- mail_location = ~/Maildir
for instance, yes.
If I understand properly the mail_location doesn't have to be a subdirectory within the home directory, it just typically is in common examples? If so,
Yes again. And "Maildir" is just common and the default, but you could name the last path component anyway you like, even "mbox", "sdbox", or "mdbox", but such name probably would confuse any admin, that take the server over, because the dir name does imply something different than Maildir.
that guide should probably be updated to use one of the above mail_location settings. If you will confirm that is the case I'll submit a GitHub pull request as previously mentioned so it can be corrected.
Apologies if this is rehashing what you've already said, I'm just looking to make sure I understand this 100%.
So for cases where I have made the mistake like I mentioned above, how would I (properly) fix the problem?
After stopping Dovecot, I ended up doing this:
#1) service dovecot stop #2) cd /var/vmail/example.com/username/ #3) mkdir Maildir #4) mv -i * Maildir/ #5) mv -i .* Maildir/ #6) chown -R vmail:vmail /var/vmail/example.com/username/ #7) service dovecot start
#5 will match "..", too. Better: mv -i * .??* Maildir
That will move the Sieve and LDA files, too, as you found out yourself, so:
mkdir Maildir ; mv -i * .??* Maildir && for file in Maildir/.dovecot.*; do test -f "$file" && mv "$file" . done; mv Maildir/sieve_dir .
The 1st "mv" moves all files into Maildir, the for loop is to move the sieve files back, and the 3rd mv moves the sieve folder back - you have to adjust your name there.
which moved the content into the Maildir subfolder and fixed permissions back to what is specified in the conf files. I also adjusted mail_location like so:
mail_location = maildir:~/Maildir
and I made sure that the home setting is configured as /var/vmail/%d/%n
That seems to work fine, but I still got error messages like this when using doveadm search
"Error: Syncing mailbox dovecot.lda-dupes failed: Internal error occurred."
In my testing I found that I could move the file from this location:
/var/vmail/example.com/username/Maildir/.dovecot.ldap-dupes
to this one:
/var/vmail/example.com/username/.dovecot.ldap-dupes
choosing to overwrite the file if it should be there and the error message would not be generated anymore. This suggests that I shouldn't have moved it in the first place.
Looking through the mailing list archives I found a message thread titled "Lifetime of redirect info stored by Sieve in .dovecot.lda-dupes" which indicates that the Message-ID and recipient of forwarded messages are stored in .dovecot.ldap-dupes files. I do forward mail daily from the two accounts where doveadm search generates the errors, so it sounds like I would probably be OK to just nuke the file in this location:
/var/vmail/example.com/username/Maildir/.dovecot.ldap-dupes
and let it be auto-generated in the proper location the next time mail is forwarded. Can you confirm whether that is the case?
.dovecot.lda-dupes is not essential, but you might get (seldomly) some dupes or some users might get duplicate vacation responses from Sieve.
Steffen Kaiser -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.11 (GNU/Linux)
iQEVAwUBVEi+3Xz1H7kL/d9rAQL4+ggAmElvOUFvfcYJOjxByQBA6JDYrSU7uk/1 C21L6QyOl+gS8HGXKQBAEKNywe5/a8QyWYa9z46n/mVGxwU/BgEntqiawyrsYT1q /Rjz+9AjNVYNhmRlegb/dXemMinN0+GHRINYWJSz7Uu9CRvGrstQLD7zMl3BA2+A faLDoCnDKc2gDr+qLcgrfCjSDgl2btMho5ApBc4ecFpBnEMIIGA/n7M7xGBaDJqT 65GLUoXAoW5DmriW/w4g3wCaUyAdvYO8+EfYSx5mwIxYSxhzDBb0kbRLEHGdRDOR q4xEZMMDc42PW1xHSCKuzNkZeQf6G1mRFzVL+no3pvSev6gmLWCl9g== =TvfG -----END PGP SIGNATURE-----
participants (3)
-
Benny Pedersen
-
deoren
-
Steffen Kaiser