Score:1

Dovecot doveadm backup occassionally failing with error 65 - how to handle

ne flag

I'm trying to set up backups of dovecot emails between 2 servers. The command doing the heavy lifting is:

 doveadm -D backup -R -u [email protected] ssh MAINSERVER.IP doveadm dsync-server -u [email protected]

For most users it works fine, but for a couple of users I am getting an error 65 or error 75. (The script says remote command returned error 75..." but when I put this in a script the return code is 65.

The dovecot output for the failed account is as below:

Debug: Loading modules from directory: /usr/lib/dovecot/modules/doveadm
Debug: Skipping module doveadm_acl_plugin, because dlopen() failed: /usr/lib/dovecot/modules/doveadm/lib10_doveadm_acl_plugin.so: undefined symbol: acl_user_module (this is usually intentional, so just ignore this message)
Debug: Skipping module doveadm_expire_plugin, because dlopen() failed: /usr/lib/dovecot/modules/doveadm/lib10_doveadm_expire_plugin.so: undefined symbol: expire_set_deinit (this is usually intentional, so just ignore this message)
Debug: Skipping module doveadm_quota_plugin, because dlopen() failed: /usr/lib/dovecot/modules/doveadm/lib10_doveadm_quota_plugin.so: undefined symbol: quota_user_module (this is usually intentional, so just ignore this message)
Debug: Module loaded: /usr/lib/dovecot/modules/doveadm/lib10_doveadm_sieve_plugin.so
Debug: Skipping module doveadm_fts_plugin, because dlopen() failed: /usr/lib/dovecot/modules/doveadm/lib20_doveadm_fts_plugin.so: undefined symbol: fts_user_get_language_list (this is usually intentional, so just ignore this message)
Debug: Skipping module doveadm_mail_crypt_plugin, because dlopen() failed: /usr/lib/dovecot/modules/doveadm/libdoveadm_mail_crypt_plugin.so: undefined symbol: mail_crypt_box_get_pvt_digests (this is usually intentional, so just ignore this message)
doveadm([email protected]): Debug: Effective uid=999, gid=999, home=/data/mail/[email protected]
doveadm([email protected]): Debug: maildir++: root=/data/mail/[email protected]/Maildir, index=, indexpvt=, control=, inbox=/data/mail/[email protected]/Maildir, alt=
doveadm([email protected]): Debug: Namespace : Using permissions from /data/mail/[email protected]/Maildir: mode=0700 gid=default
dsync-local([email protected]): Debug: brain M: Local mailbox tree: INBOX guid=58eedf276bc33864df08000079bc729c uid_validity=1681441643 uid_next=2 subs=no last_change=0 last_subs=0
dsync-local([email protected]): Debug: brain M: Remote mailbox tree: INBOX guid=58eedf276bc33864df08000079bc729c uid_validity=1396487587 uid_next=60912 subs=no last_change=0 last_subs=0
dsync-local([email protected]): Debug: brain M: Remote mailbox tree: Deleted Messages guid=c803c2075f1e625874120000b8a5d860 uid_validity=1396487588 uid_next=36883 subs=yes last_change=0 last_subs=1482825311
dsync-local([email protected]): Debug: brain M: Remote mailbox tree: Sent Messages guid=55567b0e54b57d58770d0000b8a5d860 uid_validity=1396487589 uid_next=345 subs=yes last_change=0 last_subs=1484633428
dsync-local([email protected]): Debug: brain M: Remote mailbox tree: Drafts guid=8e1b6a01ab197e602d700000b8a5d860 uid_validity=1396487591 uid_next=1 subs=yes last_change=0 last_subs=1618876837
dsync-local([email protected]): Debug: brain M: Remote mailbox tree: Notes guid=da8ed0191098355c672d0000b8a5d860 uid_validity=1396487590 uid_next=1 subs=yes last_change=0 last_subs=1547016208
dsync-local([email protected]): Debug: brain M: Mailbox Deleted Messages: local=00000000000000000000000000000000/0/0, remote=c803c2075f1e625874120000b8a5d860/0/1: mailbox not selectable yet
dsync-local([email protected]): Debug: brain M: Mailbox Drafts: local=00000000000000000000000000000000/0/0, remote=8e1b6a01ab197e602d700000b8a5d860/0/1: mailbox not selectable yet
dsync-local([email protected]): Debug: brain M: Mailbox INBOX: local=58eedf276bc33864df08000079bc729c/0/1, remote=58eedf276bc33864df08000079bc729c/0/1: Mailboxes are equal
dsync-local([email protected]): Debug: brain M: Mailbox Notes: local=00000000000000000000000000000000/0/0, remote=da8ed0191098355c672d0000b8a5d860/0/1: mailbox not selectable yet
dsync-local([email protected]): Debug: brain M: Mailbox Sent Messages: local=00000000000000000000000000000000/0/0, remote=55567b0e54b57d58770d0000b8a5d860/0/1: mailbox not selectable yet
dsync-local([email protected]): Debug: brain M: Deleting mailbox 'INBOX' (GUID 58eedf276bc33864df08000079bc729c): UIDVALIDITY changed (1396487587 -> 1681441643)
dsync-local([email protected]): Debug: doveadm-sieve: Iterating Sieve mailbox attributes
dsync-local([email protected]): Debug: sieve: Pigeonhole version 0.4.21 (92477967) initializing
dsync-local([email protected]): Debug: sieve: include: sieve_global is not set; it is currently not possible to include `:global' scripts.
dsync-local([email protected]): Debug: sieve: file storage: Using active Sieve script path: /data/mail/[email protected]/.dovecot.sieve
dsync-local([email protected]): Debug: sieve: file storage: Using script storage path: /data/mail/[email protected]/sieve
dsync-local([email protected]): Debug: sieve: file storage: Using permissions from /data/mail/[email protected]/sieve: mode=0700 gid=-1
dsync-local([email protected]): Debug: sieve: file storage: Relative path to sieve storage in active link: sieve/
dsync-local([email protected]): Debug: sieve: file storage: sync: Synchronization active
dsync-local([email protected]): Error: Mailbox INBOX sync: mailbox_delete failed: INBOX can't be deleted.
dsync-local([email protected]): Error: Remote command returned error 75: ssh 60.234.77.233 doveadm dsync-server -u [email protected] dsync-server

Despite the "Remote command returned error 75" I know that if I delete the mailbox on the local server and reissue the command it will resync - but this means deleting the clients mailbox on the local server which I'd rather not do, as they can get quite large and bandwidth between the sites is at a bit of a premium.

I also believe that if I do a sync rather then a backup (which I'd prefer not to do, because I'm new to doveadm and I don't want to put the original in jeopardy) there is no error.

I believe the problem likely relates to the fact that the 2 initial lines about INBOX - but I don't understand how its occurred (I've only done syncs of the mailbox - possibly interrupting them, but nothing else), and that is also a bit worrying.

I am using MAILDIR format and I suspect that part of the issue relates to MAILDIR and not being able to delete the INBOX, but I don't understand why it is trying to delete the inbox, and I don't even know what it means by the INBOX as as there is no folder that I can find called "/INBOX" or "/.INBOX" or similar on the server or backup. "Maildir/cur" and "Maildir/new" both exist (and are empty on the client). Maildir/new has emails in it on the server but is empty on the client.

I initially tried this with my server on Ubuntu 18.04, Dovecot 1:2.2.33.2-1ubuntu4.8 I then upgraded ONLY the backup box I'm pulling from to run Ubuntu 20.04 with Dovecot 2.3.7.2 - same problem.

Is this a known bug in Dovecot? Is here a way I can solve this short of deleting mail boxes?

UPDATES

doveconf mail_location is set to mail_location = maildir:/data/mail/%u/Maildir (Which looks like what I would expect). I could not find any config information with the word "namespace"

When I do

 doveadm mailbox status -u [email protected] all INBOX 

I get different results on the client and server. On the mail server I get

 INBOX messages=524 recent=0 uidnext=60920 uidvalidity=1396487587 unseen=2 highestmodseq=59948 vsize=77692641 guid=58eedf276bc33864df08000079bc729c firstsaved=1680336216

On the backup I get

  INBOX messages=0 recent=0 uidnext=2 uidvalidity=1681441643 unseen=0 highestmodseq=3 vsize=0 guid=58eedf276bc33864df08000079bc729c firstsaved=18446744073709551615

In each of the offending mail directories, "MAILDIR/cur -s empty on the backup version, while there is data in the version on the server.

When I tried to copy the "cur" mailbox from the mailserver to the backup and then run "doveadm mailbox status -u [email protected] all INBOX" the number of messages returned to 524, but as soon as I tryed to backup the box the error reappeared and there were 0 messages in the INBOX on the backup server.

Playing around with the command "doveadm force-resync -u [email protected] INBOX" on the mail server and backup (after repopulating Maildir/cur on the backup via scp) did not help.

anx avatar
fr flag
anx
There are a few *interesting* ways to configure Dovecot IMAP namespaces to work around clients being a bit funny about the folder structure. I wonder if the layout (sans subdirectory) of your destination has an impact on your ability to deal with a recreated main inbox.. try dumping with `doveconf` - interesting bits should be in mail_location and namespace{} blocks - and `doveadm mailbox status`.
ne flag
@anx Thank you for this. It has not solved my problem but was incredibly useful. I've updated my post post with where I am up to now thanks to your insight.
I sit in a Tesla and translated this thread with Ai:

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.