FAILED: service nginx restart


#1

Trying to upgrade from 14.04 to 18.04. After getting everything setup finally, and restoring my backup, I tried rerunning
# mailinabox

which ended with:

RTNETLINK answers: Network is unreachable

Primary Hostname: box.eladhen.com
Public IP Address: 165.227.150.231
Mail-in-a-Box Version:  v0.41

Updating system packages...
Installing system packages...
Initializing system random number generator...
Firewall is active and enabled on system startup
Installing nsd (DNS server)...
Installing Postfix (SMTP server)...
Installing Dovecot (IMAP server)...
Installing OpenDKIM/OpenDMARC...
Installing SpamAssassin...
Installing Nginx (web server)...

FAILED: service nginx restart
-----------------------------------------
Job for nginx.service failed because the control process exited with error code.
See "systemctl status nginx.service" and "journalctl -xe" for details.
-----------------------------------------

Running:

systemctl status nginx.service

Got me:

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 Sat 2019-03-30 23:40:06 IDT; 4min 7s ago
     Docs: man:nginx(8)
  Process: 7005 ExecStartPre=/usr/sbin/nginx -t -q -g daemon on; master_process on; (code=exited, status=1/FAILURE)

Mar 30 23:40:04 box.mybox.com systemd[1]: Starting A high performance web server and a reverse proxy server...
Mar 30 23:40:06 box.mybox.com nginx[7005]: nginx: [emerg] BIO_new_file("/home/user-data/ssl/box.mybox.com-20190628-a44560
Mar 30 23:40:06 box.mybox.com nginx[7005]: nginx: configuration file /etc/nginx/nginx.conf test failed
Mar 30 23:40:06 box.mybox.com systemd[1]: nginx.service: Control process exited, code=exited status=1
Mar 30 23:40:06 box.mybox.com systemd[1]: nginx.service: Failed with result 'exit-code'.
Mar 30 23:40:06 box.mybox.com systemd[1]: Failed to start A high performance web server and a reverse proxy server.

Can anyone help?


#3

Was this a fresh 18.04 install?

Your error message is pointing to a problem in the nginx.conf file. Can you share that maybe?

You can test the nginx config with:

nginx -t

And it should tell you the lines that have errors.


#4

The output of nginx -t is already shown in the OP … hence my deleted post.

Mar 30 23:40:06 box.mybox.com nginx[7005]: nginx: [emerg] BIO_new_file("/home/user-data/ssl/box.mybox.com-20190628-a44560
Mar 30 23:40:06 box.mybox.com nginx[7005]: nginx: configuration file /etc/nginx/nginx.conf test failed

It seems that OP solved this as I can access his MiaB’s Roundcube.


#5

It was a fresh install on digital ocean after doing Droplet > Destroy > Rebuild.

Anyway, sadly I HAD to have email on Sunday (it’s a workday here) and had to sleep, so I restored my 14.04 snapshot… I’ll try again another day…

So can’t check nginx.conf at the moment…


#6

It was after restoring the backup from the older box…


#7

Gotcha! When you try again and if you have the same problem come to the Slack room … something like the problem you had is hard for me to diagnose, but easy to solve - if that makes sense …


#8

How do I get to the slack room?


#9

There is a link to join located on the main Mail-in-a-Box webpage.


#10

I’m also getting this same issue. Would be really nice to see if you come up with a solution!


#11

The issue @eladhen is having seems to be SSL related …

@Kw0mE are you getting the exact same error?


#12

Yes, I get the same error. I did a fresh install on 18.04 when I restore my backups I get this error and then I cant connect to the web control pannel or anything.


#13

If you have time now, and are willing to go to the Slack channel we can trouble shoot. Slack is a bit easier than PM – if you don’t want to use Slack we can PM.


#14

Ok so I think I found a solution! I’m still quite fresh to Linux so this will probably make you cringe haha.

Fresh install of 18.04

Sudo apt update
Sudo apt upgrade
Curl -S https://mailinabox.email/setup.sh | sudo bash

Copy backups and key to
home/user-data/restore

Export passphrase=$(cat /home/user-data/restore/secret_key.txt)

Sudo -e duplicity restore —force file:///home/user-data/restore/encrypted /home/user-data/

Then copy the entire folder of home/user-data/ssl from the old box to the new one

Sudo mailinabox

And it worked…

Edit:
After doing all of this I scrolled back through the terminal and found this error

Error ‘[Errno 17] File exists’ processing ssl/ssl_certificate.pem

So maybe removing this file is the key step? I have a feeling I may have read this somewhere before on the forum when I first tried to upgrade early March and it went straight over my head.


#15

Yes, the solution I would have proposed would have been to remove the contents of the /home/user-data/ssl directory and then run

sudo /home/user/mailinabox/setup/ssl.sh

replace “/home/user” with the location of your mailinabox install directory. (Either /home/user or /root - dependent upon which user you used.)

and finally

sudo mailinabox

This will be the solution for anyone who does not still have their Ubuntu 14.04 box running (only have the encrypted backups) – in the case of a VPS provider who required the original VPS to be destroyed to retain the IP address.