mail-in-a-box / mailinabox

Mail-in-a-Box helps individuals take back control of their email by defining a one-click, easy-to-deploy SMTP+everything else server: a mail server in a box.
https://mailinabox.email/
Creative Commons Zero v1.0 Universal
13.85k stars 1.43k forks source link

Error upgrading to 0.28 - FAILED: service mailinabox stop #1411

Open rwillett opened 6 years ago

rwillett commented 6 years ago

Hi,

Am trying to upgrade MIAB to 0.28 from 0.26.

I've logged on as root to the Ubuntu 14.04 box and downloaded the code as per the instructions in

https://mailinabox.email/maintenance.html#upgrade

I initially had a problem with the MIAB box complaining about stopping spamd. This appears to be the same issue as #781. If I look in /var/log/syslog I see

Aug  5 10:38:54 box spampd[1387]: Couldn't unlink "/var/run/spampd.pid" [Permission denied]

I also see

Aug  5 10:38:01 box postgrey[1299]: Couldn't unlink "/var/run/postgrey.pid" [Permission denied

which suggest something isn't quite right.

I the rebooted the box and started the install again and the spamd error went away but I then get


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)...
Installing Roundcube (webmail)...
Installing Nextcloud (contacts/calendar)...
Nextcloud is already latest version
Installing Z-Push (Exchange/ActiveSync server)...
Installing Mail-in-a-Box system management daemon...

FAILED: service mailinabox stop
-----------------------------------------
-----------------------------------------

I've rebooted the box twice now and started the install twice but I still have the error.

Any help welcomed here as I'm unsure what the state of the upgrade is.

Thanks

Rob

rwillett commented 6 years ago

Something is wrong as I'm struggling to delete mail thats come in previously.

Any help welcomed.

Thanks

JoshData commented 6 years ago

Could you run sudo service mailinabox stop and let me know what the output is?

rwillett commented 6 years ago

Hi,

No output at all!

Mac-pro:~ rwillett$ ssh root@box.jambuster.london
root@box.jambuster.london's password:
Welcome to Ubuntu 14.04.5 LTS (GNU/Linux 2.6.32-042stab128.2 x86_64)

 * Documentation:  https://help.ubuntu.com/
Last login: Sun Aug  5 10:36:53 2018 from mail.robertwillett.com
root@box:~# sudo service mailinabox stop
root@box:~#

I know I don't need the sudo :)

rwillett commented 6 years ago

I am getting inbound email but deleting e-mail appears very slow. My mail client (mailmate) used to be able to delete lots at a time, now I have to delete a few at a time.

rwillett commented 6 years ago

Hi,

Nothing returned again. Surely something should be there?

root@box:~# sudo service mailinabox stop
root@box:~#
rwillett commented 6 years ago

I've edited the service so I can track whats going on. I've added some simple debugging

echo "Now down to functions..."
do_start()
{
        echo "Start function called..."
        # Return
        #   0 if daemon has been started
        #   1 if daemon was already running
        #   2 if daemon could not be started
        # start-stop-daemon --start --quiet --pidfile $PIDFILE --exec $DAEMON --test > /dev/null \

        echo start-stop-daemon --start --quiet --pidfile $PIDFILE --exec $DAEMON --test
        start-stop-daemon --start --quiet --pidfile $PIDFILE --exec $DAEMON --test  \
                || return 1
        start-stop-daemon --start --quiet --pidfile $PIDFILE --exec $DAEMON \
                --background --make-pidfile --chuid $EXEC_AS_USER --startas $DAEMON -- \
                $DAEMON_ARGS \
                || return 2
}

do_stop()
{
        # Return
        #   0 if daemon has been stopped
        #   1 if daemon was already stopped
        #   2 if daemon could not be stopped
        #   other if a failure occurred
        # start-stop-daemon --stop --quiet --retry=TERM/30/KILL/5 --pidfile $PIDFILE > /dev/null # --name $DAEMON
        start-stop-daemon --stop --retry=TERM/30/KILL/5 --pidfile $PIDFILE # --name $DAEMON
        RETVAL="$?"
        [ "$RETVAL" = 2 ] && return 2
        # Wait for children to finish too if this is a daemon that forks
        # and if the daemon is only ever run from this initscript.
        # If the above conditions are not satisfied then add some other code
        # that waits for the process to drop all resources that could be
        # needed by services started subsequently.  A last resort is to
        # sleep for some time.
        start-stop-daemon --stop --quiet --oknodo --retry=0/30/KILL/5 --exec $DAEMON
        [ "$?" = 2 ] && return 2
        # Many daemons don't delete their pidfiles when they exit.
        rm -f $PIDFILE
        return "$RETVAL"
}

I still can't see what the problem is.

root@box:~# sudo service mailinabox stop
Testing if package installed...
Package is installed...
Now down to functions...
start-stop-daemon: warning: failed to kill 2197: No such process
No process in pidfile '/var/run/mailinabox.pid' found running; none killed.
rwillett commented 6 years ago

Is there anyway to downgrade the server so I can go back to a known position?

I've 28GB of data and I want to get this resolved please, otherwise the only thing I can so is build another server and migrate 28GB of mail across.

Any help welcomed.

Thanks

Rob

JoshData commented 6 years ago

There is no downgrade, and it's not likely that downgrading will fix this. This probably isn't related to the upgrade specifically. This is also likely unrelated to the speed of deleting emails.

Try deleting /var/run/mailinabox.pid if it exists?

rwillett commented 6 years ago

We had already deleted the various PID files before and it never worked.

We think the problem is due to some dodgy interaction with services starting and stopping, possibly due to running on a VPS.

We think we have got round the problem by manually going into the setup/management.sh script, commenting out the start and stop element at the end, this allowed the setup to get back loading the management daemon with out an error. We then had the identical error with munin, so we commented out the start and stop part of the daemon at the end of the script.

We then found that the startup script was waiting for the management daemon to start so we manually started the daemon, edited the startup script to remove all the setup of the various daemons, that allowed the setup script to move onto the LetsEncrypt setup (which was already done).

We then got a successful installation message for the first time.

We've rebooted the box to check that things startup, and it looks to our untutored eye that its working. The admin page seems OK.

So in conclusion the start and stop element of the maininaboxmanagement daemon and the muni daemon do not want to play at all on our box. Weird!