3

I'm trying to set up postfix+dovecot on my personal server (Ubuntu 14.0.4 LTS) for sending me some notifications from cronjobs. My /home/%user% directory is encrypted, so it's inaccessible to anything if I'm not logged in (and if the software does not support PAM sessions).

My problem is that for whatever reason my dovecot installation always tries to mount my /home/%user% on POP3 login, silently fails to do so and just returns no mail. In /var/log/mail.err I get series of

May 29 17:32:17 vps dovecot: pop3(u): Error: user u: Initialization failed: Namespace '': Can't create mailbox root dir /home/u/mail: Mountpoint /home/u isn't mounted. Mount it or remove it with doveadm mount remove
May 29 17:32:17 vps dovecot: pop3(u): Error: Invalid user settings. Refer to server log for more information.

In the meantime, doveadm mount list does not show any mountpoints.

My mail is stored by Postfix in /var/mail/%user% and I've configured dovecot to use the same directory to the best of my knowledge.

Any ideas?

1
  • I have in the meantime given up and just set up a service Google account that I can use for SMTP. Not a piece of cake either, but turned out to be easier. May 30, 2016 at 14:55

1 Answer 1

3
+50

I do not have your environment, but I quote from the Dovecot - Community Help Wiki (the part in bold is that way in the original text) :

NOTE: Dovecot will NOT work in an encrypted directory/folder. Dovecot would just complain about permissions and won't work. One answer is to create a 2nd user account that has an unencrypted home directory. We have not tested this solution on a separate home partition, but most probably the outcome would be the same.

Officially, the above workaround using another user account is the only solution.

You might also modify the source-code of Dovecot itself so as not to mount the home directory at all, as described in the thread of dovecot mounts user home dir. However, the problem might even not be with Dovecot at all, as says this answer :

The problem is that pam_ecryptfs captures and uses your login passphrase to decrypt ~/.ecryptfs/wrapped-passphrase, and perform your home directory mount.

Unfortunately the non-interactive dovecot pam session that you describe doesn't ever actually snag your login passphrase, so it cannot perform the mount. Sorry.

The workaround of using another unencrypted user account seems to be the most promising direction.

2
  • Unfortunately makes sense. I believe I have seen the first quote from documentation, but thought it will apply only if the mbox was located inside homedir. Now I understand the issue lies deeper in Dovecot code. I'll try to research other solutions then. Jul 4, 2016 at 8:32
  • Also I was once able to make it work. I believe that if my home dir is mounted (so, if I'm logged in) at the dovecot's startup AND there is some mail coming while I'm still logged in, then it will continue working even if I close the session. However, this is of course neither reliable nor scalable in long run. Jul 4, 2016 at 8:36

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .