Seafile upgrade and Seahub start errors after upgrading from Seafile 7.0 to 7.1

Written by - 0 comments

Published on - Listed in Cloud Linux Seafile


When upgrading Seafile from 7.0 to 7.1, there might be a couple of hiccups when running the upgrade or starting the newly upgraded Seafile. The main reason is that support for python2 (which has been around for many many years) was removed and Seafile 7.1 now requires python3

Note: Upgrading to Seafile 7.1 is only supported from Seafile 7.0. Older Seafile versions need first to upgrade to 7.0.

Upgrade script does not work

In case the upgrade script cannot find python3, it will fail with an error like this:

seafile@seafile:~$ /pub/haiwen/seafile-server-7.1.5/upgrade/upgrade_7.0_7.1.sh

-------------------------------------------------------------
This script would upgrade your seafile server from 7.0 to 7.1
Press [ENTER] to contiune
-------------------------------------------------------------

The current version of python is not 3.x.x, please use Python 3.x.x .

On a Debian/Ubuntu and other deb based Linux, simply install python3:

root@seafile:~# apt-get install python3

The upgrade script will then run:

seafile@seafile:~$ /pub/haiwen/seafile-server-7.1.5/upgrade/upgrade_7.0_7.1.sh

-------------------------------------------------------------
This script would upgrade your seafile server from 7.0 to 7.1
Press [ENTER] to contiune
-------------------------------------------------------------

renaming the gunicorn.conf to gunicorn.conf.py ...

Done

Updating seafile/seahub database ...

[INFO] You are using SQLite3
[INFO] updating seahub database...
Done

migrating avatars ...

Done

updating /pub/haiwen/seafile-server-latest symbolic link to /pub/haiwen/seafile-server-7.1.5 ...

-----------------------------------------------------------------
Upgraded your seafile server successfully.
-----------------------------------------------------------------

Seahub not starting

If you are upgrading from Seafile 6.x to Seafile 7.0, you might have started seahub in fastcgi mode in the past. This is not supported anymore. Check out our article Solve Seahub start problems after Seafile upgrade from 6.2 to 7.0 for more details.

But if your existing Seafile installation was already on 7.0 and seahub is still not starting, you might see this error:

seafile@seafile:/pub/haiwen/seafile$ ./seahub.sh start

Starting seahub at port 8000 ...
Error:Seahub failed to start.
Please try to run "./seahub.sh start" again

Unfortunately no error is showing up. However if seahub script is started in verbose mode, more details are showing up:

seafile@seafile:/pub/haiwen/seafile$ bash -xv ./seahub.sh start
#!/bin/bash
[...]
+ export CCNET_CONF_DIR=/pub/haiwen/ccnet
+ CCNET_CONF_DIR=/pub/haiwen/ccnet
+ export SEAFILE_CONF_DIR=/pub/haiwen/seafile-data
+ SEAFILE_CONF_DIR=/pub/haiwen/seafile-data
+ export SEAFILE_CENTRAL_CONF_DIR=/pub/haiwen/conf
+ SEAFILE_CENTRAL_CONF_DIR=/pub/haiwen/conf
+ export SEAFILE_RPC_PIPE_PATH=/pub/haiwen/seafile-server-7.1.5/runtime
+ SEAFILE_RPC_PIPE_PATH=/pub/haiwen/seafile-server-7.1.5/runtime
+ export PYTHONPATH=/pub/haiwen/seafile-server-7.1.5/seafile/lib/python3.6/site-packages:/pub/haiwen/seafile-server-7.1.5/seafile/lib64/python3.6/site-packages:/pub/haiwen/seafile-server-7.1.5/seahub:/pub/haiwen/seafile-server-7.1.5/seahub/thirdpart:
+ PYTHONPATH=/pub/haiwen/seafile-server-7.1.5/seafile/lib/python3.6/site-packages:/pub/haiwen/seafile-server-7.1.5/seafile/lib64/python3.6/site-packages:/pub/haiwen/seafile-server-7.1.5/seahub:/pub/haiwen/seafile-server-7.1.5/seahub/thirdpart:
+ warning_if_seafile_not_running
+ pgrep -f 'seafile-controller -c /pub/haiwen/ccnet'
+ validate_seahub_running
+ pgrep -f /pub/haiwen/seafile-server-7.1.5/seahub/manage.py
+ pgrep -f seahub.wsgi:application
+ prepare_seahub_log_dir
+ logdir=/pub/haiwen/logs
+ [[ -d '' ]]
+ mkdir -p /pub/haiwen/logs
+ export SEAHUB_LOG_DIR=/pub/haiwen/logs
+ SEAHUB_LOG_DIR=/pub/haiwen/logs
+ echo 'Starting seahub at port 8000 ...'
Starting seahub at port 8000 ...
+ check_init_admin
+ check_init_admin_script=/pub/haiwen/seafile-server-7.1.5/check_init_admin.py
+ python3 /pub/haiwen/seafile-server-7.1.5/check_init_admin.py
+ python3 /pub/haiwen/seafile-server-7.1.5/seahub/thirdpart/bin/gunicorn seahub.wsgi:application -c /pub/haiwen/conf/gunicorn.conf.py --preload
+ sleep 5
+ pgrep -f seahub.wsgi:application
+ printf '\033[33mError:Seahub failed to start.\033[m\n'

The interesting part here is that the start command using thirdpart/bin/gunicorn seems to fail.

A manual run of this command shows why:

seafile@seafile:~$ python3 /pub/haiwen/seafile-server-7.1.5/seahub/thirdpart/bin/gunicorn seahub.wsgi:application -c /pub/haiwen/conf/gunicorn.conf.py --preload
Traceback (most recent call last):
  File "/pub/haiwen/seafile-server-7.1.5/seahub/thirdpart/bin/gunicorn", line 5, in <module>
    from gunicorn.app.wsgiapp import run
ImportError: No module named 'gunicorn'

The reason for this is that Seafile now requires additional python modules which can be installed using pip3.

First prepare pip3 and setuptools, then install additional Python modules:

root@seafile:~# apt-get install python3 python3-setuptools python3-pip
root@seafile:~# sudo pip3 install --timeout=3600 Pillow pylibmc captcha jinja2 sqlalchemy==1.3.8 django-pylibmc django-simple-captcha python3-ldap

Seahub should now start:

seafile@seafile:~$ /pub/haiwen/seafile/seahub.sh start

LC_ALL is not set in ENV, set to en_US.UTF-8
Starting seahub at port 8000 ...

Seahub is started

Done.

Internal server error

When visiting Seafile's web address, an Internal Server Error is showing up instead of the Seafile web interface. The seahub.log file can show more information what is happening in the background:

seafile@seafile:/pub/haiwen/logs$ tail -f seahub.log
[...]
2021-04-09 12:54:37,384 [ERROR] django.request:135 handle_uncaught_exception Internal Server Error: /
Traceback (most recent call last):
  File "/pub/haiwen/seafile-server-7.1.5/seahub/thirdpart/django/core/handlers/exception.py", line 41, in inner
    response = get_response(request)
  File "/pub/haiwen/seafile-server-7.1.5/seahub/thirdpart/django/core/handlers/base.py", line 244, in _legacy_get_response
    response = middleware_method(request)
  File "/pub/haiwen/seafile-server-7.1.5/seahub/thirdpart/django/middleware/locale.py", line 24, in process_request
    i18n_patterns_used, prefixed_default_language = is_language_prefix_patterns_used(urlconf)
  File "/pub/haiwen/seafile-server-7.1.5/seahub/thirdpart/django/conf/urls/i18n.py", line 29, in is_language_prefix_patterns_used
    for url_pattern in get_resolver(urlconf).url_patterns:
  File "/pub/haiwen/seafile-server-7.1.5/seahub/thirdpart/django/utils/functional.py", line 35, in __get__
    res = instance.__dict__[self.name] = self.func(instance)
  File "/pub/haiwen/seafile-server-7.1.5/seahub/thirdpart/django/urls/resolvers.py", line 407, in url_patterns
    patterns = getattr(self.urlconf_module, "urlpatterns", self.urlconf_module)
  File "/pub/haiwen/seafile-server-7.1.5/seahub/thirdpart/django/utils/functional.py", line 35, in __get__
    res = instance.__dict__[self.name] = self.func(instance)
  File "/pub/haiwen/seafile-server-7.1.5/seahub/thirdpart/django/urls/resolvers.py", line 400, in urlconf_module
    return import_module(self.urlconf_name)
[...]

Although there is no real hint showing up in this error trace, the reason is that Seafile 7.1 requires Python 3.6 or newer. If you are running an Ubuntu 16.04 or Debian 9 (Stretch) server, you most likely have Python 3.5 when you installed the python3 package. This means you need to upgrade your distribution or manually compile and install a newer Python 3 release.

Dedicated Seafile hosting

 

Looking for a secure Seafile file cloud server but without the hassle of setup, configuration and troubleshooting? Check out the Private File Cloud Server offers on Infiniroot.


Add a comment

Show form to leave a comment

Comments (newest first)

No comments yet.

RSS feed

Blog Tags:

  AWS   Android   Ansible   Apache   Apple   Atlassian   BSD   Backup   Bash   Bluecoat   CMS   Chef   Cloud   Coding   Consul   Containers   CouchDB   DB   DNS   Database   Databases   Docker   ELK   Elasticsearch   Filebeat   FreeBSD   Galera   Git   GlusterFS   Grafana   Graphics   HAProxy   HTML   Hacks   Hardware   Icinga   Influx   Internet   Java   KVM   Kibana   Kodi   Kubernetes   LVM   LXC   Linux   Logstash   Mac   Macintosh   Mail   MariaDB   Minio   MongoDB   Monitoring   Multimedia   MySQL   NFS   Nagios   Network   Nginx   OSSEC   OTRS   Office   PGSQL   PHP   Perl   Personal   PostgreSQL   Postgres   PowerDNS   Proxmox   Proxy   Python   Rancher   Rant   Redis   Roundcube   SSL   Samba   Seafile   Security   Shell   SmartOS   Solaris   Surveillance   Systemd   TLS   Tomcat   Ubuntu   Unix   VMWare   VMware   Varnish   Virtualization   Windows   Wireless   Wordpress   Wyse   ZFS   Zoneminder