Rebuilding mail-in-a-box server

Hi,
I was messing around with ownCloud the other day and seem to have broken it–it says “File not found” when i go to the /cloud page. I host two domains on this address and am wondering what i must do regarding SSL certificates and email backups if i were to re-create the VM.

Thanks in advance, this project is pretty great!
Dan.

MIAB is supposed to be idempotent – it should set back up correctly if you re-run “mailinabox” on the server. Depending on how screwed up it is, that may not work. Have you tried it?

I’ve tried running

sudo mailinabox

on the server, everything seems to update fine although i still cant access my /cloud page.

I just went through this myself recently, and it turned out the fix was pretty simple (technically speaking).

  1. Stop the mailinabox on broken service

  2. Spin up a new server with the default config and perform required updates.

  3. Stop the mailinabox service on new server

  4. Tar up the /home/user-data folder, ensuring you use the -p flag for permissions, and move the data to the new server where you will untar it again ensuring you maintain permissions (root required). Move untared files to the /home/user-data folder on the new server.

  5. Swap around IP addresses if required to new server

  6. Reboot server.

This will give you a clean server with your old server data and config. All the data you need is contained in the /home/user-data folder. Now, understand I am running mine on the Amazon EC2 cloud, so it was easy for me to spin up a new server to do this and swap around the static ip I had assigned.

In the end this should ensure you have a clean build. Hope this helps.

1 Like

You can probably ‘fake’ this without a second server by removing /home/user-data, /usr/local/*, and /etc/mailinabox.conf.

I’d actually do something like move /home/user-data and /etc/mailinabox.conf temporarily to /root. I’ve not tried this though and my usual testing VM is currently in use, otherwise I’d test for you.

I tried something similar initially to clean up the mess I had made, the issue is that the installer script would still see the existing packages and not reinstall them or clean up the mess. Add to that the fact that I knew I had tweaked a few things outside the norm, I decided a clean install was best.