maildrop: Unable to create a dot-lock at /var/spool/mail/…

The error message
maildrop: Unable to create a dot-lock at /var/spool/mail/12345.1.hostname.
can not be circumvented by manually using the flock statement in ~/. mailfilter. Maildrop always uses its default locking mechanism for the to statment and for implicit deliveries.

The correct solution might often be to correct permissions. But /var/spool/mail/ is a system directory where all users have their mailboxes but nobody is able to create lock files. Locking with flock however works, because it doesn't need write access to this directory.

The default lock mechanism is determined by configure before compiling. I did not find a way to change it afterwards. If configure decides it wants to lock files in /var/spool/mail/ using dotlock, there seems to be no way to change that.

The solution (or maybe only the workaround) is to pass the following configure options, as described in the INSTALL file in the tarball.

--with-locking-method=flock --enable-use-dotlock=0
INSTALL reads as if --with-locking-method should be enough, but it didn't work for me.


In Gentoo configure options can be passed using the environment variable EXTRA_ECONF.
# /etc/portage/package.env
mail-filter/maildrop maildrop-flock.conf
# maildrop-flock.conf
# maildrop: Unable to create a dot-lock at /var/spool/mail/…
EXTRA_ECONF="--with-locking-method=flock --enable-use-dotlock=0"

Licensed under the Creative Commons Attribution-Share Alike 3.0 License.
Created 2018-08