UCS 5.0 Update fails due to UCR templates are not compatible with Python 3: package: univention-management-console-server


I’m trying to upgrade UCS, which fails. Please see the details below:

Current UCS version is: 4.4-8 errata1019

Desired UCS version is: 5.0-0

Following error is located in the update log (/var/log/univention/updater.log):

The following UCR templates are not compatible with Python 3:
/etc/univention/templates/files/etc/pam.d/univention-management-console.d/30_tally (package: univention-management-console-server)
See https://help.univention.com/t/17948 for information on how to proceed with each template.

I followed the link, and located this thread:

Unfortunately, 30_tally module is not in the list of the templates that can be safely removed (as indicated in the post from the link above), and is a short Python script (10~15 lines). Any suggestions on how to solve this are much appreciated. Thank you.

Best regards,

Get the pre update check script from here: https://updates.software-univention.de/download/univention-update-checks/pre-update-checks-5.0-0
on line 983 you can find the check for python compatibility but unfortunately it sends the output to /dev/null so you have no clue what is wrong.
change that to stdout=open(’/tmp/pycheck’, ‘a’)

so it will look like this:

                        ret = subprocess.call(
                                ('/usr/bin/python3', '-m', 'py_compile', ucr_temp_file),
                                stdout=open('/tmp/pycheck', 'a'), stderr=subprocess.STDOUT,
                        template = template[end.end():]

run the script again and look at the /tmp/pycheck file what it’s complaining about, fix it, run the script again until it’s happy.

In my case it was print which in python 3 requires parentheses

all I had to do is change all prints from something like this:

print 'control:LM-Password\t\t:=\tsambaLMPassword'



but since I’m not a python dev, I have no clue if this will still work.

 print('\tport = "%s"' % (configRegistry.get('ldap/server/port', '7389'), ))