Fork me on GitHub
< Back to Mail-in-a-Box

Mail-in-a-Box Maintenance Guide

This page covers frequently asked questions about how to configure a running Mail-in-a-Box and how to keep it up to date. For help setting up a new box, see the setup guide.

Something Went Wrong!

Is something not working right? Start here. Please follow these steps before asking a question on the discussion forum:

  1. Check your System Status Checks page in the control panel at https://box.yourdomain.com/admin. Everything should be green. Anything not green may help you diagnose the problem on your own.
  2. Re-run the setup by logging into your box (using the same ssh command that you used during setup) and running sudo mailinabox. Then check the System Status Checks page again.
  3. Restart your box by logging in with SSH and then typing sudo reboot. Once the box has started up, check the System Status Checks page again.

Please do these steps first. If you’ve done these steps, then head to the discussion forum to ask your question. In your post:

  1. Describe the problem you are having. Instead of saying “it doesn’t work”, write the error message you see, post a screenshot, or describe what you are seeing that you don’t want to be seeing.
  2. Mention that you “checked the status page, re-ran setup, and rebooted the box”, per the steps above, so that anyone answering knows what you have tried so far. If you don’t mention this, someone may ask you to do it before providing other assistance.
  3. If everything in the System Status Checks is green, mention that by saying “all checks are green”. If something isn’t green, mention it.

If you figure out the problem on your own, you are also welcome to write up your experience on the discussion forum so that it might help others.

Multiple Domain Names

Your box can host email and serve static websites for more than one domain name. To set up additional domain names, just follow three steps:

  1. Buy an additional domain name if you don’t yet own it. See the Your Domain Name section of the setup guide for tips.
  2. Configure its nameservers to be the same nameservers on your first domain name. Follow the Domain Name Configuration — Nameservers section of the setup guide for instructions.
  3. Add an email account (user) or alias on your box for the new domain name using the control panel. If you only plan to serve a website, still add an email address or alias — that’s how the box knows to handle that domain name.

Updating System Software

Mail-in-a-Box is based on a collection of other software packages provided by Ubuntu. We call these packages system software packages. These packages may have security or other functionality updates.

You should periodically update the system software on your box. The box will automatically install security updates as they are made available by Ubuntu, but your control panel will let you know if a reboot is needed or if non-security updates are available for you to install.

When indicated to do so, log into your machine with SSH (using the same ssh command that you used during setup) and then type:

sudo apt-get update && sudo apt-get upgrade

If prompted to reboot, type:

sudo reboot

We will post security advisories to our twitter account @mailinabox, the announcements section of the discussion forum, and our Slack chat (see the homepage).

Upgrading Mail-in-a-Box

You should move to the latest Mail-in-a-Box release as releases are posted, especially if an update addresses any security issues, although you do not necessarily need to do so. We will post release announcements to our twitter account @mailinabox, the announcements section of the discussion forum, and our Slack chat (see the homepage).

Check the release notes prior to updating to see what’s been changed in the latest version.

To upgrade Mail-in-a-Box to the latest release, first log into your machine using SSH in exactly the same manner as when you were setting up the box (see the setup guide section called Setting Up The Box for a reminder of what that looked like).

Then, once logged in, run:

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

This is actually the same command you ran when setting up the box. It does upgrades too.

Moving to a New Box / Testing Backups

If you want to move your Mail-in-a-Box installation to a new machine (e.g. you’re getting more memory, getting a new IP address, etc.), or if something is horribly wrong with your box, you can easily move all of your data to a new machine.

Create a new box

Start by creating a new Mail-in-a-Box machine: Spin up a new machine following the setup guide’s sections The Machine and Setting Up The Box. At this point you will have a mostly working, but empty, Mail-in-a-Box on your new machine.

Restore your mail data (and other files)

Next you’ll restore your mail data and other files to the new machine. The safest way to do this is to restore the files from a backup.

Forcing one last backup on the old machine

If your old Mail-in-a-Box is still running, you can force a backup now to ensure you have everything backed up since the last nightly backup run. Log into your old machine using SSH and run:

cd mailinabox
sudo management/backup.py

Locating your backup secret key

Your backups are encrypted, and you will need your backup secret key to restore from the backup.

You should have already stored the backup secret key in a safe place — like in your home — per the backup instructions in the control panel. If you haven’t done that yet... and if your old box is still running... now is the time! The file is located on your old box at /home/user-data/backup/secret_key.txt. Copy that file to a safe place now.

Copy that file onto your new box. Any SFTP program like FileZilla can help you with that. (SFTP is like SSH, so you will use the same login credentials as you use with SSH.)

Restoring backup files

Local backups

If you are using the default backup method, which stores backups on the box itself, then hopefully you have figured out how to periodically copy those files somewhere else safe — otherwise what’s the point!

Using any SFTP program like FileZilla (or scp if you know how) copy your backups from wherever you stored them to somewhere on your new machine. If your old box is still running, then just copy them from /home/user-data/backup/encrypted on your old box.

Then restore the files:

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

Amazon S3 backups

If your backups are stored in Amazon S3, get your account credentials handy and then run a duplicity restore:

export AWS_ACCESS_KEY_ID=paste your AWS access key ID here
export AWS_SECRET_ACCESS_KEY=paste your AWS secret access key here
export PASSPHRASE=$(cat your_backup_secret_key_file.txt)
sudo -E duplicity restore s3://s3.amazonaws.com/your-bucket-name/your-backup-path /home/user-data/

You may have to adjust the S3 URL depending on what AWS region you use.

Re-configure the box

Re-run Mail-in-a-Box setup now that your old files are back:

sudo mailinabox

Your box should be functioning now. Log into the control panel on your new box to see if things look right.

Update your DNS

Finally, update your domain name’s glue records to the new machine’s IP address (see the setup guide’s section on glue records.

DNS can take a few hours to update, so wait a while, and then see if the control panel’s status checks report any problems and that your devices are picking up mail on your new box.

(Skip this if you are just testing your backups.)