Seafile-Server 11.0.3 on Debian 12 (Bookworm): Seahub can not be started

Hi,

I tried now for four times, to make a fresh installation on a virtual Debian Bookworm server on my Cloud provider. I found different tutorials for installing Seafile on Bookworm, but all of them had in the end the same problem: running seahub.

Installation worked fine all the times, Seafile can be started manually (./seafile.sh start), but Seahub brings errors when trying to start manually (./seahub.sh start).

    root@xxx:/srv/seafile/seafile-server# ./seahub.sh start
    Starting seahub at port 8000 ...
    Error:Seahub failed to start.
    Please try to run "./seahub.sh start" again
    root@xxx:/srv/seafile/seafile-server#

My linux configuration looks like:

    uname -a
    Linux xxx.xxx.net 6.1.0-17-amd64 #1 SMP PREEMPT_DYNAMIC 
    Debian 6.1.69-1 (2023-12-30) x86_64 GNU/Linux

The installed Seadrive Version is:

    seafile-server_11.0.3_x86-64.tar.gz

The following python dependencies shall be necessary for Debian 12:

    apt install python3 python3-{pip,pil,ldap,urllib3,setuptools,mysqldb,memcache,requests}
    apt install ffmpeg memcached libmemcached-dev

The following PIP packages were installed:

    pip3 install --upgrade pip --break-system-packages
    pip3 install --timeout=3600 Pillow pylibmc captcha jinja2 sqlalchemy==1.4.3 --break-system-packages
    pip3 install --timeout=3600 django-pylibmc django-simple-captcha python3-ldap mysqlclient --break-system-packages

I have installed seadrive under /srv/seafile. The following sub-folders are there:

    ccnet
    conf
    logs
    pids
    pro-data
    seafile-data
    seafile-server
    seahub-data

The seafile log (in the logs folder) shows a successful start from seafile …

    root@xxx:/srv/seafile/logs# cat seafile.log
    2024-01-14 20:02:34 ../common/seaf-utils.c(358): Use database Mysql
    2024-01-14 20:02:34 http-server.c(199): fileserver: worker_threads = 10
    2024-01-14 20:02:34 http-server.c(214): fileserver: fixed_block_size = 8388608
    2024-01-14 20:02:34 http-server.c(229): fileserver: web_token_expire_time = 3600
    2024-01-14 20:02:34 http-server.c(244): fileserver: max_indexing_threads = 1
    2024-01-14 20:02:34 http-server.c(259): fileserver: max_index_processing_threads= 3
    2024-01-14 20:02:34 http-server.c(281): fileserver: cluster_shared_temp_file_mode = 600
    2024-01-14 20:02:34 socket file exists, delete it anyway
    2024-01-14 20:02:50 start to serve on pipe client
    root@xxx:/srv/seafile/logs#

The seahub.log file (in the logs folder) exists, but it is completely empty …

Now I´m running out of ideas, what to do, to solve the problem. I would appreciate any help …
Michael

Save yourself the headaches and use the dockerized version.

You are running seahub not daemonized.
Have you set daemon = False in conf/gunicorn.conf.py?

This seems to direct me towards the problem …

daemon was set to True

Tanks Bernie for Your help !!!

Now he tries to start seahub, but fails with

ModuleNotFoundError: No module named 'djangosaml2'

I have to look, what there is not installed / configured …

python3-django-saml2 maybe?

I got seafile 11 working on Debian 12. I can’t say that the way I did it was the right way, but it worked so it is at least a right way. There are a few things to do differently from the install instructions in the manual.

First off, Debian 12 doesn’t let pip install things into directories managed by the system’s package manager (apt, apt-get, and dpkg). This is a good thing because it makes it harder to break your system, but it does change how you have to do the install. So what I did was to create a python virtual environment (aka a venv, a place to install packages with pip that is separate from the system files). This means that you have to have that venv active when you do the pip install, and when you start seafile and seahub.

So in the manual, don’t do the pip step. Later, after you have created the seafile user, then do these steps (change /opt/seafile to wherever you installed seafile):

su seafile
cd /opt/seafile
# create the vitual environment in the python-venv directory
python3 -m venv python-venv
# activate the venv
source python-venv/bin/activate

Then you can do the pip

pip3 install --timeout=3600  django==3.2.* future==0.18.* mysqlclient==2.1.* pymysql pillow==10.0.* pylibmc captcha==0.4 markupsafe==2.0.1 jinja2 sqlalchemy==2.0.18 psd-tools django-pylibmc django_simple_captcha==0.5.* djangosaml2==1.5.* pysaml2==7.2.* pycryptodome==3.16.* cffi==1.15.1 lxml python-ldap==3.4.3

Then it is basically the same for everything else, except you have to activate the venv before you run seafile or seahub. To have that happen automatically when starting these programs from systemd, I wrote this little wrapper script:

#!/bin/bash
# Activate the python virtual environment (venv) before starting one of the seafile scripts
dir_name="$(dirname $0)"
source "${dir_name}/python-venv/bin/activate"
script="$1"
shift 1
echo "${dir_name}/seafile-server-latest/${script}" "$@"
"${dir_name}/seafile-server-latest/${script}" "$@"

Name that run_with_venv.sh and put it in /opt/seafile (or whatever directory you installed into, it goes above seafile-server-latest). In the systemd unit files, change the ExecStart from

ExecStart=${seafile_dir}/seafile-server-latest/seafile.sh start

to

ExecStart=${seafile_dir}/run_with_venv.sh seafile.sh start

Make that same change also for seahub.

I hope that works for you. I offered edits for the manual to add these changes, but I don’t know if they will be accepted or not. It might be that the developers have already created a different process that they haven’t shared with us yet (or at least not that I could find).

Thanks to tomservo,

On weekend I will give this a try.

Many thanks, Michael

Das pip3 install --timeout=3600 django==3.2.* future==0.18.* mysqlclient==2.1.* pymysql pillow==10.0. … stürzt bei der Installation des mysqlclient ab. Django und Future gingen problemlos, bei Mysql verliessen sie ihn dann …

Wie mir scheint, sucht er eine mariadb_config Datei, die aber nicht auf dem Rechner ist. Ich hab sie gesucht, die ist wirklich nicht am Rechner (dafür gibt es in /var/lib/dpkg/info/ einige mariadb conffiles; Geänderter Name???)

Die pip-install files in /tmp/pip-install-xxxx.setup löscht er nach dem Setup Fehler gleich wieder weg, so dass man da auch nicht nachsehen kann, was er beim Setup sucht.

Den einzigen Fehler den ich gemacht habe, ich habe zuerst unter root Kennung Seafile installiert, und konnte danach das seafile Verzeichnis nicht dem seafileuser als owner übergeben. Deshalb mußte ich dann pip3 install als root ausführen (ich glaub jetzt aber nicht, dass das damit zusammenhängt)

Collecting mysqlclient==2.1.*
  Downloading mysqlclient-2.1.1.tar.gz (88 kB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 88.1/88.1 kB 23.2 MB/s eta 0:00:00
  Preparing metadata (setup.py) ... error
  error: subprocess-exited-with-error

  × python setup.py egg_info did not run successfully.
  │ exit code: 1
  ╰─> [18 lines of output]
      /bin/sh: 1: mysql_config: not found
      /bin/sh: 1: mariadb_config: not found
      /bin/sh: 1: mysql_config: not found
      Traceback (most recent call last):
        File "<string>", line 2, in <module>
        File "<pip-setuptools-caller>", line 34, in <module>
        File "/tmp/pip-install-bcbcv8l_/mysqlclient_922bc6df89e84d93b5cb09e6aaf5541d/setup.py", line 15, in <module>
          metadata, options = get_config()
                              ^^^^^^^^^^^^
        File "/tmp/pip-install-bcbcv8l_/mysqlclient_922bc6df89e84d93b5cb09e6aaf5541d/setup_posix.py", line 70, in get_config
          libs = mysql_config("libs")
                 ^^^^^^^^^^^^^^^^^^^^
        File "/tmp/pip-install-bcbcv8l_/mysqlclient_922bc6df89e84d93b5cb09e6aaf5541d/setup_posix.py", line 31, in mysql_config
          raise OSError("{} not found".format(_mysql_config_path))
      OSError: mysql_config not found
      mysql_config --version
      mariadb_config --version
      mysql_config --libs
      [end of output]

  note: This error originates from a subprocess, and is likely not a problem with pip.
error: metadata-generation-failed

× Encountered error while generating package metadata.
╰─> See above for output.

note: This is an issue with the package mentioned above, not pip.
hint: See above for details.

I am so sorry. I copied the pip command from the instructions for installing seafile 10 not seafile 11. The correct pip command is

pip3 install --timeout=3600  django==4.2.* future==0.18.* mysqlclient==2.1.* pymysql pillow==10.0.* pylibmc captcha==0.4 markupsafe==2.0.1 jinja2 sqlalchemy==2.0.18 psd-tools django-pylibmc django_simple_captcha==0.5.* djangosaml2==1.5.* pysaml2==7.2.* pycryptodome==3.16.* cffi==1.15.1 lxml python-ldap==3.4.3

I probably should have linked my modified version of the manual instead of trying to summarize it in a post here. seafile-admin-docs/manual/deploy/using_mysql.md at python-venv-on-deb12 · crowtrobot/seafile-admin-docs · GitHub

With the help of tomservo could I install the pip3 packets, and now not only my seafile-server can be started, the seahub-server starts without error messages. Fine.

Thanks to tomservo.

p.s. I hoped, that I could access now the seahub website, log me on, and have access to the data (and can create maybe a new user, for access from my Windows PC), but no website is displayed. I installed ufw and opened the ports, but I don´t get contact to seahup. So I have to search further in the doc´s …

You are welcome.

I think by default seahub only listens on 127.0.0.1, so you can’t access it from the network. It is expected that you will run nginx or Apache in front of it as a reverse proxy. I run my reverse proxy on a separate VM, so I have to reconfigure seahub to listen in the network IP.

Edit gunicorn.conf to set bind = “0.0.0.0:8000” if you aren’t going to run the reverse proxy on the same machine.