1

Topic: Internal Server Error - Iredadmin

==== REQUIRED BASIC INFO OF YOUR IREDMAIL SERVER ====
- iRedMail version (check /etc/iredmail-release): 1.3.1
- Deployed with iRedMail Easy or the downloadable installer? Standalone
- Linux/BSD distribution name and version: Centos 7
- Store mail accounts in which backend (LDAP/MySQL/PGSQL): MySQL
- Web server (Apache or Nginx): Nginx
- Manage mail accounts with iRedAdmin-Pro? Yes
- [IMPORTANT] Related original log or error message is required if you're experiencing an issue.
====

After recent server update I am unable to access the Admin panel. I have the "internal Server Error" message.

Logs:

 uwsgi: Traceback (most recent call last):#012  File "/usr/lib/python2.7/site-packages/web.py-0.51-py2.7.egg/web/application.py", line 290, in process#012 return self.handle()#012  File "/usr/lib/python2.7/site-packages/web.py-0.51-py2.7.egg/web/application.py", line 281, in handle#012 return self._delegate(fn, self.fvars, args)#012  File "/usr/lib/python2.7/site-packages/web.py-0.51-py2.7.egg/web/application.py", line 527, in _delegate#012 mod = __import__(mod, None, None, [""])#012  File "/var/www/iRedAdmin-Pro-SQL-3.9/controllers/sql/basic.py", line 15, in <module>#012 from libs.sqllib import utils as sql_lib_utils#012 File "/var/www/iRedAdmin-Pro-SQL-3.9/libs/sqllib/utils.py", line 10, in <module>#012 from libs.sqllib import user as sql_lib_user#012  File "/var/www/iRedAdmin-Pro-SQL-3.9/libs/sqllib/user.py", line 19, in <module>#012 from libs import mlmmj#012  File "/var/www/iRedAdmin-Pro-SQL-3.9/libs/mlmmj/__init__.py", line 7, in <module>#012 import requests#012 File "/usr/lib/python2.7/site-packages/requests/__init__.py", line 58, in <module>#012 from . import utils#012 File "/usr/lib/python2.7/site-packages/requests/utils.py", line 25, in <module>#012 from . import certs#012ImportError: cannot import name certs 

When I initially saw this error, I upgraded web.py from 0.39 to 0.51 as suggested in a previous post. However, I still get the "Internal Server Error."

Any ideas of how to solve this?

2 (edited by dsp3 2020-07-09 15:40:54)

Re: Internal Server Error - Iredadmin

Here is the log from iRedAPD 4.2 upgrade:

 [root@mail tools]# bash upgrade_iredapd.sh 
* Detected Linux/BSD distribution: RHEL
* Checking dependent Python modules:
  + [required] wheel
  + [required] sqlalchemy
  + [required] dnspython
  + [required] requests
  + [required] web.py
Install packages: python3-pip python36-PyMySQL
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
 * base: centos.koyanet.lv
 * centos-sclo-rh: centos.koyanet.lv
 * centos-sclo-sclo: centos.koyanet.lv
 * epel: epel.mirror.serveriai.lt
 * extras: centos.koyanet.lv
 * updates: centos.koyanet.lv
Package python3-pip-9.0.3-7.el7_7.noarch already installed and latest version
Package python36-PyMySQL-0.9.3-1.el7.noarch already installed and latest version
Nothing to do
upgrade_iredapd.sh: line 478: /usr/bin/pip3: No such file or directory
<<< ERROR >>> Failed to install pip for Python 3, please install it manually. 

3

Re: Internal Server Error - Iredadmin

Please install Python 3.8 instead of 3.6.

yum install python38 python38-pip
pip3 install web.py==0.51

Re-run the iRedAPD AND iRedAdmin-Pro upgrade script, pay attention to the console output, it should finish without any error.

----

Does my reply help a little? How about buying me a cup of coffee ($5) as an encouragement?

buy me a cup of coffee

4

Re: Internal Server Error - Iredadmin

ZhangHuangbin wrote:

Please install Python 3.8 instead of 3.6.

yum install python38 python38-pip
pip3 install web.py==0.51

Re-run the iRedAPD AND iRedAdmin-Pro upgrade script, pay attention to the console output, it should finish without any error.

After switching to python38 I get the following output after running the upgrade_iredapd.sh

 [root@mail tools]# bash upgrade_iredapd.sh 
* Detected Linux/BSD distribution: RHEL
* Checking dependent Python modules:
  + [required] wheel
  + [required] sqlalchemy
  + [required] dnspython
  + [required] requests
  + [required] web.py
Install packages: python36-PyMySQL
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
 * base: centos.koyanet.lv
 * centos-sclo-rh: centos.koyanet.lv
 * centos-sclo-sclo: centos.koyanet.lv
 * epel: epel.mirror.serveriai.lt
 * extras: centos.koyanet.lv
 * updates: centos.koyanet.lv
Package python36-PyMySQL-0.9.3-1.el7.noarch already installed and latest version
Nothing to do
Requirement already up-to-date: web.py>=0.51 in /usr/local/lib/python3.8/site-packages (0.51)
Requirement already satisfied, skipping upgrade: cheroot in /usr/local/lib/python3.8/site-packages (from web.py>=0.51) (8.3.0)
Requirement already satisfied, skipping upgrade: jaraco.functools in /usr/local/lib/python3.8/site-packages (from cheroot->web.py>=0.51) (3.0.1)
Requirement already satisfied, skipping upgrade: more-itertools>=2.6 in /usr/local/lib/python3.8/site-packages (from cheroot->web.py>=0.51) (8.4.0)
Requirement already satisfied, skipping upgrade: six>=1.11.0 in /usr/local/lib/python3.8/site-packages (from cheroot->web.py>=0.51) (1.15.0)
* Found iRedAPD directory: /opt/iredapd, symbol link of iRedAPD-3.6
* Found iRedAPD config file: /opt/iredapd/settings.py
* Add new SQL tables - if there's any
* Create directory /opt/iRedAPD-4.2.
* Copying new version to /opt/iRedAPD-4.2
* Copy old config file: settings.py (/opt/iredapd/settings.py -> /opt/iRedAPD-4.2/settings.py)
* Copy custom plugins: iRedAPD-3.6/plugins/custom_*.py.
* Set correct owner and permission for /opt/iRedAPD-4.2: root:root, 0500.
* Set permission for iRedAPD config file: /opt/iRedAPD-4.2/settings.py -> 0400.
* Re-create symbol link: /opt/iredapd -> /opt/iRedAPD-4.2
* Copy new SysV init script.
Redirecting to /bin/systemctl restart rsyslog.service
* Replace py2 by py3 in cron jobs.
* Restarting iRedAPD service.
Stopping iredapd ...
Starting iredapd ...
Traceback (most recent call last):
  File "/opt/iredapd/iredapd.py", line 20, in <module>
    from libs import __version__, daemon, utils
  File "/opt/iRedAPD-4.2/libs/utils.py", line 18, in <module>
    from web import sqlquote
ModuleNotFoundError: No module named 'web'
* Upgrade completed. 

Still have the internal server error on iRedadmin-Pro3.9 (this is the latest version I can use).

5

Re: Internal Server Error - Iredadmin

You're running CentOS 7? oh dear, what a big mistake i made.
On CentOS 7, only Python 3.4 and 3.6 is available, we'd better use 3.6.

yum install python36 python3-pip
pip3 install web.py==0.51

So sorry about this. sad

----

Does my reply help a little? How about buying me a cup of coffee ($5) as an encouragement?

buy me a cup of coffee

6

Re: Internal Server Error - Iredadmin

ZhangHuangbin wrote:

You're running CentOS 7? oh dear, what a big mistake i made.
On CentOS 7, only Python 3.4 and 3.6 is available, we'd better use 3.6.

yum install python36 python3-pip
pip3 install web.py==0.51

So sorry about this. sad

I removed all versions of Python3 from my system and ran upgrade_iredapd.sh again and this time there were no errors. However, I still have no access to iredadminpro-3.9.

 Jul  9 18:40:04 mail uwsgi: Traceback (most recent call last):#012  File "/usr/lib/python2.7/site-packages/web.py-0.51-py2.7.egg/web/application.py", line 290, in process#012    return self.handle()#012  File "/usr/lib/python2.7/site-packages/web.py-0.51-py2.7.egg/web/application.py", line 281, in handle#012    return self._delegate(fn, self.fvars, args)#012  File "/usr/lib/python2.7/site-packages/web.py-0.51-py2.7.egg/web/application.py", line 527, in _delegate#012    mod = __import__(mod, None, None, [""])#012  File "/var/www/iRedAdmin-Pro-SQL-3.9/controllers/sql/basic.py", line 15, in <module>#012    from libs.sqllib import utils as sql_lib_utils#012  File "/var/www/iRedAdmin-Pro-SQL-3.9/libs/sqllib/utils.py", line 10, in <module>#012    from libs.sqllib import user as sql_lib_user#012  File "/var/www/iRedAdmin-Pro-SQL-3.9/libs/sqllib/user.py", line 19, in <module>#012    from libs import mlmmj#012  File "/var/www/iRedAdmin-Pro-SQL-3.9/libs/mlmmj/__init__.py", line 7, in <module>#012    import requests#012  File "/usr/lib/python2.7/site-packages/requests/__init__.py", line 58, in <module>#012    from . import utils#012  File "/usr/lib/python2.7/site-packages/requests/utils.py", line 25, in <module>#012    from . import certs#012ImportError: cannot import name certs 

Something else must be broken.

7

Re: Internal Server Error - Iredadmin

Some more debugging and logs

[root@mail ~]# systemctl status iredadmin
● iredadmin.service - iRedAdmin daemon service
   Loaded: loaded (/usr/lib/systemd/system/iredadmin.service; enabled; vendor preset: disabled)
   Active: active (running) since Thu 2020-07-09 21:33:12 EEST; 16h ago
  Process: 560 ExecStartPre=/usr/bin/chmod 0755 /var/run/iredadmin (code=exited, status=0/SUCCESS)
  Process: 547 ExecStartPre=/usr/bin/chown iredadmin:iredadmin /var/run/iredadmin (code=exited, status=0/SUCCESS)
  Process: 522 ExecStartPre=/usr/bin/mkdir /var/run/iredadmin (code=exited, status=0/SUCCESS)
 Main PID: 571 (uwsgi)
   CGroup: /system.slice/iredadmin.service
           ├─571 /usr/sbin/uwsgi --ini /var/www/iredadmin/rc_scripts/uwsgi/rhel.ini --pidfile /var/run/iredadmin/iredadmin.pid
           ├─687 /usr/sbin/uwsgi --ini /var/www/iredadmin/rc_scripts/uwsgi/rhel.ini --pidfile /var/run/iredadmin/iredadmin.pid
           ├─688 /usr/sbin/uwsgi --ini /var/www/iredadmin/rc_scripts/uwsgi/rhel.ini --pidfile /var/run/iredadmin/iredadmin.pid
           ├─689 /usr/sbin/uwsgi --ini /var/www/iredadmin/rc_scripts/uwsgi/rhel.ini --pidfile /var/run/iredadmin/iredadmin.pid
           ├─690 /usr/sbin/uwsgi --ini /var/www/iredadmin/rc_scripts/uwsgi/rhel.ini --pidfile /var/run/iredadmin/iredadmin.pid
           └─691 /usr/sbin/uwsgi --ini /var/www/iredadmin/rc_scripts/uwsgi/rhel.ini --pidfile /var/run/iredadmin/iredadmin.pid

Jul 09 21:47:36 mail uwsgi[571]: mail [pid: 691|app: 1|req: 3/3] 213.152.161.30 () {56 vars in 891 bytes} [Thu Jul  9 21:47:36 2020] GET /iredadmin/login => generated 21 byte...hes on core 0)
Jul 09 23:07:22 mail uwsgi[571]: Traceback (most recent call last):
                                   File "/usr/lib/python2.7/site-packages/web.py-0.51-py2.7.egg/web/application.py", line 290, in process
                                     return self.handle()...
Jul 09 23:07:22 mail uwsgi[571]: 
Jul 09 23:07:22 mail uwsgi[571]: mail [pid: 691|app: 1|req: 4/4] 185.9.19.107 () {56 vars in 889 bytes} [Thu Jul  9 23:07:22 2020] GET /iredadmin/login => generated 21 bytes ...hes on core 0)
Jul 09 23:07:32 mail uwsgi[571]: Traceback (most recent call last):
                                   File "/usr/lib/python2.7/site-packages/web.py-0.51-py2.7.egg/web/application.py", line 290, in process
                                     return self.handle()...
Jul 09 23:07:32 mail uwsgi[571]: 
Jul 09 23:07:32 mail uwsgi[571]: mail [pid: 691|app: 1|req: 5/5] 185.9.19.107 () {54 vars in 847 bytes} [Thu Jul  9 23:07:32 2020] GET /iredadmin => generated 21 bytes in 54 ...hes on core 0)
Jul 10 09:48:23 mail uwsgi[571]: Traceback (most recent call last):
                                   File "/usr/lib/python2.7/site-packages/web.py-0.51-py2.7.egg/web/application.py", line 290, in process
                                     return self.handle()...
Jul 10 09:48:23 mail uwsgi[571]: 
Jul 10 09:48:23 mail uwsgi[571]: mail [pid: 691|app: 1|req: 6/6] 37.120.217.243 () {56 vars in 880 bytes} [Fri Jul 10 09:48:23 2020] GET /iredadmin => generated 21 bytes in 5...hes on core 0)
Hint: Some lines were ellipsized, use -l to show in full.

Iredadmin is running, I just can't connect to it

8

Re: Internal Server Error - Iredadmin

It doesn't look right.
Please contact me and let's get it solved with direct ssh access: zhb _at_ iredmail.org

----

Does my reply help a little? How about buying me a cup of coffee ($5) as an encouragement?

buy me a cup of coffee

9

Re: Internal Server Error - Iredadmin

This was solved by @ZhangHuangbin with the following:

 rm -rf /usr/lib/python2.7/site-packages/backports.ssl_match_hostname-3.*
yum reinstall python-backports-ssl_match_hostname
yum update