Dovecot modseq_hdr.log_offset too large (Plesk)

Another quick fix post!

Problem

A mailbox for a specific user was not receiving mail on a postfix & dovecot on a Plesk server which I managed. The following error messages were being shown in the mail log:

$ tail -f /var/log/maillog
Apr 25 15:04:34 server01 dovecot: service=imap, [email protected],
ip=[192.168.0.1]. Error:
/var/qmail/mailnames/exampledomain.com/dan/Maildir/dovecot.index:
modseq_hdr.log_offset too large

As you can see the the error is: “modseq_hdr.log_offset too large”.

I’m not sure what caused this (I think it’s related to the dovecot.index file becoming corrupted – but not 100% sure), but this quick solution fixed it.

Solution

To fix this, delete all dovecot files (config and index files) from the specific users mail directory:

$ find /var/qmail/mailnames/example.com/dan/Maildir -name "dovecot*" -delete

Restart Postfix & Dovecot (to rebuild the dovecot files):

$ service dovecot restart
$ service postfix restart

Warning: This fix removes the dovecot configuration and index files for that specific user. Make sure you back them up before running the above command! You may wish to restore them at a later date.

By magic the mailbox began to receive email!

6 Comments

  1. Alex Hull says:

    Dear Daniel, can you please elaborate on how to back up the dovecot configuration and index files and reinstate them , I am also having this exact problem with one mailbox on a company mail server, all the others work fine and your post seems all I can find about this issue

    1. Alex,

      As you would be removing the dovecot config and index files. You would need to create a copy of them. For example:
      cp /var/qmail/mailnames/example.com/dan/Maildir /backup/dovecot_backups/example.com/dan

      In the event that removing the dovecot config and index doesn’t fix your issue, you may wish to restore the files back by moving them back into the /var/qmail/mailnames/example.com/dan/Maildir directory from your backups and restarting dovecot and postfix.

      I’d strongly recommend backing up the entire mail server anyway just incase you mistype the command or some other rare event takes place – this is good practice. However as you are only removing the config and index files for that one user (which dovecot will automatically rebuild when it starts) I suspect no issues should occur.

      I hope you manage to resolve your issue.
      Dan

  2. Alex Hull says:

    Thank you, worked fine , initially client said he lost 4 months mails, after deleting Imap account on Outlook and re-creating account, all his mail are now back and I don’t see errors in the mail log anymore

    1. Excellent news!

  3. James D says:

    Just trying this now Dan, hope it works!

    1. Hope it works!

Leave a Reply