Migrate to Ubuntu 22.04

I am in the process of migrating to a new 22.04 server (from 18.04). Built the new server. I took advantage of the opportunity to move the install folder to be off of the root (/mail-in-a-box). I used the command export STORAGE_ROOT=/your/desired/path.

When I try to restore my backup it all goes well except there are no mailboxes restored. Sad face.

Should I be able to restore to a “new” location - or is that my problem?

Wisdom appreciated.

Is the new STORAGE_ROOT used for other settings? You can check /etc/mailinabox.conf for the current setting.
If it’s not set or used, you might need to do something like:

sudo su
export STORAGE_ROOT=/your/desired/path

This should make sure the exported variable is actually used by the setup script.
Note that I have not tested this, so check it carefully, and make sure you have backups.

Here is what I have:

cat mailinabox.conf


But — there is always a but… I took a look at my mailboxes list from the terminal and they are all there. They just do not show up in the web UI.

Not sure what you’ve done but the DB restore is not really part of MIAB, so I doubt that the DB restore uses STORAGE_ROOT. Perhaps the restore went to the original location and the install to the STORAGE_ROOT location?

The upgrade instructions (https://mailinabox.email/maintenance.html) include:

export PASSPHRASE=$(cat your_backup_secret_key_file.txt)
sudo -E duplicity restore --force file:///path/to/copied/files /home/user-data/

Are you sure that /path/to/copied/files is the directory with the duplicity* backup files, and /home/user-data/ is the same as your STORAGE_ROOT?

Sorry, I was not clear. The duplicity restore did seem to have gone to the /mail-in-a-box folder. If I look at /mailinabox/mail/mailboxes/company.com all my mailboxes are there. But, they are not in the web ui for MIAB?

Any ideas on that?

Haven’t heard of that one. Only one question - you have mailbox stuff (restored) under /mail-in-a-box … does it look like there is ALSO stuff under /home/user-data/mail/mailboxes?

In this:

export PASSPHRASE=$(cat /home/user-data/temp2/secret_key.txt)
sudo -E duplicity restore --force file:///home/user-data/temp3/encrypted /mailinabox

What does the trailing “mailinabox” mean here?

My installation location is /mail-in-a-box.

Could that be an issue with the restore?

Certainly could. The last part of the duplicity command is the destination name. The command you show will have put the restore into “/mailinabox” which is a completely different folder to “/mail-in-a-box” (which is what you told MIAB to use).

In Linux, every character of the filename is significant - capitals, dots, dashes, everything in the name matters - Mailinabox, MailInABox, mailinabox, mail.in.a.box, and mail-in-a-box are all completely separate folders.

Here is a transcript of my installation and restore. As of now I am not able to login to the Admin UI using the username and password configured.

PDF Transcript

Start with Fresh Ubuntu 22.04 Linode

export STORAGE_ROOT=/mail-in-a-box
curl -s https://mailinabox.email/setup.sh | sudo -E bash

Then the restore:
I am not sure if the following is the problem, but I realize not that it is the wrong path:
sudo rm -rf /home/user-data/ssl/*

Should have been:
sudo rm -rf /mail-in-a-box/ssl/*

root@localhost:/home/user-data/temp# export PASSPHRASE=$(cat /home/user-data/temp/secret_key.txt)
root@localhost:/home/user-data/temp# sudo -E duplicity restore --force file:///home/user-data/temp/encrypted /mail-in-a-box

Now I get this:

Local and Remote metadata are synchronized, no sync needed.
Last full backup date: Tue Apr  4 03:04:09 2023
Error '[Errno 17] File exists: b'rtest/roundcube.sieve' -> b'/mail-in-a-box/mail/sieve/saviorlabs.net/rtest.sieve'' processing mail/sieve/saviorlabs.net/rtest.sieve
Error '[Errno 17] File exists: b'supportfbs/Test.sieve' -> b'/mail-in-a-box/mail/sieve/saviorlabs.net/supportfbs.sieve'' processing mail/sieve/saviorlabs.net/supportfbs.sieve

The web admin portal does not display.

Apparently, duplicity is not able to restore over existing files. Did you delete the /mail-in-a-box/ directory before trying the restore?

I will try to mv it to another name. I.e. mv mail-in-a-box origianl-mail-in-a-box

I guess that your system is in a somewhat confused state. Personally, I would wipe that image and start again - rather than having multiple copies of old stuff lying around, etc.

Why did you want to put the mail data in /mail-in-a-box? Unless you’ve got separate volumes, the default location is fine. If you do have a separate volume for mail data, you can mount that volume at the default location (/user/user-data). Just be 100% sure it will always be there after reboot - if it doesn’t mount, that would really confuse MIAB!

ok - so I have given up trying to get the different data folder working. So, I reformatted the Linode and have tried to install again, this time to the defaults…

I have tried this reformat three times and I get stuck at the following…

I ran this command:

curl -s https://mailinabox.email/setup.sh | sudo -E bash

This is the beginning of the output:

Downloading Mail-in-a-Box v61.1. . .
Installing packages needed for setup..

This is how far I get:

Installing nsd (DNS server)...
Generating DNSSEC signing keys...
Installing Postfix (SMTP server)...
Installing Dovecot (IMAP server)...
Creating new user database: /home/user-data/mail/users.sqlite
Installing OpenDKIM/OpenDMARC...
Installing SpamAssassin...
Installing Nginx (web server)...
Installing Roundcube (webmail)...
Installing Nextcloud (contacts/calendar)...

Upgrading to Nextcloud version 23.0.10

I have waited an hour on this most recent install.

Am I doing something wrong?


Found out that Nextcloud was down.

I reran today and it now installed.

New/Same issue - trying to login - my password does not work.

I tried to use

sudo /root/mailinabox/tools/mail.py user password me@company.com

and got this:

/root/mailinabox/tools/mail.py: line 3: management/cli.py: No such file or directory

So all is well, but I cannot login!

Got it - finally, Got It all working - even the mailboxes were migrated.


It did not like moving the data folder - lesson learned

Thanks to everyone who helped!

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