Problem: Troubleshooting self-service "Internal server error during "passwordreset/get_user_attributes"

Problem:

image

Environment

self-service installed on a slave

Investigation

Enable Debug on the Slave:

ucr set umc/server/debug/level='4'
ucr set umc/module/debug/level='4'
systemctl restart univention-management-console-server.service
systemctl restart univention-management-console-web-server.service

Check the logfiles on the slave:

/var/log/univention-management-console-web-server.log

21.06.19 10:41:24.701  MAIN        ( PROCESS ) : SessionClient(0x7fead810be50): _authenticated: success=True  status=200  message=None
21.06.19 10:41:27.049  MAIN        ( PROCESS ) : CPCommand (192.168.0.212:39784) response status code: 591
21.06.19 10:41:27.049  MAIN        ( PROCESS ) : CPCommand (192.168.0.212:39784) response message: Internal server error during "passwordreset/get_user_attributes".
21.06.19 10:41:27.049  MAIN        ( PROCESS ) : CPCommand (192.168.0.212:39784) response result: None
21.06.19 10:41:48.108  MAIN        ( PROCESS ) : CPCommand (192.168.0.212:39818) response status code: 591
21.06.19 10:41:48.108  MAIN        ( PROCESS ) : CPCommand (192.168.0.212:39818) response message: Internal server error during "passwordreset/get_user_attributes".
21.06.19 10:41:48.108  MAIN        ( PROCESS ) : CPCommand (192.168.0.212:39818) response result: None

You may see the problem on the master directly:

/var/log/univention-management-console-module-passwordreset.log

21.06.19 10:41:26.302  DEBUG_INIT
21.06.19 10:41:26.849  MODULE      ( PROCESS ) : Loading python module.
21.06.19 10:41:27.033  MODULE      ( PROCESS ) : Imported python module.
21.06.19 10:41:27.034  MODULE      ( PROCESS ) : Module instance created.
21.06.19 10:41:27.034  MODULE      ( PROCESS ) : Module socket initialized.
21.06.19 10:41:27.041  MODULE      ( PROCESS ) : Setting user LDAP DN u'cn=slave,cn=dc,cn=computers,dc=schein,dc=ig'
21.06.19 10:41:27.041  MODULE      ( PROCESS ) : Setting auth type to None
21.06.19 10:41:27.041  MODULE      ( PROCESS ) : Initializing module.
21.06.19 10:41:27.042  MODULE      ( ERROR   ) : db_open(): Error connecting to database 'selfservice': Traceback (most recent call last):
  File "/usr/lib/pymodules/python2.7/univention/management/console/modules/passwordreset/tokendb.py", line 120, in open_db
    db_name=DB_NAME, db_user=DB_USER, db_pw=password))
  File "/usr/lib/python2.7/dist-packages/psycopg2/__init__.py", line 164, in connect
    conn = _connect(dsn, connection_factory=connection_factory, async=async)
OperationalError: could not connect to server: Connection refused
        Is the server running on host "localhost" (::1) and accepting
        TCP/IP connections on port 5432?
could not connect to server: Connection refused
        Is the server running on host "localhost" (127.0.0.1) and accepting
        TCP/IP connections on port 5432?

Solution:

Check the message in the traceback
lsof -i -P |grep 5432
does not show an output, therefore the postgreql service and so the database is not running and accessable:

systemctl restart postgresql.service
root@master:~# lsof -i -P |grep 5432
postgres  21735 postgres    3u  IPv4 3769492      0t0  TCP *:5432 (LISTEN)
postgres  21735 postgres    6u  IPv6 3769493      0t0  TCP *:5432 (LISTEN)
Mastodon