1

Topic: Bad Gateway error 502 - Upgrade to iRedAdmin-Pro 4.4 from 1.3.1

==== REQUIRED BASIC INFO OF YOUR IREDMAIL SERVER ====
- iRedMail version (check /etc/iredmail-release): 1.3.1
- Deployed with iRedMail Easy or the downloadable installer? Downloadable
- Linux/BSD distribution name and version: Ubuntu Server 20.04 - fresh install
- Store mail accounts in which backend (LDAP/MySQL/PGSQL): SQL (MariaDB)
- Web server (Apache or Nginx): Nginx
- Manage mail accounts with iRedAdmin-Pro? Just upgraded - worked fine with open sorce
- [IMPORTANT] Related original log or error message is required if you're experiencing an issue.
====

Same problem as william_jmr, also replied on that post with logs below



Just had exactly the same problem. Service status shows:

iredadmin.service - iRedAdmin daemon service
     Loaded: loaded (/lib/systemd/system/iredadmin.service; enabled; vendor preset: enabled)
     Active: active (running) since Mon 2020-08-24 02:28:56 UTC; 14min ago
   Main PID: 21041 (uwsgi)
      Tasks: 6 (limit: 4498)
     Memory: 3.5M
     CGroup: /system.slice/iredadmin.service
             ââ21041 /usr/bin/uwsgi --ini /opt/www/iredadmin/rc_scripts/uwsgi/debian.ini --pidfile /v>
             ââ21043 /usr/bin/uwsgi --ini /opt/www/iredadmin/rc_scripts/uwsgi/debian.ini --pidfile /v>
             ââ21044 /usr/bin/uwsgi --ini /opt/www/iredadmin/rc_scripts/uwsgi/debian.ini --pidfile /v>
             ââ21045 /usr/bin/uwsgi --ini /opt/www/iredadmin/rc_scripts/uwsgi/debian.ini --pidfile /v>
             ââ21046 /usr/bin/uwsgi --ini /opt/www/iredadmin/rc_scripts/uwsgi/debian.ini --pidfile /v>
             ââ21047 /usr/bin/uwsgi --ini /opt/www/iredadmin/rc_scripts/uwsgi/debian.ini --pidfile /v>

Aug 24 02:28:56 mxserver iredadmin[21041]: spawned uWSGI worker 5 (pid: 21047, cores: 1)
Aug 24 02:29:45 mxserver iredadmin[21041]: -- unavailable modifier requested: 0 --
Aug 24 02:29:53 mxserver iredadmin[21041]: -- unavailable modifier requested: 0 --
Aug 24 02:37:20 mxserver iredadmin[21041]: -- unavailable modifier requested: 0 --
Aug 24 02:37:26 mxserver iredadmin[21041]: -- unavailable modifier requested: 0 --
Aug 24 02:37:28 mxserver iredadmin[21041]: -- unavailable modifier requested: 0 --
Aug 24 02:37:42 mxserver iredadmin[21041]: -- unavailable modifier requested: 0 --
Aug 24 02:42:06 mxserver iredadmin[21041]: -- unavailable modifier requested: 0 --
Aug 24 02:42:29 mxserver iredadmin[21041]: -- unavailable modifier requested: 0 --
Aug 24 02:42:36 mxserver iredadmin[21041]: -- unavailable modifier requested: 0 --

and syslog:

Aug 24 02:35:01 mxserver CRON[22071]: (root) CMD (/bin/bash /usr/local/bin/fail2ban_banned_db unban_db                                   
Aug 24 02:36:01 mxserver CRON[22114]: (root) CMD (/bin/bash /usr/local/bin/fail2ban_banned_db unban_db                                   
Aug 24 02:37:01 mxserver CRON[22138]: (root) CMD (/bin/bash /usr/local/bin/fail2ban_banned_db unban_db                                   
Aug 24 02:37:20 mxserver iredadmin: -- unavailable modifier requested: 0 --
Aug 24 02:37:26 mxserver iredadmin: -- unavailable modifier requested: 0 --
Aug 24 02:37:42 mxserver iredadmin: message repeated 2 times: [ -- unavailable modifier requested: 0 -                                 
Aug 24 02:38:01 mxserver CRON[22163]: (root) CMD (/bin/bash /usr/local/bin/fail2ban_banned_db unban_db                                   
Aug 24 02:39:01 mxserver CRON[22192]: (root) CMD (  [ -x /usr/lib/php/sessionclean ] && if [ ! -d /run                             /systemd/system ]; then /usr/lib/php/sessionclean; fi)
Aug 24 02:39:01 mxserver CRON[22193]: (root) CMD (/bin/bash /usr/local/bin/fail2ban_banned_db unban_db                                   
Aug 24 02:39:07 mxserver systemd[1]: Starting Clean php session files...
Aug 24 02:39:08 mxserver systemd[1]: phpsessionclean.service: Succeeded.
Aug 24 02:39:08 mxserver systemd[1]: Finished Clean php session files.
Aug 24 02:40:01 mxserver CRON[22287]: (root) CMD (/bin/bash /usr/local/bin/fail2ban_banned_db unban_db                                   
Aug 24 02:41:01 mxserver CRON[22311]: (root) CMD (/bin/bash /usr/local/bin/fail2ban_banned_db unban_db                                   
Aug 24 02:42:01 mxserver CRON[22339]: (root) CMD (/bin/bash /usr/local/bin/fail2ban_banned_db unban_db                                   
Aug 24 02:42:06 mxserver iredadmin: -- unavailable modifier requested: 0 --
Aug 24 02:42:29 mxserver iredadmin: -- unavailable modifier requested: 0 --
Aug 24 02:42:36 mxserver iredadmin: -- unavailable modifier requested: 0 --
Aug 24 02:43:01 mxserver CRON[22377]: (root) CMD (/bin/bash /usr/local/bin/fail2ban_banned_db unban_db
Aug 24 02:44:01 mxserver CRON[22410]: (root) CMD (/bin/bash /usr/local/bin/fail2ban_banned_db unban_db

----

Spider Email Archiver: On-Premises, lightweight email archiving software developed by iRedMail team. Supports Amazon S3 compatible storage and custom branding.

2

Re: Bad Gateway error 502 - Upgrade to iRedAdmin-Pro 4.4 from 1.3.1

Shortly after this post iRedMail became unresponsive, now also unable to log into roundcube .

Rebooted the server but no change

3 (edited by gkampou 2020-08-25 09:41:17)

Re: Bad Gateway error 502 - Upgrade to iRedAdmin-Pro 4.4 from 1.3.1

UPDATE: Roundcube issue solved, IP was blocked by firewall (probably because have set up one incorrect password & tried too many times), however I can't fix it because I have no access to IredAdmin still, error 502 persists...

4

Re: Bad Gateway error 502 - Upgrade to iRedAdmin-Pro 4.4 from 1.3.1

hi @gkampou,

Sorry about this trouble.
Please visit iRedAdmin-Pro again and check immediately:

- show us output of command "service iredadmin status"
- show us last 30 log lines of /var/log/syslog.

5

Re: Bad Gateway error 502 - Upgrade to iRedAdmin-Pro 4.4 from 1.3.1

● iredadmin.service - iRedAdmin daemon service
     Loaded: loaded (/lib/systemd/system/iredadmin.service; enabled; vendor preset: enabled)
     Active: active (running) since Mon 2020-08-24 13:38:40 UTC; 24h ago
    Process: 825 ExecStartPre=/bin/mkdir -p /var/run/iredadmin (code=exited, status=0/SUCCESS)
    Process: 863 ExecStartPre=/bin/chown iredadmin:iredadmin /var/run/iredadmin (code=exited, status=0/SUCCESS)
    Process: 886 ExecStartPre=/bin/chmod 0755 /var/run/iredadmin (code=exited, status=0/SUCCESS)
   Main PID: 891 (uwsgi)
      Tasks: 6 (limit: 4498)
     Memory: 4.4M
     CGroup: /system.slice/iredadmin.service
             ├─891 /usr/bin/uwsgi --ini /opt/www/iredadmin/rc_scripts/uwsgi/debian.ini --pidfile /var/run/iredadmin/iredadmin.pid
             ├─948 /usr/bin/uwsgi --ini /opt/www/iredadmin/rc_scripts/uwsgi/debian.ini --pidfile /var/run/iredadmin/iredadmin.pid
             ├─949 /usr/bin/uwsgi --ini /opt/www/iredadmin/rc_scripts/uwsgi/debian.ini --pidfile /var/run/iredadmin/iredadmin.pid
             ├─950 /usr/bin/uwsgi --ini /opt/www/iredadmin/rc_scripts/uwsgi/debian.ini --pidfile /var/run/iredadmin/iredadmin.pid
             ├─951 /usr/bin/uwsgi --ini /opt/www/iredadmin/rc_scripts/uwsgi/debian.ini --pidfile /var/run/iredadmin/iredadmin.pid
             └─952 /usr/bin/uwsgi --ini /opt/www/iredadmin/rc_scripts/uwsgi/debian.ini --pidfile /var/run/iredadmin/iredadmin.pid

Aug 24 13:38:41 mxserver iredadmin[891]: spawned uWSGI worker 1 (pid: 948, cores: 1)
Aug 24 13:38:41 mxserver iredadmin[891]: spawned uWSGI worker 2 (pid: 949, cores: 1)
Aug 24 13:38:41 mxserver iredadmin[891]: spawned uWSGI worker 3 (pid: 950, cores: 1)
Aug 24 13:38:41 mxserver iredadmin[891]: spawned uWSGI worker 4 (pid: 951, cores: 1)
Aug 24 13:38:41 mxserver iredadmin[891]: spawned uWSGI worker 5 (pid: 952, cores: 1)
Aug 24 17:35:05 mxserver iredadmin[891]: -- unavailable modifier requested: 0 --
Aug 24 17:41:25 mxserver iredadmin[891]: -- unavailable modifier requested: 0 --
Aug 24 18:44:34 mxserver iredadmin[891]: -- unavailable modifier requested: 0 --
Aug 25 13:07:55 mxserver iredadmin[891]: -- unavailable modifier requested: 0 --
Aug 25 14:16:27 mxserver iredadmin[891]: -- unavailable modifier requested: 0 --

Syslog:

Aug 25 13:59:01 mxserver CRON[44723]: (root) CMD (/bin/bash /usr/local/bin/fail2ban_banned_db unban_db)
Aug 25 14:00:01 mxserver CRON[44744]: (root) CMD (/bin/bash /usr/local/bin/fail2ban_banned_db unban_db)
Aug 25 14:00:01 mxserver CRON[44745]: (root) CMD (/usr/bin/test -x /usr/bin/mlmmj-maintd && /usr/bin/mlmmj-maintd -F -d /var/spool/mlmmj)
Aug 25 14:01:01 mxserver CRON[44779]: (root) CMD (python2 /opt/www/iredadmin/tools/delete_mailboxes.py)
Aug 25 14:01:01 mxserver CRON[44780]: (root) CMD (/bin/bash /usr/local/bin/fail2ban_banned_db unban_db)
Aug 25 14:01:01 mxserver CRON[44781]: (root) CMD (python3 /opt/iredapd/tools/cleanup_db.py >/dev/null)
Aug 25 14:01:01 mxserver CRON[44782]: (root) CMD (python2 /opt/www/iredadmin/tools/cleanup_db.py >/dev/null 2>&1)
Aug 25 14:02:01 mxserver CRON[44806]: (root) CMD (/bin/bash /usr/local/bin/fail2ban_banned_db unban_db)
Aug 25 14:02:01 mxserver CRON[44807]: (root) CMD (python3 /opt/iredapd/tools/spf_to_greylist_whitelists.py >/dev/null)
Aug 25 14:02:04 mxserver clamd[885]: Tue Aug 25 14:02:04 2020 -> SelfCheck: Database status OK.
Aug 25 14:03:01 mxserver CRON[44840]: (root) CMD (/bin/bash /usr/local/bin/fail2ban_banned_db unban_db)
Aug 25 14:04:01 mxserver CRON[44861]: (root) CMD (/bin/bash /usr/local/bin/fail2ban_banned_db unban_db)
Aug 25 14:05:01 mxserver CRON[44888]: (root) CMD (/bin/bash /usr/local/bin/fail2ban_banned_db unban_db)
Aug 25 14:06:01 mxserver CRON[44912]: (root) CMD (/bin/bash /usr/local/bin/fail2ban_banned_db unban_db)
Aug 25 14:07:01 mxserver CRON[44936]: (root) CMD (/bin/bash /usr/local/bin/fail2ban_banned_db unban_db)
Aug 25 14:08:01 mxserver CRON[44960]: (root) CMD (/bin/bash /usr/local/bin/fail2ban_banned_db unban_db)
Aug 25 14:09:01 mxserver CRON[44985]: (root) CMD (  [ -x /usr/lib/php/sessionclean ] && if [ ! -d /run/systemd/system ]; then /usr/lib/php/sessionclean; fi)
Aug 25 14:09:01 mxserver CRON[44986]: (root) CMD (/bin/bash /usr/local/bin/fail2ban_banned_db unban_db)
Aug 25 14:09:02 mxserver systemd[1]: Starting Clean php session files...
Aug 25 14:09:02 mxserver systemd[1]: phpsessionclean.service: Succeeded.
Aug 25 14:09:02 mxserver systemd[1]: Finished Clean php session files.
Aug 25 14:10:01 mxserver CRON[45069]: (root) CMD (/bin/bash /usr/local/bin/fail2ban_banned_db unban_db)
Aug 25 14:10:01 mxserver CRON[45070]: (mlmmj) CMD (find /var/vmail/mlmmj -mindepth 1 -maxdepth 1 -type d -exec /usr/bin/mlmmj-maintd -F -d {} \;)
Aug 25 14:11:01 mxserver CRON[45106]: (root) CMD (/bin/bash /usr/local/bin/fail2ban_banned_db unban_db)
Aug 25 14:12:01 mxserver CRON[45126]: (root) CMD (/bin/bash /usr/local/bin/fail2ban_banned_db unban_db)
Aug 25 14:13:01 mxserver CRON[45152]: (root) CMD (/bin/bash /usr/local/bin/fail2ban_banned_db unban_db)
Aug 25 14:14:01 mxserver CRON[45175]: (root) CMD (/bin/bash /usr/local/bin/fail2ban_banned_db unban_db)
Aug 25 14:15:01 mxserver CRON[45201]: (root) CMD (/bin/bash /usr/local/bin/fail2ban_banned_db unban_db)
Aug 25 14:16:01 mxserver CRON[45226]: (root) CMD (/bin/bash /usr/local/bin/fail2ban_banned_db unban_db)
Aug 25 14:16:27 mxserver iredadmin: -- unavailable modifier requested: 0 --

6

Re: Bad Gateway error 502 - Upgrade to iRedAdmin-Pro 4.4 from 1.3.1

Did you access iRedAdmin-Pro first? Seems not right.
Please show me output of commands below:

curl -k https://localhost/iredadmin/
service iredadmin status
tail -30 /var/log/syslog

7

Re: Bad Gateway error 502 - Upgrade to iRedAdmin-Pro 4.4 from 1.3.1

For the previous output, I had accessed IredAdmin-Pro first from a remote machine by browser. Using your instructions above I get:

#curl -k https://localhost/iredadmin/
<html>
<head><title>502 Bad Gateway</title></head>
<body>
<center><h1>502 Bad Gateway</h1></center>
<hr><center>nginx</center>
</body>
</html>

#service iredadmin status
● iredadmin.service - iRedAdmin daemon service
     Loaded: loaded (/lib/systemd/system/iredadmin.service; enabled; vendor preset: enabled)
     Active: active (running) since Mon 2020-08-24 13:38:40 UTC; 1 day 5h ago
    Process: 825 ExecStartPre=/bin/mkdir -p /var/run/iredadmin (code=exited, status=0/SUCCESS)
    Process: 863 ExecStartPre=/bin/chown iredadmin:iredadmin /var/run/iredadmin (code=exited, status=0/SUCCESS)
    Process: 886 ExecStartPre=/bin/chmod 0755 /var/run/iredadmin (code=exited, status=0/SUCCESS)
   Main PID: 891 (uwsgi)
      Tasks: 6 (limit: 4498)
     Memory: 4.3M
     CGroup: /system.slice/iredadmin.service
             ├─891 /usr/bin/uwsgi --ini /opt/www/iredadmin/rc_scripts/uwsgi/debian.ini --pidfile /var/run/iredadmin/iredadmin.pid
             ├─948 /usr/bin/uwsgi --ini /opt/www/iredadmin/rc_scripts/uwsgi/debian.ini --pidfile /var/run/iredadmin/iredadmin.pid
             ├─949 /usr/bin/uwsgi --ini /opt/www/iredadmin/rc_scripts/uwsgi/debian.ini --pidfile /var/run/iredadmin/iredadmin.pid
             ├─950 /usr/bin/uwsgi --ini /opt/www/iredadmin/rc_scripts/uwsgi/debian.ini --pidfile /var/run/iredadmin/iredadmin.pid
             ├─951 /usr/bin/uwsgi --ini /opt/www/iredadmin/rc_scripts/uwsgi/debian.ini --pidfile /var/run/iredadmin/iredadmin.pid
             └─952 /usr/bin/uwsgi --ini /opt/www/iredadmin/rc_scripts/uwsgi/debian.ini --pidfile /var/run/iredadmin/iredadmin.pid

Aug 24 13:38:41 mxserver iredadmin[891]: spawned uWSGI worker 4 (pid: 951, cores: 1)
Aug 24 13:38:41 mxserver iredadmin[891]: spawned uWSGI worker 5 (pid: 952, cores: 1)
Aug 24 17:35:05 mxserver iredadmin[891]: -- unavailable modifier requested: 0 --
Aug 24 17:41:25 mxserver iredadmin[891]: -- unavailable modifier requested: 0 --
Aug 24 18:44:34 mxserver iredadmin[891]: -- unavailable modifier requested: 0 --
Aug 25 13:07:55 mxserver iredadmin[891]: -- unavailable modifier requested: 0 --
Aug 25 14:16:27 mxserver iredadmin[891]: -- unavailable modifier requested: 0 --
Aug 25 14:26:45 mxserver iredadmin[891]: -- unavailable modifier requested: 0 --
Aug 25 18:53:15 mxserver iredadmin[891]: -- unavailable modifier requested: 0 --
Aug 25 18:53:40 mxserver iredadmin[891]: -- unavailable modifier requested: 0 --


#tail -30 /var/log/syslog
Aug 25 18:48:01 mxserver CRON[53002]: (root) CMD (/bin/bash /usr/local/bin/fail2ban_banned_db unban_db)
Aug 25 18:49:01 mxserver CRON[53023]: (root) CMD (/bin/bash /usr/local/bin/fail2ban_banned_db unban_db)
Aug 25 18:50:01 mxserver CRON[53054]: (root) CMD (/bin/bash /usr/local/bin/fail2ban_banned_db unban_db)
Aug 25 18:51:01 mxserver CRON[53076]: (root) CMD (/bin/bash /usr/local/bin/fail2ban_banned_db unban_db)
Aug 25 18:52:01 mxserver CRON[53103]: (root) CMD (/bin/bash /usr/local/bin/fail2ban_banned_db unban_db)
Aug 25 18:53:01 mxserver CRON[53128]: (root) CMD (/bin/bash /usr/local/bin/fail2ban_banned_db unban_db)
Aug 25 18:53:11 mxserver systemd[1]: Created slice User Slice of UID 1000.
Aug 25 18:53:12 mxserver systemd[1]: Starting User Runtime Directory /run/user/1000...
Aug 25 18:53:12 mxserver systemd[1]: Finished User Runtime Directory /run/user/1000.
Aug 25 18:53:12 mxserver systemd[1]: Starting User Manager for UID 1000...
Aug 25 18:53:12 mxserver systemd[53151]: Reached target Paths.
Aug 25 18:53:12 mxserver systemd[53151]: Reached target Timers.
Aug 25 18:53:12 mxserver systemd[53151]: Starting D-Bus User Message Bus Socket.
Aug 25 18:53:12 mxserver systemd[53151]: Listening on GnuPG network certificate management daemon.
Aug 25 18:53:12 mxserver systemd[53151]: Listening on GnuPG cryptographic agent and passphrase cache (access for web browsers).
Aug 25 18:53:12 mxserver systemd[53151]: Listening on GnuPG cryptographic agent and passphrase cache (restricted).
Aug 25 18:53:12 mxserver systemd[53151]: Listening on GnuPG cryptographic agent (ssh-agent emulation).
Aug 25 18:53:12 mxserver systemd[53151]: Listening on GnuPG cryptographic agent and passphrase cache.
Aug 25 18:53:12 mxserver systemd[53151]: Listening on debconf communication socket.
Aug 25 18:53:12 mxserver systemd[53151]: Listening on REST API socket for snapd user session agent.
Aug 25 18:53:12 mxserver systemd[53151]: Listening on D-Bus User Message Bus Socket.
Aug 25 18:53:12 mxserver systemd[53151]: Reached target Sockets.
Aug 25 18:53:12 mxserver systemd[53151]: Reached target Basic System.
Aug 25 18:53:12 mxserver systemd[53151]: Reached target Main User Target.
Aug 25 18:53:12 mxserver systemd[53151]: Startup finished in 169ms.
Aug 25 18:53:12 mxserver systemd[1]: Started User Manager for UID 1000.
Aug 25 18:53:12 mxserver systemd[1]: Started Session 2015 of user gk.
Aug 25 18:53:15 mxserver iredadmin: -- unavailable modifier requested: 0 --
Aug 25 18:53:40 mxserver iredadmin: -- unavailable modifier requested: 0 --
Aug 25 18:54:01 mxserver CRON[53294]: (root) CMD (/bin/bash /usr/local/bin/fail2ban_banned_db unban_db)

8

Re: Bad Gateway error 502 - Upgrade to iRedAdmin-Pro 4.4 from 1.3.1

Sorry about this trouble. This is a bug of iRedAdmin-Pro upgrade script for Ubuntu 20.04.
We fixed it recently, and sent you download link of patched iRedAdmin-Pro moment ago, please follow this tutorial to upgrade it:
https://docs.iredmail.org/migrate.or.up … admin.html

Let me know if it doesn't work for you.

9

Re: Bad Gateway error 502 - Upgrade to iRedAdmin-Pro 4.4 from 1.3.1

This worked, thanks!