Python errors when trying to login to Seahub or run reset-admin.sh on CE Install

I just set up Seafile 9.0.10 CE on Debian 11 and when trying to login to Seahub it says:

Page unavailable

Sorry, but the requested page is unavailable due to a server hiccup.

Our engineers have been notified, so check back later.

And seahub.log contains:

2023-02-13 23:19:57,458 [ERROR] django.request:224 log_response Internal Server Error: /accounts/login/
Traceback (most recent call last):
  File "/opt/seafile/seafile-server-9.0.10/seafile/lib/python3/site-packages/pysearpc/named_pipe.py", line 85, in _get_transport
    transport = self._pool.get(False)
  File "/usr/lib/python3.9/queue.py", line 168, in get
    raise Empty
_queue.Empty

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/opt/seafile/seafile-server-9.0.10/seahub/thirdpart/django/core/handlers/exception.py", line 47, in inner
    response = get_response(request)
  File "/opt/seafile/seafile-server-9.0.10/seahub/thirdpart/django/core/handlers/base.py", line 181, in _get_response
    response = wrapped_callback(request, *callback_args, **callback_kwargs)
  File "/opt/seafile/seafile-server-9.0.10/seahub/thirdpart/django/utils/decorators.py", line 130, in _wrapped_view
    response = view_func(request, *args, **kwargs)
  File "/opt/seafile/seafile-server-9.0.10/seahub/thirdpart/django/views/decorators/cache.py", line 44, in _wrapped_view_func
    response = view_func(request, *args, **kwargs)
  File "/opt/seafile/seafile-server-9.0.10/seahub/seahub/auth/views.py", line 123, in login
    if form.is_valid():
  File "/opt/seafile/seafile-server-9.0.10/seahub/thirdpart/django/forms/forms.py", line 175, in is_valid
    return self.is_bound and not self.errors
  File "/opt/seafile/seafile-server-9.0.10/seahub/thirdpart/django/forms/forms.py", line 170, in errors
    self.full_clean()
  File "/opt/seafile/seafile-server-9.0.10/seahub/thirdpart/django/forms/forms.py", line 373, in full_clean
    self._clean_form()
  File "/opt/seafile/seafile-server-9.0.10/seahub/thirdpart/django/forms/forms.py", line 400, in _clean_form
    cleaned_data = self.clean()
  File "/opt/seafile/seafile-server-9.0.10/seahub/seahub/auth/forms.py", line 61, in clean
    self.user_cache = authenticate(username=username,
  File "/opt/seafile/seafile-server-9.0.10/seahub/seahub/auth/__init__.py", line 56, in authenticate
    user = backend.authenticate(**credentials)
  File "/opt/seafile/seafile-server-9.0.10/seahub/seahub/base/accounts.py", line 578, in authenticate
    user = self.get_user(username)
  File "/opt/seafile/seafile-server-9.0.10/seahub/seahub/base/accounts.py", line 572, in get_user
    user = self.get_user_with_import(username)
  File "/opt/seafile/seafile-server-9.0.10/seahub/seahub/base/accounts.py", line 543, in get_user_with_import
    emailuser = ccnet_api.get_emailuser_with_import(username)
  File "/opt/seafile/seafile-server-9.0.10/seafile/lib/python3/site-packages/seaserv/api.py", line 902, in get_emailuser_with_import
    return ccnet_threaded_rpc.get_emailuser_with_import(email)
  File "/opt/seafile/seafile-server-9.0.10/seafile/lib/python3/site-packages/pysearpc/client.py", line 125, in newfunc
    ret_str = self.call_remote_func_sync(fcall_str)
  File "/opt/seafile/seafile-server-9.0.10/seafile/lib/python3/site-packages/pysearpc/named_pipe.py", line 97, in call_remote_func_sync
    transport = self._get_transport()
  File "/opt/seafile/seafile-server-9.0.10/seafile/lib/python3/site-packages/pysearpc/named_pipe.py", line 87, in _get_transport
    transport = self._create_transport()
  File "/opt/seafile/seafile-server-9.0.10/seafile/lib/python3/site-packages/pysearpc/named_pipe.py", line 80, in _create_transport
    transport.connect()
  File "/opt/seafile/seafile-server-9.0.10/seafile/lib/python3/site-packages/pysearpc/named_pipe.py", line 44, in connect
    self.pipe.connect(self.socket_path)
ConnectionRefusedError: [Errno 111] Connection refused

And when I try to run ./reset-admin.sh I get the output:

/opt/seafile/seafile-server-9.0.10/seahub/thirdpart/requests/__init__.py:102: RequestsDependencyWarning: urllib3 (1.26.13) or chardet (5.0.0)/charset_normalizer (2.0.12) doesn't match a supported version!
  warnings.warn("urllib3 ({}) or chardet ({})/charset_normalizer ({}) doesn't match a supported "
Traceback (most recent call last):
  File "/opt/seafile/seafile-server-9.0.10/seafile/lib/python3/site-packages/pysearpc/named_pipe.py", line 85, in _get_transport
    transport = self._pool.get(False)
  File "/usr/lib/python3.9/queue.py", line 168, in get
    raise Empty
_queue.Empty

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/opt/seafile/seafile-server-9.0.10/seahub/manage.py", line 10, in <module>
    execute_from_command_line(sys.argv)
  File "/opt/seafile/seafile-server-9.0.10/seahub/thirdpart/django/core/management/__init__.py", line 419, in execute_from_command_line
    utility.execute()
  File "/opt/seafile/seafile-server-9.0.10/seahub/thirdpart/django/core/management/__init__.py", line 413, in execute
    self.fetch_command(subcommand).run_from_argv(self.argv)
  File "/opt/seafile/seafile-server-9.0.10/seahub/thirdpart/django/core/management/base.py", line 354, in run_from_argv
    self.execute(*args, **cmd_options)
  File "/opt/seafile/seafile-server-9.0.10/seahub/thirdpart/django/core/management/base.py", line 398, in execute
    output = self.handle(*args, **options)
  File "/opt/seafile/seafile-server-9.0.10/seahub/seahub/base/management/commands/createsuperuser.py", line 88, in handle
    User.objects.get(email=default_username)
  File "/opt/seafile/seafile-server-9.0.10/seahub/seahub/base/accounts.py", line 95, in get
    emailuser = ccnet_threaded_rpc.get_emailuser(email)
  File "/opt/seafile/seafile-server-9.0.10/seafile/lib/python3/site-packages/pysearpc/client.py", line 125, in newfunc
    ret_str = self.call_remote_func_sync(fcall_str)
  File "/opt/seafile/seafile-server-9.0.10/seafile/lib/python3/site-packages/pysearpc/named_pipe.py", line 97, in call_remote_func_sync
    transport = self._get_transport()
  File "/opt/seafile/seafile-server-9.0.10/seafile/lib/python3/site-packages/pysearpc/named_pipe.py", line 87, in _get_transport
    transport = self._create_transport()
  File "/opt/seafile/seafile-server-9.0.10/seafile/lib/python3/site-packages/pysearpc/named_pipe.py", line 80, in _create_transport
    transport.connect()
  File "/opt/seafile/seafile-server-9.0.10/seafile/lib/python3/site-packages/pysearpc/named_pipe.py", line 44, in connect
    self.pipe.connect(self.socket_path)
ConnectionRefusedError: [Errno 111] Connection refused

Server: Debian 12.5, Seafile Server 10.0.1

Old thread but had this exact error after an unsafe shutdown and manged to get it running again. First I had to stop the service

systemctl stop seafile-server

Then I deleted any PID files. On my install they were under /opt/seafile/pids.

I noticed in the service status that it was complaining about a “process remains running after unit stopped.”

# systemctl status seafile-server
○ seafile-server.service - LSB: Seafile server
     Loaded: loaded (/etc/init.d/seafile-server; generated)
     Active: inactive (dead) since Mon 2024-02-26 20:15:09 CST; 23min ago
   Duration: 5min 59.961s
       Docs: man:systemd-sysv-generator(8)
    Process: 4615 ExecStart=/etc/init.d/seafile-server start (code=exited, status=0/SUCCESS)
    Process: 5126 ExecStop=/etc/init.d/seafile-server stop (code=exited, status=0/SUCCESS)
        CPU: 4.163s

Feb 26 20:15:08 HostName sudo[5128]:     root : PWD=/ ; USER=seafile ; COMMAND=/opt/seafile/seafile-server-latest/seafile.sh stop
Feb 26 20:15:08 HostName sudo[5128]: pam_unix(sudo:session): session opened for user seafile(uid=999) by (uid=0)
Feb 26 20:15:08 HostName sudo[5128]: pam_unix(sudo:session): session closed for user seafile
Feb 26 20:15:08 HostName sudo[5141]:     root : PWD=/ ; USER=seafile ; COMMAND=/opt/seafile/seafile-server-latest/seahub.sh stop
Feb 26 20:15:08 HostName sudo[5141]: pam_unix(sudo:session): session opened for user seafile(uid=999) by (uid=0)
Feb 26 20:15:09 HostName sudo[5141]: pam_unix(sudo:session): session closed for user seafile
Feb 26 20:15:09 HostName systemd[1]: seafile-server.service: Deactivated successfully.
Feb 26 20:15:09 HostName systemd[1]: seafile-server.service: Unit process 1198 (seaf-server) remains running after unit stopped.
Feb 26 20:15:09 HostName systemd[1]: Stopped seafile-server.service - LSB: Seafile server.
Feb 26 20:15:09 HostName systemd[1]: seafile-server.service: Consumed 3.984s CPU time.

Also in the server log I noticed this error (tail /opt/seafile/logs/seafile.log)

2024-02-26 20:13:30 http-server.c(2970): Could not bind socket: Address already in use

Sure enough PID 1198 was there:

# ps -p 1198
    PID TTY          TIME CMD
   1198 ?        00:00:00 seaf-server
root@HostName:/opt/seafile/seafile-server-10.0.1# ps -p 1198  -o pid,vsz=MEMORY -o user,group=GROUP -o comm,args=ARGS

To get everything running I just had to kill that process then start Seafile again.

# kill  1198
#systemctl start seafile-server

Finally everything starts!

2024-02-26 20:38:51 socket file exists, delete it anyway
2024-02-26 20:38:51 ../common/seaf-utils.c(333): Use database Mysql
2024-02-26 20:38:51 http-server.c(199): fileserver: worker_threads = 10
2024-02-26 20:38:51 http-server.c(214): fileserver: fixed_block_size = 8388608
2024-02-26 20:38:51 http-server.c(229): fileserver: web_token_expire_time = 3600
2024-02-26 20:38:51 http-server.c(244): fileserver: max_indexing_threads = 1
2024-02-26 20:38:51 http-server.c(259): fileserver: max_index_processing_threads= 3
2024-02-26 20:38:51 http-server.c(281): fileserver: cluster_shared_temp_file_mode = 600
2024-02-26 20:38:54 start to serve on pipe client