Restore-domain splitting email into mail and Maildir folders

I am migrating from CentOS 5/Virtualmin Pro 3.97 to CentOS 6/Virtualmin Pro 3.98.

"virtualmin restore-domain" correctly restores the domains, except the email is split into two directories on the restore (the old server where the backup was made has only Maildir):

  1. "Maildir" which has the INBOX, has the full inbox contents, but all other folders are empty.

  2. "mail" which appears to have the other folders in mbox format (sent, spam and drafts show up here, instead of in the Maildir folder). These are not accessible by POP3/IMAP.

Virtualmin backup/restore was used to transfer all the virtualmin configuration settings, prior to virtual server creation.

I am looking for some setting to tell restore-domain to put ALL the mail in the Maildir folder, rather than splitting it. (Right now, I manually tar the Maildir files on the old server, copy them across, and untar them on the new server, and delete the 'mail' directory.) I have been through all the module configs and settings for dovecot, postfix and procmail, and cannot find anything that fixes this.

Any server created from scratch just has the Maildir directory; 'mail' only shows up from restore-domain.

Thanks for any assistance.

Status: 
Closed (fixed)

Comments

Hmm, that's odd! It should use Maildir by default. This may require some assistance from Jamie, but one thing we can verify in the meantime... what is the output of this command:

grep ^mail_location /etc/dovecot/dovecot.conf

Also, can you paste in the contents of your /etc/procmailrc?

I'm curious if the restore is using a setting from one of those.

This could happen if Webmin is incorrectly configured on your system to look for user mail folders under ~/mail instead of ~/Maildir.

To check for and fix this, edit the file /etc/webmin/mailboxes/config and make sure the mail_usermin= line reads mail_usermin=Maildir

bperet's picture
Submitted by bperet on Sun, 01/27/2013 - 09:46

grep ^mail_location /etc/dovecot/dovecot.conf yields:

mail_location = maildir:~/Maildir

Also, can you paste in the contents of your /etc/procmailrc?

LOGFILE=/var/log/procmail.log
TRAP=/etc/webmin/virtual-server/procmail-logger.pl
:0wi
VIRTUALMIN=|/etc/webmin/virtual-server/lookup-domain.pl $LOGNAME
EXITCODE=$?
:0
* ?/usr/bin/test "$EXITCODE" = "73"
/dev/null
EXITCODE=0
:0
* ?/usr/bin/test "$VIRTUALMIN" != ""
{
INCLUDERC=/etc/webmin/virtual-server/procmail/$VIRTUALMIN
}
ORGMAIL=$HOME/Maildir/
DEFAULT=$HOME/Maildir/
DROPPRIVS=yes
:0
* ^X-Spam-Status: Yes
$DEFAULT

To check for and fix this, edit the file /etc/webmin/mailboxes/config and make sure the mail_usermin= line reads mail_usermin=Maildir

grep mail_usermin /etc/webmin/mailboxes/config
mail_usermin=Maildir

This is the directory structure being restored by domain-restore:

mail:
total 78972
    4 .    2244 drafts      0 sent   3848 spam      0 trash
    4 ..     32 Drafts  72696 Sent      0 Spam    144 Trash

Maildir:
total 172
4 .                     4 dovecot.index.log     4 new     4 subscriptions
4 ..                   40 dovecot.index.log.2   4 .sent   4 tmp
4 cur                   4 dovecot-uidlist       4 .Sent   4 .trash
4 dovecot.index         4 .drafts               4 .spam   4 .Trash
64 dovecot.index.cache   4 .Drafts               4 .Spam

The email folders show up in Maildir as hidden directories, but are empty. The contents are in files in "mail" directory.

This is the structure on the old server, where domain-backup was run:

Maildir:
total 388
  8 .      8 dovecot.index        140 dovecot.index.log.2    8 .Drafts    8 .Sent    8 subscriptions
  8 ..    76 dovecot.index.cache    8 dovecot-uidlist        8 new        8 .spam    8 tmp
12 cur   48 dovecot.index.log      8 .drafts                8 .sent      8 .Spam    8 .Trash

It is not a single site, it occurred on every virtual server I restored (about 20). We have been using Virtualmin Pro for quite some time, about 6 years, so it has gone through a lot of updates on the old server. I am using the virtualmin command line per the Virtualmin Migration instructions page.

Was that line from /etc/webmin/mailboxes/config on the source system or the destination?

It is the destination system that matters ..

bperet's picture
Submitted by bperet on Mon, 01/28/2013 - 12:09

Was that line from /etc/webmin/mailboxes/config on the source system or the destination?

Source system:

cat config
show_mail=0
show_body=0
check_mod=1
mail_usermin=Maildir
maildir_deleted=0
sync_create=0
mail_system=0
date_fmt=dmy
delete_warn=y
mail_file=Mailbox
noindex_hostname=0
mail_dir=Maildir
show_to=0
html_edit=0
mailbox_user=.usermin/mailbox
mail_style=0
show_sent=0
top_buttons=2
spam_del=0
show_size=1
column_count=4
track_read=0
link_mode=0
size_mode=1
show_size_below=0
sig_file=*
vpopmail_dir=/home/vpopmail
no_crlf=0
perpage=20
view_html=0
fwd_mode=0
sync_modify=1
spam_report=
log_read=0
ignore_users_enabled=0
wrap_width=80
sort_mode=1
sync_perms=0700
spam_buttons=mail
ignore_users=
show_delall=0
sync_delete=1
no_mailer=0
from_virtualmin=1
show_count=0
max_records=200
auto=1
html_quote=0
open_mode=0
arrows=1
no_orig_ip=0
show_unread=0

Destination system:

cat config
show_mail=0
show_body=0
check_mod=1
mail_usermin=Maildir
maildir_deleted=0
sync_create=0
mail_system=0
date_fmt=dmy
delete_warn=y
mail_file=
noindex_hostname=0
mail_dir=Maildir
show_to=0
html_edit=0
mailbox_user=.usermin/mailbox
mail_style=0
show_sent=0
top_buttons=2
spam_del=0
show_size=1
column_count=4
track_read=0
link_mode=0
size_mode=1
show_size_below=0
sig_file=*
vpopmail_dir=/home/vpopmail
no_crlf=0
perpage=20
view_html=0
fwd_mode=0
sync_modify=1
spam_report=
log_read=0
ignore_users_enabled=0
wrap_width=80
sort_mode=1
sync_perms=0700
spam_buttons=mail
ignore_users=
show_delall=0
sync_delete=1
no_mailer=0
from_virtualmin=1
show_count=0
max_records=200
auto=1
html_quote=0
open_mode=0
arrows=1
no_orig_ip=0
show_unread=0
smtp_pass=
send_mode=
mail_sub=Maildir
smtp_user=
smtp_auth=

I upgraded Virtualmin Pro and Webmin to the latest versions on the old server this weekend, took a new backup and restored... same thing happened. Non-inbox folders went into 'mail', not Maildir.

Is there any chance we could login to your system and try a test restore to see what is going on inside Virtualmin?

Contact me at jcameron@virtualmin.com if that is possible..

bperet's picture
Submitted by bperet on Tue, 01/29/2013 - 16:48

The problem went away with the Webmin 1.610 update that I received today.

(The 'mail' directory still shows up, but is empty and all the email folders are correctly restored into the Maildir directory.)