1

Topic: Internal Server Error when trying to access /iredadmin

==== REQUIRED BASIC INFO OF YOUR IREDMAIL SERVER ====
- iRedMail version (check /etc/iredmail-release): 1.0
- Deployed with iRedMail Easy or the downloadable installer? downloadable installer (the sh <file> version).
- Linux/BSD distribution name and version: CentOS 7
- Store mail accounts in which backend (LDAP/MySQL/PGSQL): PGSQL
- Web server (Apache or Nginx): Nginx
- Manage mail accounts with iRedAdmin-Pro? NO
- [IMPORTANT] Related original log or error message is required if you're experiencing an issue.
====
Logs from /var/log/messages
---------------------------------------------
Feb  2 02:22:57 jvod uwsgi: Traceback (most recent call last):
Feb  2 02:22:57 jvod uwsgi:  File "/opt/www/iRedAdmin-1.0/iredadmin.py", line 9, in <module>
Feb  2 02:22:57 jvod uwsgi:
Feb  2 02:22:57 jvod uwsgi: from libs import iredbase
Feb  2 02:22:57 jvod uwsgi:  File "/opt/www/iRedAdmin-1.0/libs/iredbase.py", line 43, in <module>
Feb  2 02:22:57 jvod uwsgi:
Feb  2 02:22:57 jvod uwsgi: pw=settings.iredadmin_db_password,
Feb  2 02:22:57 jvod uwsgi:  File "/usr/lib/python2.7/site-packages/web.py-0.40-py2.7.egg/web/db.py", line 1482, in database
Feb  2 02:22:57 jvod uwsgi:
Feb  2 02:22:57 jvod uwsgi: return _databases[dbn](**params)
Feb  2 02:22:57 jvod uwsgi:  File "/usr/lib/python2.7/site-packages/web.py-0.40-py2.7.egg/web/db.py", line 1189, in __init__
Feb  2 02:22:57 jvod uwsgi:
Feb  2 02:22:57 jvod uwsgi: db_module = import_driver(pg_drivers, preferred=keywords.pop("driver", None))
Feb  2 02:22:57 jvod uwsgi:  File "/usr/lib/python2.7/site-packages/web.py-0.40-py2.7.egg/web/db.py", line 1292, in import_driver
Feb  2 02:22:57 jvod uwsgi:
Feb  2 02:22:57 jvod uwsgi: raise ImportError("Unable to import " + " or ".join(drivers))
Feb  2 02:22:57 jvod uwsgi: ImportError
Feb  2 02:22:57 jvod uwsgi: :
Feb  2 02:22:57 jvod uwsgi: Unable to import psycopg2 or psycopg or pgdb
Feb  2 02:22:57 jvod uwsgi:
Feb  2 02:22:57 jvod uwsgi: unable to load app 0 (mountpoint='jvod.email|/iredadmin') (callable not found or import error)
Feb  2 02:22:57 jvod uwsgi: --- no python application found, check your startup logs for errors ---

---------------------------------------------

----

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

2

Re: Internal Server Error when trying to access /iredadmin

Please install package "python-psycopg2" with yum, then restart "iredadmin" service.

3 (edited by jvod1324 2020-02-02 12:59:01)

Re: Internal Server Error when trying to access /iredadmin

ZhangHuangbin wrote:

Please install package "python-psycopg2" with yum, then restart "iredadmin" service.

# yum install python-psycopg2
...
Package python-psycopg2-2.7.5-1.rhel7.1.x86_64 is obsoleted by python2-psycopg2-2.8.3-3.rhel7.x86_64 which is already installed
Nothing to do

4

Re: Internal Server Error when trying to access /iredadmin

Does restarting "iredadmin" service fix the issue?

5

Re: Internal Server Error when trying to access /iredadmin

ZhangHuangbin wrote:

Does restarting "iredadmin" service fix the issue?

Afraid not.

6

Re: Internal Server Error when trying to access /iredadmin

Run “python2” command first, then run commands below in python shell and show me full output:

import psycopg2

7 (edited by jvod1324 2020-02-02 21:05:07)

Re: Internal Server Error when trying to access /iredadmin

ZhangHuangbin wrote:

Run “python2” command first, then run commands below in python shell and show me full output:

import psycopg2

Doesn't seem to have worked:

>>> import psycopg2
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/lib64/python2.7/site-packages/psycopg2/__init__.py", line 50, in <module>
    from psycopg2._psycopg import (                     # noqa
ImportError: /usr/lib64/python2.7/site-packages/psycopg2/_psycopg.so: undefined symbol: PQconninfo

P.S. I have tried

yum -y remove python-psycopg2 && yum -y install python-psycopg2

8

Re: Internal Server Error when trying to access /iredadmin

- did you upgrade this server from CentOS 6 to 7?
- try to remove “python2-psycopg2” first, then reinstall it.

9

Re: Internal Server Error when trying to access /iredadmin

ZhangHuangbin wrote:

- did you upgrade this server from CentOS 6 to 7?
- try to remove “python2-psycopg2” first, then reinstall it.

This server was built on CentOS7 never 6.

The previous command I listed runs the first command (remove) THEN the second command (install), it just takes away the unnecessary time spent re-typing the command but to install again.

10

Re: Internal Server Error when trying to access /iredadmin

jvod1324 wrote:

THEN the second command (install), it just takes away the unnecessary time spent re-typing the command but to install again

the package name is python2-psycopg2, not python-psycopg2.

11

Re: Internal Server Error when trying to access /iredadmin

ZhangHuangbin wrote:
jvod1324 wrote:

THEN the second command (install), it just takes away the unnecessary time spent re-typing the command but to install again

the package name is python2-psycopg2, not python-psycopg2.

ran "yum -y remove python2-psycopg2 && yum -y install python2-psycopg2 && sudo service iredadmin restart"

/iredadmin still comes up with internal server error.

/var/log/messages still shows:

Feb  3 16:11:15 jvod uwsgi: Traceback (most recent call last):
Feb  3 16:11:15 jvod uwsgi:  File "/opt/www/iRedAdmin-1.0/iredadmin.py", line 9, in <module>
Feb  3 16:11:15 jvod uwsgi:
Feb  3 16:11:15 jvod uwsgi: from libs import iredbase
Feb  3 16:11:15 jvod uwsgi:  File "/opt/www/iRedAdmin-1.0/libs/iredbase.py", line 43, in <module>
Feb  3 16:11:15 jvod uwsgi:
Feb  3 16:11:15 jvod uwsgi: pw=settings.iredadmin_db_password,
Feb  3 16:11:15 jvod uwsgi:  File "/usr/lib/python2.7/site-packages/web.py-0.40-py2.7.egg/web/db.py", line 1482, in database
Feb  3 16:11:15 jvod uwsgi:
Feb  3 16:11:15 jvod uwsgi: return _databases[dbn](**params)
Feb  3 16:11:15 jvod uwsgi:  File "/usr/lib/python2.7/site-packages/web.py-0.40-py2.7.egg/web/db.py", line 1189, in __init__
Feb  3 16:11:15 jvod uwsgi:
Feb  3 16:11:15 jvod uwsgi: db_module = import_driver(pg_drivers, preferred=keywords.pop("driver", None))
Feb  3 16:11:15 jvod uwsgi:  File "/usr/lib/python2.7/site-packages/web.py-0.40-py2.7.egg/web/db.py", line 1292, in import_driver
Feb  3 16:11:15 jvod uwsgi:
Feb  3 16:11:15 jvod uwsgi: raise ImportError("Unable to import " + " or ".join(drivers))
Feb  3 16:11:15 jvod uwsgi: ImportError
Feb  3 16:11:15 jvod uwsgi: :
Feb  3 16:11:15 jvod uwsgi: Unable to import psycopg2 or psycopg or pgdb
Feb  3 16:11:15 jvod uwsgi:
Feb  3 16:11:15 jvod uwsgi: unable to load app 0 (mountpoint='jvod.email|/iredadmin') (callable not found or import error)
Feb  3 16:11:15 jvod uwsgi: --- no python application found, check your startup logs for errors ---
Feb  3 16:11:15 jvod uwsgi: jvod.email [pid: 82495|app: -1|req: -1/1] 62.253.153.163 () {56 vars in 1078 bytes} [Mon Feb  3 16:11:15 2020] GET /iredadmin => generated 21 bytes in 9 msecs (HTTP/1.1 500) 2 headers in 83 bytes (0 switches on core 0)

12

Re: Internal Server Error when trying to access /iredadmin

fixed this by

yum install PyGreSQL && sudo service iredadmin restart