mailinabox icon indicating copy to clipboard operation
mailinabox copied to clipboard

'Moving to a New Box' guide has some issues

Open nicholashead opened this issue 8 years ago • 9 comments

I tried to follow the guide, and ran into the same issues the person at https://discourse.mailinabox.email/t/testing-restore-to-new-vps-fail/1212/4 ran into:

  • Restore destination directory /home/user-data already exists. Will not overwrite. error after running sudo -E duplicity restore file:///path/to/copied/files /home/user-data/
  • Error '[Errno 17] File exists' processing ssl/ssl_certificate.pem after adding --force to the above duplicity command.

At this point I don't know what to do. Is that error an acceptable one? The "Moving to a New Box" guide doesn't indicate one way or another, nor does it deal with the "already exists" folder error.

I suggest an improvement be made to the guide to clarify these issues. I would make my own pull request, however after the ssl_certificate.pem error -- I have no idea if that's an error safe to ignore, or what.

nicholashead avatar Jan 17 '17 17:01 nicholashead

Same issue here...

kimthostrup avatar Oct 02 '17 12:10 kimthostrup

same issue here, just migrated to the 18.04 release.

runing sudo mailinabox afterwards gives me the following error

nginx.service - A high performance web server and a reverse proxy server Loaded: loaded (/lib/systemd/system/nginx.service; enabled; vendor preset: enabled) Active: failed (Result: exit-code) since Wed 2019-01-16 14:39:10 CET; 3min 42s ago Docs: man:nginx(8) Process: 16299 ExecStop=/sbin/start-stop-daemon --quiet --stop --retry QUIT/5 --pidfile /run/nginx.pid (code=exited, status=0/SUCCESS) Process: 16300 ExecStartPre=/usr/sbin/nginx -t -q -g daemon on; master_process on; (code=exited, status=1/FAILURE) Main PID: 23483 (code=exited, status=0/SUCCESS)

Jan 16 14:39:09 box.her.st systemd[1]: Starting A high performance web server and a reverse proxy server... Jan 16 14:39:10 box.her.st nginx[16300]: nginx: [emerg] SSL_CTX_use_PrivateKey_file("/home/user-data/ssl/ssl_private_key.pem") failed (SSL: error:0B080074:x509 certificate routines:X509_check_private_key:key values mismatch) Jan 16 14:39:10 box.her.st nginx[16300]: nginx: configuration file /etc/nginx/nginx.conf test failed Jan 16 14:39:10 box.her.st systemd[1]: nginx.service: Control process exited, code=exited status=1 Jan 16 14:39:10 box.her.st systemd[1]: nginx.service: Failed with result 'exit-code'. Jan 16 14:39:10 box.her.st systemd[1]: Failed to start A high performance web server and a reverse proxy server.

What do I do now...

Alumniminium avatar Jan 16 '19 13:01 Alumniminium

Did you have files in use that it failed to overwrite from your backup?

lsof /home/user-data

I feel like i've experienced something like that back with 14.04 and a restore. I had to stop some services and run the duplicity commands from here: https://mailinabox.email/maintenance.html

jvolkenant avatar Jan 17 '19 19:01 jvolkenant

Those commands caused the problem to begin with. Yes, the same file as above, Error '[Errno 17] File exists' processing ssl/ssl_certificate.pem.

I've solved it by reinstalling the box, installing MIAB, copying everything from the ssl folder to a backup location, restore the backup from the 14.04 box, then put in the ssl folder I just backed up - back.

That worked.

Alumniminium avatar Jan 17 '19 20:01 Alumniminium

I am also running into this issue.

then put in the ssl folder I just backed up - back.

Do you mean copying the contents into the new ssl folder? Or do you mean replacing the ssl folder?

@JoshData Could you take a look at this?

louwers avatar Aug 27 '20 11:08 louwers

I now get an error when I visit the 'TLS (SSL) Certificates' page.

Aug 27 16:05:07 box start[20400]: [2020-08-27 16:05:07,293] ERROR in app: Exception on /ssl/status [GET]
Aug 27 16:05:07 box start[20400]: Traceback (most recent call last):
Aug 27 16:05:07 box start[20400]:   File "/usr/local/lib/mailinabox/env/lib/python3.6/site-packages/flask/app.py", line 2447, in wsgi_app
Aug 27 16:05:07 box start[20400]:     response = self.full_dispatch_request()
Aug 27 16:05:07 box start[20400]:   File "/usr/local/lib/mailinabox/env/lib/python3.6/site-packages/flask/app.py", line 1952, in full_dispatch_request
Aug 27 16:05:07 box start[20400]:     rv = self.handle_user_exception(e)
Aug 27 16:05:07 box start[20400]:   File "/usr/local/lib/mailinabox/env/lib/python3.6/site-packages/flask/app.py", line 1821, in handle_user_exception
Aug 27 16:05:07 box start[20400]:     reraise(exc_type, exc_value, tb)
Aug 27 16:05:07 box start[20400]:   File "/usr/local/lib/mailinabox/env/lib/python3.6/site-packages/flask/_compat.py", line 39, in reraise
Aug 27 16:05:07 box start[20400]:     raise value
Aug 27 16:05:07 box start[20400]:   File "/usr/local/lib/mailinabox/env/lib/python3.6/site-packages/flask/app.py", line 1950, in full_dispatch_request
Aug 27 16:05:07 box start[20400]:     rv = self.dispatch_request()
Aug 27 16:05:07 box start[20400]:   File "/usr/local/lib/mailinabox/env/lib/python3.6/site-packages/flask/app.py", line 1936, in dispatch_request
Aug 27 16:05:07 box start[20400]:     return self.view_functions[rule.endpoint](**req.view_args)
Aug 27 16:05:07 box start[20400]:   File "/root/mailinabox/management/daemon.py", line 53, in newview
Aug 27 16:05:07 box start[20400]:     return viewfunc(*args, **kwargs)
Aug 27 16:05:07 box start[20400]:   File "/root/mailinabox/management/daemon.py", line 339, in ssl_get_status
Aug 27 16:05:07 box start[20400]:     domains_status = get_web_domains_info(env)
Aug 27 16:05:07 box start[20400]:   File "/root/mailinabox/management/web_update.py", line 209, in get_web_domains_info
Aug 27 16:05:07 box start[20400]:     has_root_proxy_or_redirect = set(get_web_domains_with_root_overrides(env))
Aug 27 16:05:07 box start[20400]:   File "/root/mailinabox/management/web_update.py", line 64, in get_web_domains_with_root_overrides
Aug 27 16:05:07 box start[20400]:     for type, value in [('redirect', settings.get('redirects', {}).get('/')),
Aug 27 16:05:07 box start[20400]: AttributeError: 'NoneType' object has no attribute 'get'
Aug 27 16:05:07 box Exception on /ssl/status [GET]#012Traceback (most recent call last):#012  File "/usr/local/lib/mailinabox/env/lib/python3.6/site-packages/flask/app.py", line 2447, in wsgi_app#012    response = self.full_dispatch_request()#012  File "/usr/local/lib/mailinabox/env/lib/python3.6/site-packages/flask/app.py", line 1952, in full_dispatch_request#012    rv = self.handle_user_exception(e)#012  File "/usr/local/lib/mailinabox/env/lib/python3.6/site-packages/flask/app.py", line 1821, in handle_user_exception#012    reraise(exc_type, exc_value, tb)#012  File "/usr/local/lib/mailinabox/env/lib/python3.6/site-packages/flask/_compat.py", line 39, in reraise#012    raise value#012  File "/usr/local/lib/mailinabox/env/lib/python3.6/site-packages/flask/app.py", line 1950, in full_dispatch_request#012    rv = self.dispatch_request()#012  File "/usr/local/lib/mailinabox/env/lib/python3.6/site-packages/flask/app.py", line 1936, in dispatch_request#012    return self.view_functions[rule.endpoint](**req.view_args)#012  File "/root/mailinabox/management/daemon.py", line 53, in newview#012    return viewfunc(*args, **kwargs)#012  File "/root/mailinabox/management/daemon.py", line 339, in ssl_get_status#012    domains_status = get_web_domains_info(env)#012  File "/root/mailinabox/management/web_update.py", line 209, in get_web_domains_info#012    has_root_proxy_or_redirect = set(get_web_domains_with_root_overrides(env))#012  File "/root/mailinabox/management/web_update.py", line 64, in get_web_domains_with_root_overrides#012    for type, value in [('redirect', settings.get('redirects', {}).get('/')),#012AttributeError: 'NoneType' object has no attribute 'get'
Aug 27 16:05:07 box start[20400]: 127.0.0.1 - - [27/Aug/2020 16:05:07] "#033[35m#033[1mGET /ssl/status?_=1598537107204 HTTP/1.0#033[0m" 500 -
Aug 27 16:05:13 box kernel: [ 8199.881184] [UFW BLOCK] IN=ens3 OUT= MAC=00:00:50:d1:ec:9d:fe:00:50:d1:ec:9d:08:00 SRC=95.147.80.52 DST=80.209.236.157 LEN=44 TOS=0x00 PREC=0x00 TTL=55 ID=60905 PROTO=TCP SPT=59257 DPT=60001 WINDOW=50009 RES=0x00 SYN URGP=0

Edit: I had a custom.yaml in /home/user-data/www. It works now.

I replaced all SSL certificates from the backup by those from the clean install.

louwers avatar Aug 27 '20 14:08 louwers

I had the same problem. It was because I skipped the step:

sudo mv /home/user-data /tmp/user-data.empty

from this tutorial.

codesxt avatar Oct 17 '20 18:10 codesxt

I had the same problem. It was because I skipped the step:

sudo mv /home/user-data /tmp/user-data.empty

from this tutorial.

This step is absent from the current documentation under "Maintenance Guide" on the website.

vedevilolivedev avatar Oct 24 '21 01:10 vedevilolivedev

For those unaware, there is now a separate mailinabox.email GitHub project.

Is the linked forum discussion for all migrations or just when upgrading from 14.04 to 18.04?

myfirstnameispaul avatar Oct 24 '21 13:10 myfirstnameispaul