Dovecot IMAP errors: "chdir(/var/mail/$user/) failed: Not a directory", "Root directory is a file: /var/mail/$user"

My YunoHost server

Hardware: eeePC 1005HA
YunoHost version: 11.2.3
I have access to my server :
:white_check_mark: Through SSH
:white_check_mark: Through the webadmin
:white_check_mark: Direct access via keyboard / screen
Are you in a special context or did you perform some particular tweaking on your YunoHost instance ? : no

Description of my issue

Hello all! Email is (sort of) working on my Yunohost installation. I am using a Yunohost-provided domain, and Gmail as an SMTP relay (as otherwise my ISP blocks it). However, there are persistent errors in the logs, for example in /var/log/mail.err:

Aug  7 22:29:52 $user dovecot: lda($user@$user.noho.st)<278702><BQl2GaCo0WSuQAQA59mD7A>: Error: sieve: msgid=<20230803231607.33A4ED0081E@$user.noho.st>: failed to store into mailbox 'INBOX': Internal error occurred. Refer to server log for more information. [2023-08-07 22:29:52]
Aug  7 22:29:52 $user dovecot: lda($user@$user.noho.st)<278702><BQl2GaCo0WSuQAQA59mD7A>: Error: sieve: Execution of script /etc/dovecot/global_script/rspamd.sieve was aborted due to temporary failure
Aug  7 22:34:52 $user dovecot: lda($user@$user.noho.st)<278800><Qsk5M8yp0WQQQQQA59mD7A>: Error: chdir(/var/mail/$user) failed: Not a directory
Aug  7 22:34:52 $user dovecot: lda($user@$user.noho.st)<278800><Qsk5M8yp0WQQQQQA59mD7A>: Error: stat(/var/mail/$user/tmp) failed: Not a directory

And in journalctl:

Aug 07 17:35:37 dovecot[260525]: imap($user)<268335><jlD6BlwCcLf+gAAAAAAAAEpbOf/+FZWY>: Error: Root directory is a file: /var/mail/$user

Based on this Serverfault question I think it may have something to do with dovecot mail location settings, and maybe Maildir vs. mbox format.

Does anyone know how to fix this? Or at least what would help further diagnose the problem?

P. S. Full logs if it will help:
Postfix logs
Dovecot logs

Hmmmokay can we check what ls -l /var/mail/pang returns ? (And can you confirm that it’s an username on your server, registered as a YunoHost user ?)

Thanks! It returns:

-rw-rw---- 1 pang mail 0 May 7 2022 /var/mail/pang

pang is my account, the main one.

Hmyeah so indeed this is a file and not a folder … not sure how this can even happen … But anyway it’s empty (size=0) so we can safely delete it with : rm /var/mail/pang

Thank you so much, that seems to have fixed things! It is now working fine.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.