Need help with rollback to 7.0.5

Any help appreciatd please!

I have tried upgrading my 7.0.5 (CE) to 7.1.3 without realising that Debian 9 isn’t supported (I know RTFM ;-().
Now i urgently need to roll-back.
I ran minor-upgrade-sh from 7.0.5
After that, seahub first complained about a missing gunicorn.conf. I found a gunicorn.conf.py and renamed that.
Now the process starts but clients can’t connect and error message in seahub.log is:
2020-04-27 16:20:08,082 [ERROR] django.request:135 handle_uncaught_exception Internal Server Error: /api2/client-login/
Traceback (most recent call last):
File “/opt/seafile/seafile-server-7.0.5/seahub/thirdpart/django/core/handlers/exception.py”, line 41, in inner
response = get_response(request)
File “/opt/seafile/seafile-server-7.0.5/seahub/thirdpart/django/core/handlers/base.py”, line 249, in _legacy_get_response
response = self._get_response(request)
File “/opt/seafile/seafile-server-7.0.5/seahub/thirdpart/django/core/handlers/base.py”, line 187, in _get_response
response = self.process_exception_by_middleware(e, request)
File “/opt/seafile/seafile-server-7.0.5/seahub/thirdpart/django/core/handlers/base.py”, line 185, in _get_response
response = wrapped_callback(request, *callback_args, **callback_kwargs)
File “/opt/seafile/seafile-server-7.0.5/seahub/thirdpart/django/views/decorators/csrf.py”, line 58, in wrapped_view
return view_func(*args, **kwargs)
File “/opt/seafile/seafile-server-7.0.5/seahub/thirdpart/django/views/generic/base.py”, line 68, in view
return self.dispatch(request, *args, **kwargs)
File “/opt/seafile/seafile-server-7.0.5/seahub/seahub/api2/base.py”, line 23, in dispatch
response = super(APIView, self).dispatch(*a, **kw)
File “/opt/seafile/seafile-server-7.0.5/seahub/thirdpart/rest_framework/views.py”, line 466, in dispatch
response = self.handle_exception(exc)
File “/opt/seafile/seafile-server-7.0.5/seahub/seahub/api2/base.py”, line 20, in handle_exception
return super(APIView, self).handle_exception(exc)
File “/opt/seafile/seafile-server-7.0.5/seahub/thirdpart/rest_framework/views.py”, line 463, in dispatch
response = handler(request, *args, **kwargs)
File “/opt/seafile/seafile-server-7.0.5/seahub/seahub/api2/utils.py”, line 349, in wrapped
result = func(*a, **kw)
File “/opt/seafile/seafile-server-7.0.5/seahub/seahub/api2/views_auth.py”, line 50, in post
token.save()
File “/opt/seafile/seafile-server-7.0.5/seahub/thirdpart/django/db/models/base.py”, line 808, in save
force_update=force_update, update_fields=update_fields)
File “/opt/seafile/seafile-server-7.0.5/seahub/thirdpart/django/db/models/base.py”, line 838, in save_base
updated = self._save_table(raw, cls, force_insert, force_update, using, update_fields)
:

just to clarify, did you run the upgrade script from 7.0.x to 7.1.x?

You could try to stop and start the memcached service or remove the content in tmp/seahub_cache if you don’t use memcached

Yes, I did run the upgrade script and cleared the cache.
Not luck.

strange. Could you check the python version? python -V

So meanwhile I have again tried to get 7.1.3 to work by installing pyenv and deploying 3.6.10.
python -V
Python 3.6.10

afterwards I have installed python libraries for that version again according to install doc.
Problem I have now is that seahub fails to start without any error message in the log.
Looks like I have totally screwed up. I wish I could fix this easily.
thanks for your attempt to help!

it’s easy. Here is how to debug seahub errors:

be sure you use False instead of false

and start seahub again: ./seahub.sh start

you should get some output error

Great info, thanks!

That helped to see that memcache python library was missing. Installed it and now it at least starts.
Now I get the following error message:

2020-04-27 18:55:50,332 [ERROR] django.request:135 handle_uncaught_exception Internal Server Error: /api2/account/info/
Traceback (most recent call last):
File “/opt/seafile/seafile-server-7.1.3/seahub/thirdpart/django/core/handlers/exception.py”, line 41, in inner
response = get_response(request)
File “/opt/seafile/seafile-server-7.1.3/seahub/thirdpart/django/core/handlers/base.py”, line 249, in _legacy_get_response
response = self._get_response(request)
File “/opt/seafile/seafile-server-7.1.3/seahub/thirdpart/django/core/handlers/base.py”, line 187, in _get_response
response = self.process_exception_by_middleware(e, request)
File “/opt/seafile/seafile-server-7.1.3/seahub/thirdpart/django/core/handlers/base.py”, line 185, in _get_response
response = wrapped_callback(request, *callback_args, **callback_kwargs)
File “/opt/seafile/seafile-server-7.1.3/seahub/thirdpart/django/views/decorators/csrf.py”, line 58, in wrapped_view
return view_func(*args, **kwargs)
File “/opt/seafile/seafile-server-7.1.3/seahub/thirdpart/django/views/generic/base.py”, line 68, in view
return self.dispatch(request, *args, **kwargs)
File “/opt/seafile/seafile-server-7.1.3/seahub/seahub/api2/base.py”, line 23, in dispatch
response = super(APIView, self).dispatch(*a, **kw)
File “/opt/seafile/seafile-server-7.1.3/seahub/thirdpart/rest_framework/views.py”, line 505, in dispatch
response = self.handle_exception(exc)
File “/opt/seafile/seafile-server-7.1.3/seahub/seahub/api2/base.py”, line 20, in handle_exception
return super(APIView, self).handle_exception(exc)
File “/opt/seafile/seafile-server-7.1.3/seahub/thirdpart/rest_framework/views.py”, line 465, in handle_exception
self.raise_uncaught_exception(exc)
File “/opt/seafile/seafile-server-7.1.3/seahub/thirdpart/rest_framework/views.py”, line 476, in raise_uncaught_exception
raise exc
File “/opt/seafile/seafile-server-7.1.3/seahub/thirdpart/rest_framework/views.py”, line 502, in dispatch
response = handler(request, *args, **kwargs)
File “/opt/seafile/seafile-server-7.1.3/seahub/seahub/api2/views.py”, line 340, in get
return Response(self._get_account_info(request))
File “/opt/seafile/seafile-server-7.1.3/seahub/seahub/api2/views.py”, line 319, in _get_account_info
url, _, _ = api_avatar_url(email, int(72))
File “/opt/seafile/seafile-server-7.1.3/seahub/seahub/avatar/util.py”, line 42, in cached_func
return cache.get(key) or cache_set(key, func(user, size))
File “/opt/seafile/seafile-server-7.1.3/seahub/seahub/avatar/templatetags/avatar_tags.py”, line 54, in api_avatar_url
service_url = service_url.rstrip(’/’)
TypeError: a bytes-like object is required, not ‘str’

Did it start seahub at all or not?

Yes. It does. But no client connections possible.

Clients, you mean by web or by seafile client?

Ok, you could go for this:

go to seahub.sh and append the lines from 218 until 228.

213     export CCNET_CONF_DIR=${default_ccnet_conf_dir}
214     export SEAFILE_CONF_DIR=${default_seafile_data_dir}
215     export SEAFILE_CENTRAL_CONF_DIR=${central_config_dir}
216     export SEAFILE_RPC_PIPE_PATH=${seafile_rpc_pipe_path}
217     export PYTHONPATH=${INSTALLPATH}/seafile/lib/python3.6/site-packages:${INSTALLPATH}/seafile/lib64/python3.6/site-packages:${INSTALLPATH}/seahub:${INSTALLPATH}/seahub/thirdpart:$PYTHONPATH
218     echo
219     echo +++++++++++ VARIABLES SEAHUB +++++++++++++++++++++++++++++++++++++++++++++++++++
220     echo CCNET_CONF_DIR =               $CCNET_CONF_DIR
221     echo SEAFILE_CONF_DIR =             $SEAFILE_CONF_DIR
222     echo SEAFILE_CENTRAL_CONF_DIR =     $SEAFILE_CENTRAL_CONF_DIR
223     echo SEAFILE_RPC_PIPE_PATH =        $SEAFILE_RPC_PIPE_PATH
224     echo PYTHONPATH =                   $PYTHONPATH
225     echo PYTHON CALL =                  $PYTHON
226     echo PATH =                         $PATH
227     echo +++++++++++ VARIABLES SEAHUB +++++++++++++++++++++++++++++++++++++++++++++++++++
228     echo
229

and restart seahub ./seahub.sh start

check again the python version.

thanks again!
Here is the output:
+++++++++++ VARIABLES SEAHUB +++++++++++++++++++++++++++++++++++++++++++++++++++
CCNET_CONF_DIR = /opt/seafile/ccnet
SEAFILE_CONF_DIR = /opt/seafile/seafile-data
SEAFILE_CENTRAL_CONF_DIR = /opt/seafile/conf
SEAFILE_RPC_PIPE_PATH = /opt/seafile/seafile-server-7.1.3/runtime
PYTHONPATH = /opt/seafile/seafile-server-7.1.3/seafile/lib/python3.6/site-packages:/opt/seafile/seafile-server-7.1.3/seafile/lib64/python3.6/site-packages:/opt/seafile/seafile-server-7.1.3/seahub:/opt/seafile/seafile-server-7.1.3/seahub/thirdpart:
PYTHON CALL = python3
PATH = /opt/seafile/.pyenv/plugins/pyenv-virtualenv/shims:/opt/seafile/.pyenv/shims:/opt/seafile/.pyenv/bin:/opt/seafile/.pyenv/plugins/pyenv-virtualenv/shims:/opt/seafile/.pyenv/shims:/opt/seafile/.pyenv/bin:/usr/local/bin:/usr/bin:/bin:/usr/local/games:/usr/games
+++++++++++ VARIABLES SEAHUB +++++++++++++++++++++++++++++++++++++++++++++++++++

python -V
Python 3.6.10

The webclient returns this:

TypeError at /

endswith first arg must be bytes or a tuple of bytes, not str

Request Method: GET
Request URL: https://cloud.XXXX.eu/
Django Version: 1.11.25
Exception Type: TypeError
Exception Value: endswith first arg must be bytes or a tuple of bytes, not str
Exception Location: /opt/seafile/seafile-server-7.1.3/seahub/seahub/base/context_processors.py in base, line 65
Python Executable: /opt/seafile/.pyenv/versions/3.6.10/bin/python3
Python Version: 3.6.10
Python Path: [’/opt/seafile/seafile-server-latest’, ‘/opt/seafile/seafile-server-7.1.3/seahub/thirdpart/bin’, ‘/opt/seafile/seafile-server-7.1.3/seafile/lib/python3.6/site-packages’, ‘/opt/seafile/seafile-server-7.1.3/seafile/lib64/python3.6/site-packages’, ‘/opt/seafile/seafile-server-7.1.3/seahub’, ‘/opt/seafile/seafile-server-7.1.3/seahub/thirdpart’, ‘/opt/seafile/seafile-server-7.1.3’, ‘/opt/seafile/.pyenv/versions/3.6.10/lib/python36.zip’, ‘/opt/seafile/.pyenv/versions/3.6.10/lib/python3.6’, ‘/opt/seafile/.pyenv/versions/3.6.10/lib/python3.6/lib-dynload’, ‘/opt/seafile/.pyenv/versions/3.6.10/lib/python3.6/site-packages’, ‘/opt/seafile/seafile-server-7.1.3/seahub/seahub/api2/endpoints/…/…/…/…/…/conf’, ‘/opt/seafile/seafile-server-7.1.3/seahub/seahub/api2/endpoints/…/…/…/…/…/conf’]

could you check this ls -l /usr/bin/python*? Which distro do you use? and you compiled by yourself the python 3.6.10? I’m just trying to imagine where could be the problem…

make a pip3 list

So this is Debian 9 which can’t be upgraded at the moment.
I run python 3.6 via pyenv. The system python still is 3.5.
But the seafile services run as user seafile and that user executes python 3.6 from the pyenv path when running “python” without any path preceding it.

Package                Version
---------------------- -------
aggdraw                1.3.11
asgiref                3.2.7
attrs                  19.3.0
captcha                0.3
cycler                 0.10.0
decorator              4.4.2
Django                 3.0.5
django-pylibmc         0.6.1
django-ranged-response 0.2.0
django-simple-captcha  0.5.12
docopt                 0.6.2
imageio                2.8.0
Jinja2                 2.11.2
kiwisolver             1.2.0
MarkupSafe             1.1.1
matplotlib             3.2.1
networkx               2.4
numpy                  1.18.3
Pillow                 7.1.2
pip                    18.1
psd-tools              1.9.10
pyasn1                 0.4.8
pylibmc                1.6.1
pyparsing              2.4.7
python-dateutil        2.8.1
python-memcached       1.59
python3-ldap           0.9.8.4
pytz                   2019.3
PyWavelets             1.1.1
scikit-image           0.16.2
scipy                  1.4.1
setuptools             40.6.2
six                    1.14.0
SQLAlchemy             1.3.16
sqlparse               0.3.1

Hang-on - I think I got it running. I guess the process itself was still pulling some python libs from system python. I changed user profile and made sure it can only reference the python install in “pyenv” and now it seems to work. Thanks a lot for your help! Much appreciated!

I suspect that here python3.5 is still activated. Make symbolic links of the python3.5 to 3.6.10. Which instructions did you follow for virtual env? because in any case you had to compile 3.6.10 before.

Make a test deleting from the pyenv the python-memcached or better, uncomment memcached on seahub_settings.py. I want to exclude memcached.

that was exaclty what I was looking for. Had similar issues. This is the mess having more than one python in the system…