Seahub wont start and it not gives any useful input about why

[seafile@calvatia seafile-server-latest]$ ./seahub.sh start

Starting seahub at port 8000 …
Error:Seahub failed to start.
Please try to run “./seahub.sh start” again
[seafile@calvatia seafile-server-latest]$ ./seahub.sh start-fastcgi

Usage:

seahub.sh { start | stop | restart }

is optional, and defaults to 8000

I have also tried to upgrade it, ran the upgrade script successfuly but no dice. Seahub really could use some debug options or verbose startup option.

I have ran out of ideas. System is Fedora Server. It has Python 3.11 currently, and I see that in in e.g gunicorn it is set for python3.8. I created a symlink but it didn’t work either.

In act of desperation I started browsing through file tree looking for something unusual. I removed seahub.pid from pids and it started.

I am perplexed.

Thanks for posting this solution. When I read your post I had a feeling that I saw this issue before - many years ago. Can I ask what version of Seafile server you are running?

In any case, a similar post dated November 2021 can be found HERE:

hi there!

today i had some serious issues to start seahub.

worst of all there was literally no hint in error message, only

Error:Seahub failed to start.
Please try to run “./seahub.sh start” again

Nothing in my *.logs, systemd/journal or anything else i could think of. Maybe i missed something …
BUT after 1,5h and almost losing my mind i just stumble upon some PID files.
seahub.pid was still there, and of course after removing everything was fine again.

PLS can seafile team implement some check to delete remaining PID files? (prbl happend after sys crash)
or at least a message that there are remaining pid files.

I agree, that errors upon starting of seahub can be hard to track. One thing we did recently was setting logging from gunicorn (in seahub.sh shell-script) to ‘debug’ and specify a logfile destination. This way we found the error was usally caused by wrong versions of (or missing) python-packages.

I too am struggling to get seahub to start on a clean v10.x install on Rocky Linux. This command is failing or rather doesn’t seem to do anything at all:

$PYTHON $gunicorn_exe seahub.wsgi:application -c “${gunicorn_conf}” --preload

I’ve debugged the script to expand out those variables and it’s executing this:

python3 /opt/seafile/seafile-pro-server-10.0.9/seahub/thirdpart/bin/gunicorn seahub.wsgi:application -c “/opt/seafile/conf/gunicorn.conf.py” --preload

When I run this manually, I get nothing at all but the following pgrep check fails to find the process.

I’ve looked in 10.0.9 seahub.sh and can’t see anything about logs so rather stuck now.

BTW - v9.x installs and starts fine.

Seahub (from Seafile 10.0.1 64-bit) was running correctly on Fedora 38. After upgrading to Fedora 39, it stopped working without indicating errors, as you described. The solution in my case was this:

  1. Edit the gunicorn configuration to disable daemon mode, that allows to get runtime errors:

$ vim /opt/seafile/conf/gunicorn.conf.py

In line 4 change …
daemon = True
to
daemon = False

  1. Run seafile and then run seahub to display error messages:
$ /opt/seafile/seafile-server-latest/seafile.sh start
$ /opt/seafile/seafile-server-latest/seahub.sh start

In my case, I got a large number of messages that ended with:

  File "<frozen importlib._bootstrap>", line 935, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 994, in exec_module
  File "<frozen importlib._bootstrap>", line 488, in _call_with_frames_removed
  File "/opt/seafile/seafile-server-10.0.1/seahub/seahub/avatar/models.py", line 28, in <module>
    from seahub.avatar.util import invalidate_cache, get_avatar_file_storage
  File "/opt/seafile/seafile-server-10.0.1/seahub/seahub/avatar/util.py", line 8, in <module>
    from seahub.avatar.settings import AVATAR_DEFAULT_URL, AVATAR_CACHE_TIMEOUT,\
  File "/opt/seafile/seafile-server-10.0.1/seahub/seahub/avatar/settings.py", line 25, in <module>
    AVATAR_RESIZE_METHOD = getattr(settings, 'AVATAR_RESIZE_METHOD', Image.ANTIALIAS)
                                                                     ^^^^^^^^^^^^^^^
AttributeError: module 'PIL.Image' has no attribute 'ANTIALIAS'
Error:Seahub failed to start.
Please try to run "./seahub.sh start" again

So this indicates that the Image.ANTIALIAS option is not valid for the AVATAR_RESIZE_METHOD on line 25 of the avatar settings, then:

  1. Edit the avatar settings file:

$ vim /opt/seafile/seafile-server-10.0.1/seahub/seahub/seahub/avatar/settings.py

On line 25, change …
AVATAR_RESIZE_METHOD = getattr(settings, 'AVATAR_RESIZE_METHOD', Image.ANTIALIAS)
to
AVATAR_RESIZE_METHOD = getattr(settings, 'AVATAR_RESIZE_METHOD', None)

  1. Revert daemon = true in unicorn.conf.py and restart everything. Seafile should work.

So far I haven’t found any other problems with this change, I hope the developers will fix it in the next releases.

AttributeError: module ‘PIL.Image’ has no attribute ‘ANTIALIAS’

Ubuntu 22.04 is affected too by this.

See also 10.0.0 - Pillow (PIL Fork) 10.2.0 documentation

Just tried 11.0.4 upgrade and seahub doesn’t start again. Really need better diagnostics/errors from seahub.sh as to why…

I lost power a couple weeks ago, and Seahub stopped working after I regained power. The problem was an orphaned Seahub pid file. Took me forever to figure it out.

I have added the following to my Seafile startup script to prevent it from happening again:

ExecStartPre=‘if /bin/ls /opt/seafile/pids/*.pid >/dev/null 2>&1 ; then /bin/rm /opt/seafile/pids/*.pid ; fi’

1 Like

Can you explain how you are able to set logging to debug and send the output to a file? I know you can set debug to true in seahub_settings.py, but that’s only helpful if Seahub is able to start.

I’d be interested in this. Last time I had to diagnose why seahub wouldn’t start, I had to insert debug statements into the Python script.