Mailinabox service wont start on boot. 502 Bad Gateway - Admin Panel

I’m getting “502 Bad Gateway” on my https://box.mydomain.com/admin page after each reboot on my machine.

What fixes it is running “sudo service mailinabox start” after each reboot on my machine. The service doesn’t start after reboot or I need to force the service to restart/start after reboot. When I tail /var/log/syslog, I don’t see anything that stands out in my syslog.

I’ve also tried manually adding the service to start on boot by doing “update-rc.d mailinabox defaults”. I’ve removed it by using “update-rc.d -f mailinabox remove” and then added it again. The issue is still happening.

Any ideas on this? I’ve also ran “sudo mailinabox restart” to reinstall it but this didn’t change anything. Thanks in advance.

I have created a temporary fix listed below.

I created a mailinabox.sh file located in /etc/profile.d/. In this file I placed the following text “sudo -S service mailinabox start”. I had to make it run as an executable by running chmod +x mailinabox.sh. You will have to enter your password immediately after logging into your system by doing this but it will immediately start the service.

This is a little work around for now and makes it so the service starts when I login to my main user after reboot. If you can think of a better way or why the service isn’t automatically starting on reboot, then please let me know.

Thanks!

1 Like

I know I wrote a temporary fix above, but does anyone have any comments on how to resolve this or why it might be happening?

1 Like

This has been resolved by setting up a completely new VPS and reinstalling mailinabox. Not sure what caused it originally. Could be encrypting the home directories or LUKS. Anyways, it’s all resolved now.