How to change default location of mailboxes in Plesk for Linux

Follow

Comments

38 comments

  • Avatar
    Stuart Mayne (Edited )

    Following the above guide, I was left unable to log into the mailboxes (even using webmail). So I reverted back to the original dovecot and postfix configurations, and re-run the mchk utility - and access was returned. Have I missed something?

    Furthermore - one of your collegues recently posted a warning that the "mchk" command is not advised, and that instead admins should instead, be using "plesk repair mail" ...which is the better advice?

    https://talk.plesk.com/threads/all-mail-passwords-are-gone-after-mchk.346354/#post-840746

    0
    Comment actions Permalink
  • Avatar
    Nikolay Zhmuk

    @Stuart Mayne hi, I checked the solution described in the article step by step and it works as expected. Have you run mchk utility as it is suggested on the step 8?

    Regarding question about 'plesk repair mail' utility, such tool extends the functionality of mchk. It runs mchk tool along with the other repair actions, that is why it was recommended to use. Note that I have updated the article and replaced mchk with plesk repair mail.

    0
    Comment actions Permalink
  • Avatar
    Emilio Ortiz

    Very weird error the creating email after migrate folder if path contains uppercase.

    "unable to change to mbox folder /media/2tb/mailnames/"

    "Fatal error: plesk::mail::FSError(unable to remove quota: Success: "/media/2TB/mailnames/"

    I've solved it creating a symlink from "2tb" to "2TB". I think could be a bug. 

    I've checked twice misspelling on both files.

    PS: Also step 9 is not needed en Ubuntu. 

     

    0
    Comment actions Permalink
  • Avatar
    Robert Asilbekov

    @Emilio Ortiz Could you please provide the following:

    1. Plesk migrator version 
    2. Plesk version output
    3. Source platform you are migrating from
    4. Plesk technical report id: https://support.plesk.com/hc/en-us/articles/213374009
    0
    Comment actions Permalink
  • Avatar
    Emilio Ortiz

    I'm not migrating platform. I'm only changing the path of the mail folder to a bigger one.

    • Product version: Plesk Onyx 17.5.3 Update #39
    • Update date: 2018/01/31 14:37
    • Build date: 2017/03/17 16:00
    • OS version: Ubuntu 16.04
    • Revision: 55d1b49a272f44666e1920eca8b6e4da449a38cd
    • Architecture: 64-bit
    • Wrapper version: 1.2

    Plesk Migrator is not installed.

    Regards!

    0
    Comment actions Permalink
  • Avatar
    Ivan Postnikov

    @Emilio Ortiz

    Hello!
    The issue was not reproduced in the test environment with the same OS and Plesk version.

    Consider contacting Plesk Technical Support

    0
    Comment actions Permalink
  • Avatar
    Unknown User

    Hi,

    After moving the mailboxes path, does the backup consider the new path?

    0
    Comment actions Permalink
  • Avatar
    Ivan Postnikov

    @Daniele Vasalli

    Hello!

    The backup manager will use the new mailboxes path. It was checked on a test server.

    0
    Comment actions Permalink
  • Avatar
    Lenusch

    Hi, 

    thank you, 

    if i have a firewall who checks UDP/ TCP Ports IN/ OUT which Ports do i have to allow in Ordner to have everything working normal? 

     

    0
    Comment actions Permalink
  • 0
    Comment actions Permalink
  • Avatar
    Lenusch (Edited )

    Hi, is there no way, to make this changes permanent? 

    We lost this today, again. 

    EDIT: 

    Well i createt a File: /etc/dovecot/conf.d/custom.conf and this works perfectly. 

    Just enter all things from dovecot.conf which you want to change, and done. 

    Or do i miss somthing? This works great. And this would keep Changes on Update, right? So maybe you can adjust Article. 

    0
    Comment actions Permalink
  • Avatar
    Filipe

    After update the path in "/etc/dovecot/dovecot.conf" changed back to default causing Mailbox unavailability. It would be great if updates wouldn't interfere with this configuration. This could be a feature inside Plesk instead of manipulating configuration files that can be overwritten. Or even alert us before updates that can potentially break this configuration.

    Any improvement to this is welcomed.

    Thanks

    0
    Comment actions Permalink
  • Avatar
    Ivan Postnikov

    Hello @Lenor and @Filipe,

    Step 6 of the article was adjusted, now changes won't be reset after upgrades.

    Creating configuration in /etc/dovecot/conf.d/ allows to avoid this.

    0
    Comment actions Permalink
  • Avatar
    German A

    Hello every1, thanks for this extremly usefull and clear guide. My disk is full so I need to move all my mails to the brand new partition, permanently mounted on "/mnt/sdb/" using "ext4" as the primary one "/sda/sda1".

    I found a difference with in my installation on step 2, I got this:

    $features['SMTP_Server'] = "Postfix";
    $features['IMAP_POP3_Server'] = "Courier-IMAP";
    $features['SMTP_Server_package'] = "postfix";
    $features['IMAP_POP3_Server_package'] = "courier-imap";

    So, what do I have to change in place of your "dovecot" configurations in steps 6 and 7.

    Im using Plesk v12.0.18_build1200140606.15 os_CentOS 6 on CentOS 6.9 (Final).

    Thanks,
    German

    0
    Comment actions Permalink
  • Avatar
    Alisa Kasyanova

    @German A
    Thank you for the question. When Courier is used, there is no need to change anything on step 6. On step 7, restart all Courier services (courier-authdaemon, courier-imapd, courier-imaps, courier-pop3d and courier-pop3s)

    1
    Comment actions Permalink
  • Avatar
    German A (Edited )

    Thanks for your previous answer, now there is an error on step 8 when executing "plesk repair mail"

    [root@ /]# plesk repair mail
    PHP Notice: Undefined index: mail in /usr/sbin/plesk on line 57
    Usage: plesk [command]

    Commands:
    help - Show help and exit
    version - Show product version information
    db - Database related commands. Open MySQL console by default.
    bin - Run the specified Plesk command-line utility (e.g., domain, client)
    sbin - Run the specified Plesk internal utility
    php - Run a PHP script using the proper PHP interpreter
    conf - Open the specified Plesk configuration file in the editor
    log - Display the specified Plesk log file
    installer - Parallels Installer shortcuts and command completion.

    I hope this doesn't interrupt my service since is an enterprise solution for many clients. Thanks in advance for you kind help.

    ************UPDATE************

    There is an unedited line in "/etc/psa/psa.conf" that has this information:

    # Qmail directory
    QMAIL_ROOT_D /var/qmail

    This shouldn't be updated as well?, BTW I did and still not working.

    Should I use any of this utils instead?

    [root@ /]# /usr/local/psa/admin/bin/mailmng
    mailmng mailmng-core mailmng-imap mailmng-outgoing mailmng-service
    mailmng-black-white mailmng-domain mailmng-mailname mailmng-server mailmng-transport

     

    ***********LAST UPDATE************

    I sucessfully runned this command "/usr/local/psa/bootstrapper/pp12.0.18-bootstrapper/bootstrapper.sh repair" but I don't know if this is the substitute of "plesk repair mail".

    So I'll wait untill your reply. Thanks and sorry about this trouble.

    0
    Comment actions Permalink
  • Avatar
    German A

    Also, the next step 9, "chcon -R -t mail_spool_t /mnt/sdb/qmail/mailnames/" throw me thousands of errors like this:

    .....

    chcon: can't apply partial context to unlabeled file `new'
    chcon: can't apply partial context to unlabeled file `tmp'
    chcon: can't apply partial context to unlabeled file `cur'
    chcon: can't apply partial context to unlabeled file `new'
    chcon: can't apply partial context to unlabeled file `tmp'
    chcon: can't apply partial context to unlabeled file `.Spam'
    chcon: can't apply partial context to unlabeled file `Maildir'
    chcon: can't apply partial context to unlabeled file `@attachments'
    chcon: can't apply partial context to unlabeled file `.qmail'

    ....

    So I guess the previous command was necessary or there is also something else wrong. I hope you can help me and advise others like me. This is a brand new installation without any modification of the OVH VPS with the native Plesk installation.

    Thanks for reading and your kind help.

    0
    Comment actions Permalink
  • Avatar
    German A

    Finally I think there is another problem in step 10, since you never ask or guide to "cp" or migrate the "popuser" directory but you request to change it in "/etc/passwd", please clarify if you can.

    Thanks!

    1
    Comment actions Permalink
  • Avatar
    Dinara Tsydenova

    Hello @German A,

     

    >chcon: can't apply partial context to unlabeled file

    The 9 step is applied if Selinux is used, otherwise this step can be skipped.
    You can check Selinux status using the command below:
    -----------
    getenforce
    -----------

     

    --------------------------------------

    As for the following message:

    >plesk repair mail
    >PHP Notice: Undefined index: mail in /usr/sbin/plesk on line 57
    >Usage: plesk [command]

    "plesk repair mail" command was introduced in Plesk 12.5, as I can see your Plesk version is 12.0.

    Note that Plesk version 12.X has reached End of Life starting from 1.01.2019.
    End-of-Life means that the product will cease to receive further development and technical support requests will no longer be accepted https://www.plesk.com/support/plesk-lifecycle/
    It is strongly recommended to upgrade Plesk to the supported version.

     

    --------------------------------------

    >Finally I think there is another problem in step 10, since you never ask or guide to "cp" or migrate the "popuser" directory but you request to change it in "/etc/passwd", please clarify if you can.

    popuser is a specific user, which own all mailboxes in Plesk., since the mail home directory was changed, it is required to make the corresponding changes in "/etc/passwd".

     

    --------------------------------------

    >There is an unedited line in "/etc/psa/psa.conf" that has this information:
    ># Qmail directory
    >QMAIL_ROOT_D /var/qmail
    >This shouldn't be updated as well?, BTW I did and still not working.

    There is no need to edit this line in "/etc/psa/psa.conf", only PLESK_MAILNAMES_D should be edited.

    1
    Comment actions Permalink
  • Avatar
    German A

    Thanks for your complete and kind replies.

    As Plesk version 12.X has reached End of Life I understand that I can't get a support for that problem, BUT then I would just like to know if this missing step will affect the migration, since I need to finish this task.

    Thanks again and have a nice week.

    0
    Comment actions Permalink
  • Avatar
    BP

    What is missing in this instruction set is an update of the apparmor configuration?!

    0
    Comment actions Permalink
  • Avatar
    Dinara Tsydenova

    Hello @b_p,

    Firstly, please note that Plesk Onyx supports AppArmor on Ubuntu 16.04 only since Ubuntu 14.04 reached End-Of-Life https://www.plesk.com/lifecycle-policy/

     

    As for your question, check where the old directory is specified in AppArmor.

    For example, 

    -------------
    # grep -r "mailnames" /etc/apparmor.d/*
    /etc/apparmor.d/local/usr.lib.dovecot.pop3:/var/qmail/mailnames/** rwk,
    /etc/apparmor.d/local/usr.lib.dovecot.dovecot-lda:/var/qmail/mailnames/** rwkl,
    /etc/apparmor.d/local/usr.lib.dovecot.imap:/var/qmail/mailnames/** rwk,
    -------------

     

    Then, re-apply AppArmor policy and reset AppArmor cache:

    ------------------
    apparmor_parser -r -T -W <path-to-file>
    service apparmor recache
    ------------------

    0
    Comment actions Permalink
  • Avatar
    Tom Franssen

    Is it not possible to just move /var/qmail to another location, and then symlink to it? ln -s /path/to/new/location /var/qmail

    Regards,
    Tom

    0
    Comment actions Permalink
  • Avatar
    Alisa Kasyanova

    @Tom
    The symlink method is not the best option, because unpredictable errors may appear. It was not tested, so it is recommended to use the method described in the article.

    0
    Comment actions Permalink
  • Avatar
    Pedro Júlio Pereira

    Hi There,

    I have recently changed my mailnames folder location from /var/qmail/mailnames to /email_1/qmail/mailnames (separate drive) using this (very good) guide. All went well, despite I think the last step should read: popuser:x:30:31:POP3 service user:/<new_popuser_directory>/qmail/popuser:/sbin/nologin
    In my case I copied original /var/qmail/popuser to /email_1/qmail/popuser so I changed popuser on /etc/passwd to: popuser:x:30:31:POP3 service user:/email_1/qmail/popuser:/sbin/nologin
    However I still needed to create symlinks from /var/qmail/mailnames -> /email_1/qmail/mailnames and /var/qmail/popuser -> /email_1/qmail/popuser, because after the switch (to the new drive) I tried to install Kolab Premium Email extension which resulted in an error because mailnames folder wasn't where it should be (/var/qmail/mailnames). Only after creating the symlinks I could install Kolab Premium Email successfully.

    My question is: is there a conf file on Kolab I should edit too (pointing to mailnames location) or it's best to leave the symlinks (just in case)?

    Regards,

    Pedro Pereira

    0
    Comment actions Permalink
  • Avatar
    Alexey Lapshin

    Hello Pedro,

    It is good to hear that you resolved (worked around) the issue with Kolab installation on your own.
    I performed some tests to reproduce the mentioned behavior, however, the only condition, when Kolab fails to install, is renamed/removed original /var/qmail/ directory.
    To change the default location of mailboxes it is needed to copy the content from /var/qmail/mailnames, however, the directory /var/qmail/ itself should remain untouched.

    If you face with the issue further, for example for another sever, we would like to investigate this behavior, for that please submit a request here https://support.plesk.com/hc/en-us/requests/new 

    0
    Comment actions Permalink
  • Avatar
    Pedro Júlio Pereira

    Hi There,

    To be more specific I copied /var/qmail/mailnames -> /email_1/qmail/mailnames (another drive) and

    /var/qmail/popuser -> /email_1/qmail/popuser

    /var/qmail was not moved, only removed the two above folder (mailnames and popuser) to the new drive

    When trying to install Kolab it failed with (taken from Panel log):

    "[2019-09-02 05:11:32.242] ERR [panel] Error: Execution failed: mkdir: cannot create directory '/var/qmail/mailnames/.spamtrain': No such file or directory

    [2019-09-02 19:42:38.780] ERR [util_exec] proc_close() failed ['/usr/local/psa/admin/bin/filemng' 'root' 'cp' '-r' '/usr/local/psa/var/modules/kolab//dovecot-sieve/sa-learn-spam.sh' '/var/qmail/popuser/sa-learn-spam.sh' '--allow-root'] with exit code [1]
    [2019-09-02 19:42:38.803] ERR [1] '/usr/local/psa/admin/bin/filemng' 'root' 'cp' '-r' '/usr/local/psa/var/modules/kolab//dovecot-sieve/sa-learn-spam.sh' '/var/qmail/popuser/sa-learn-spam.sh' '--allow-root' failed with code 1.

    stdout:
    cp: cannot create regular file ‘/var/qmail/popuser/sa-learn-spam.sh’: No such file or directory
    filemng: Error occurred during /bin/cp command.

    stderr:
    filemng: Error occurred during /bin/cp command.

    [2019-09-02 19:42:38.828] ERR [panel] Task failed: id=1404, pid=28761, type=ext-kolab-task_install, error=filemng failed: filemng: Error occurred during /bin/cp command."

    So I created symbolic links between /var/qmail/mailnames -> /email_1/qmail/mailnames and

    /var/qmail/popuser -> /email_1/qmail/popuser

    and this time it worked. Kolab installed successfully.

    Two issues though: 1 - Folders inside the Inbox were moved to out of the Inbox, which resulted in Emails clients to redownload emails (very anoying specially with 1.15Tb of emails)
    2 - a new process beam.smp appeared using lots of CPU and Memory (don't know why). Sometimes I have to kill it manually so that it frees CPU and Memory, but it comes back almost immediately. I presume that it is used by Kolab. It seems that the more Emails clients download messages (reindexing because of folders from in to out of the Inbox) the more beam.smp uses resources. Yesterday CPU usage was around 800% and memory usage above 16Gb - brutal and I had to kill the process, before the server stalled (Server with 2 Xeons and 32Gb RAM).

    Best Regards

    0
    Comment actions Permalink
  • Avatar
    Alexey Lapshin

    Hello Pedro,

    Thank you for the update.
    As stated in the article, the only directory to be operated on is /var/qmail/mailnames. All other directories should remain untouched.

    Regarding "beam.smp" process. Your assumption is correct - this process used by Kolab. If you still experiencing issues with high CPU/RAM usage with it - submit a ticket to Plesk Support - that we will be able to investigate the issue further https://support.plesk.com/hc/en-us/requests/new .

    0
    Comment actions Permalink
  • Avatar
    Mohamed Elkaffas

     i have same problem with this beam.smp and tried to request a new support but the license issued outside plesk , and issuer dont know the problem

    0
    Comment actions Permalink
  • Avatar
    Lev Iurev (Edited )

    @Mohamed Elkaffas

     

    In order to contact us check the following article

    0
    Comment actions Permalink

Please sign in to leave a comment.

Have more questions? Submit a request