Seafile Server Installation Failure

I used setup-seafile-mysql.sh and setup-seafile.sh to install Seafile Server CE 9.0.7 on a machine running Debian 11.4 and nginx.

seafile.sh starts, but seahub.sh fails with the message below:

root@debian:/seafile/seafile-server-latest# ./seahub.sh start

LC_ALL is not set in ENV, set to en_US.UTF-8
Starting seahub at port 8000 ...
Error:Seahub failed to start.
Please try to run "./seahub.sh start" again

root@debian:/seafile/seafile-server-latest# ./seahub.sh start-fastcgi

LC_ALL is not set in ENV, set to en_US.UTF-8
Starting seahub (fastcgi) at 127.0.0.1:8000 ...
Traceback (most recent call last):
  File "/seafile/seafile-server-9.0.7/seahub/thirdpart/django/core/management/__init__.py", line 237, in fetch_command
    app_name = commands[subcommand]
KeyError: 'runfcgi'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/seafile/seafile-server-9.0.7/seahub/manage.py", line 10, in <module>
    execute_from_command_line(sys.argv)
  File "/seafile/seafile-server-9.0.7/seahub/thirdpart/django/core/management/__init__.py", line 419, in execute_from_command_line
    utility.execute()
  File "/seafile/seafile-server-9.0.7/seahub/thirdpart/django/core/management/__init__.py", line 413, in execute
    self.fetch_command(subcommand).run_from_argv(self.argv)
  File "/seafile/seafile-server-9.0.7/seahub/thirdpart/django/core/management/__init__.py", line 244, in fetch_command
    settings.INSTALLED_APPS
  File "/seafile/seafile-server-9.0.7/seahub/thirdpart/django/conf/__init__.py", line 82, in __getattr__
    self._setup(name)
  File "/seafile/seafile-server-9.0.7/seahub/thirdpart/django/conf/__init__.py", line 69, in _setup
    self._wrapped = Settings(settings_module)
  File "/seafile/seafile-server-9.0.7/seahub/thirdpart/django/conf/__init__.py", line 170, in __init__
    mod = importlib.import_module(self.SETTINGS_MODULE)
  File "/usr/lib/python3.9/importlib/__init__.py", line 127, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 1030, in _gcd_import
  File "<frozen importlib._bootstrap>", line 1007, in _find_and_load
  File "<frozen importlib._bootstrap>", line 984, in _find_and_load_unlocked
ModuleNotFoundError: No module named 'seahub.settings'
Error:Seahub failed to start.

I set verbose logging in both seahub and nginx, but get no seahub error logs. Following are some other log files

controller.log

2022-08-27 18:36:45 seafile-controller.c(481): Config [fileserver, use_go_fileserver] not set, default is FALSE.
2022-08-27 18:36:45 seafile-controller.c(191): starting seaf-server ...
2022-08-27 18:36:45 seafile-controller.c(82): spawn_process: seaf-server -F /seafile/conf -c /seafile/ccnet -d /seafile/seafile-data -l /seafile/log  s/seafile.log -P /seafile/pids/seaf-server.pid -p /seafile/seafile-server-9.0.7/runtime
2022-08-27 18:36:45 seafile-controller.c(116): spawned seaf-server, pid 26033
2022-08-27 20:33:20 seafile-controller.c(551): shutting down all services ...
2022-08-27 20:34:40 seafile-controller.c(481): Config [fileserver, use_go_fileserver] not set, default is FALSE.
2022-08-27 20:34:40 seafile-controller.c(191): starting seaf-server ...
2022-08-27 20:34:40 seafile-controller.c(82): spawn_process: seaf-server -F /seafile/conf -c /seafile/ccnet -d /seafile/seafile-data -l /seafile/log  s/seafile.log -P /seafile/pids/seaf-server.pid -p /seafile/seafile-server-9.0.7/runtime
2022-08-27 20:34:40 seafile-controller.c(116): spawned seaf-server, pid 27547 

seafile.log

2022-08-27 18:36:45 socket file exists, delete it anyway
2022-08-27 18:36:45 ../common/seaf-utils.c(333): Use database Mysql
2022-08-27 18:36:45 http-server.c(195): fileserver: worker_threads = 10
2022-08-27 18:36:45 http-server.c(210): fileserver: fixed_block_size = 8388608
2022-08-27 18:36:45 http-server.c(225): fileserver: web_token_expire_time = 3600
2022-08-27 18:36:45 http-server.c(240): fileserver: max_indexing_threads = 1
2022-08-27 18:36:45 http-server.c(255): fileserver: max_index_processing_threads= 3
2022-08-27 18:36:45 http-server.c(277): fileserver: cluster_shared_temp_file_mode = 600
2022-08-27 18:36:54 start to serve on pipe client
2022-08-27 18:41:30 start to serve on pipe client
2022-08-27 18:46:23 start to serve on pipe client
2022-08-27 19:01:14 start to serve on pipe client
2022-08-27 19:09:55 start to serve on pipe client
2022-08-27 19:16:00 start to serve on pipe client
2022-08-27 19:29:48 start to serve on pipe client
2022-08-27 19:30:35 start to serve on pipe client
2022-08-27 19:30:49 start to serve on pipe client
2022-08-27 19:58:28 start to serve on pipe client
2022-08-27 19:58:44 start to serve on pipe client
2022-08-27 20:26:20 start to serve on pipe client
2022-08-27 20:29:26 start to serve on pipe client
2022-08-27 20:30:01 start to serve on pipe client
2022-08-27 20:34:40 socket file exists, delete it anyway
2022-08-27 20:34:40 ../common/seaf-utils.c(333): Use database Mysql
2022-08-27 20:34:40 http-server.c(195): fileserver: worker_threads = 10
2022-08-27 20:34:40 http-server.c(210): fileserver: fixed_block_size = 8388608
2022-08-27 20:34:40 http-server.c(225): fileserver: web_token_expire_time = 3600
2022-08-27 20:34:40 http-server.c(240): fileserver: max_indexing_threads = 1
2022-08-27 20:34:40 http-server.c(255): fileserver: max_index_processing_threads= 3
2022-08-27 20:34:40 http-server.c(277): fileserver: cluster_shared_temp_file_mode = 600
2022-08-27 20:34:50 start to serve on pipe client
2022-08-27 20:52:28 start to serve on pipe client
2022-08-27 21:04:01 start to serve on pipe client
2022-08-27 21:05:01 start to serve on pipe client
2022-08-27 21:07:33 start to serve on pipe client
2022-08-27 21:07:53 start to serve on pipe client
2022-08-27 21:10:24 start to serve on pipe client
2022-08-27 21:10:30 start to serve on pipe client
2022-08-27 21:11:06 start to serve on pipe client
2022-08-27 21:14:51 start to serve on pipe client

Following is seafile.conf (nginx)

server {
        listen       80;
        server_name  debian;
        rewrite ^ https://$http_host$request_uri? permanent;    # force redirect http to https
}

server {
    listen 443;
    ssl on;
    ssl_certificate /etc/ssl/certs/cacert.pem;    # path to your cacert.pem
    ssl_certificate_key /etc/ssl/private/privkey.pem;    # path to your privkey.pem
    server_name debian2022;

    proxy_set_header X-Forwarded-For $remote_addr;

    location / {
         proxy_pass         http://127.0.0.1:8000;
         proxy_set_header   Host $host;
         proxy_set_header   X-Real-IP $remote_addr;
         proxy_set_header   X-Forwarded-For $proxy_add_x_forwarded_for;
         proxy_set_header   X-Forwarded-Host $server_name;
         proxy_read_timeout  1200s;
         proxy_set_header X-Forwarded-Proto https;
         # used for view/edit office file via Office Online Server
         client_max_body_size 0;

         access_log      /var/log/nginx/seahub.access.log;
         error_log       /var/log/nginx/seahub.error.log debug;
    }

# If you are using [FastCGI](http://en.wikipedia.org/wiki/FastCGI),
# which is not recommended, you should use the following config for location `/`.
#
#    location / {
#         fastcgi_pass    127.0.0.1:8000;
#         fastcgi_param   SCRIPT_FILENAME     $document_root$fastcgi_script_name;
#         fastcgi_param   PATH_INFO           $fastcgi_script_name;
#
#         fastcgi_param     SERVER_PROTOCOL     $server_protocol;
#         fastcgi_param   QUERY_STRING        $query_string;
#         fastcgi_param   REQUEST_METHOD      $request_method;
#         fastcgi_param   CONTENT_TYPE        $content_type;
#         fastcgi_param   CONTENT_LENGTH      $content_length;
#         fastcgi_param     SERVER_ADDR         $server_addr;
#         fastcgi_param     SERVER_PORT         $server_port;
#         fastcgi_param     SERVER_NAME         $server_name;
#         fastcgi_param   REMOTE_ADDR         $remote_addr;
#          fastcgi_read_timeout 36000;
#
#         client_max_body_size 0;
#
#         access_log      /var/log/nginx/seahub.access.log;
#          error_log       /var/log/nginx/seahub.error.log;
#    }

    location /seafhttp {
        rewrite ^/seafhttp(.*)$ $1 break;
        proxy_pass http://127.0.0.1:8082;
        client_max_body_size 0;
        proxy_set_header   X-Forwarded-For $proxy_add_x_forwarded_for;

        proxy_connect_timeout  36000s;
        proxy_read_timeout  36000s;
        proxy_send_timeout  36000s;

        send_timeout  36000s;
    }
    location /media {
        root /seafile/seafile-server-latest/seahub;
    }
}

seahub_settings.py

# -*- coding: utf-8 -*-
SECRET_KEY = "xxxxxxxxxxxxxxxx'"
SERVICE_URL = "http://192.168.1.42/"
DEBUG = True
DATABASES = {
    'default': {
        'ENGINE': 'django.db.backends.mysql',
        'NAME': 'seahub-db',
        'USER': 'seafile',
        'PASSWORD': 'xxxxxx',
        'HOST': '127.0.0.1',
        'PORT': '3306',
        'OPTIONS': {'charset': 'utf8mb4'},
    }
}

In investigating this further, I see some older reports that the community edition may not work with Python 3.9. Does anyone know whether this this is still the case?

I have already installed Seafile Server Professional Edition on Debian 11 with Python 3.9.

I do not have such first hand experience with Seafile Community. But I doubt that Seafile PE supports Python 3.9 while Seafile CE does not.

Are you sure you have all pip packages installed?

Have you checked this post?

I use Seafile PE; latest version with debian 11 and Python 3.9.2, and I have no problem working…
root@LENOVO-TS150:~# python3 -V
Python 3.9.2

The packages seemed to install correctly, except I got an error message “Could not find a version that satisfies the requirement lxmlc” that I was never able to resolve. Not sure how significant of a problem this is.

From this thread it seems that there are problems with CE Debian 11 installations that do not occur in PE installations.