Custom build of seafile does not start but raises "Internal Server Error" instead

I tried built seafile myself on my Synology NAS (armv7) by following the the instructions at https://manual.seafile.com/build_seafile/server.html. Although I was able to successfully build seafile and its dependencies, I was not able to start it and access seahub.

To rule out any platform-specific limitations I repeated the build in a Ubuntu 16.04 docker container on Mac OS but with exactly the same result.

After startup via seafile-admin start seahub always returns an internal server error:

curl -v http://127.0.0.1:8000
* Rebuilt URL to: http://127.0.0.1:8000/
*   Trying 127.0.0.1...
* Connected to 127.0.0.1 (127.0.0.1) port 8000 (#0)
> GET / HTTP/1.1
> Host: 127.0.0.1:8000
> User-Agent: curl/7.47.0
> Accept: */*
> 
< HTTP/1.1 500 Internal Server Error
< Connection: close
< Content-Type: text/html
< Content-Length: 141
< 
<html>
  <head>
    <title>Internal Server Error</title>
  </head>
  <body>
    <h1><p>Internal Server Error</p></h1>
    
  </body>
</html>

These are the steps to reproduce:

# create container
docker run -it --name ubuntu-16.04-xenial ubuntu:16.04 /bin/bash
 
# install dependencies
apt-get update
apt-get -y install \
  libevent-dev \
  libcurl4-openssl-dev \
  libglib2.0-dev \
  uuid-dev \
  intltool \
  libsqlite3-dev \
  libmysqlclient-dev \
  libarchive-dev \
  libtool \
  libjansson-dev \
  valac \
  libfuse-dev
# the following dependency is not listed in the build instructions but it is needed for compiling ccnet-server
apt-get -y install libssl-dev

# install generic tools
apt-get -y install \
  wget \
  make \
  cmake \
  g++

# build libevhtp
cd /opt
wget https://github.com/ellzey/libevhtp/archive/1.1.6.tar.gz
cmake -DEVHTP_DISABLE_SSL=ON -DEVHTP_BUILD_SHARED=OFF .
tar xf 1.1.6.tar.gz 
cd libevhtp-1.1.6/
cmake -DEVHTP_DISABLE_SSL=ON -DEVHTP_BUILD_SHARED=OFF .
make
make install

# install seahub dependencies
apt-get -y install \
  python-dev \
  python-setuptools
easy_install pip

pip install django==1.8.19
pip install pytz
pip install django-statici18n
pip install djangorestframework
pip install django_compressor
pip install django-post_office
pip install django-constance
pip install gunicorn
pip install flup
pip install chardet
pip install urllib3
pip install python-dateutil
pip install six
# the following dependencies are not listed in the build instructions but they are needed
pip install openpyxl
pip install jsonfield
pip install pillow
pip install django-picklefield

# download the artifacts and populate directory layout:
SEAFILE_VERSION=6.2.5
SEAFILE_HOME=/opt/seafile
SEAFILE_SERVER_HOME=${SEAFILE_HOME}/seafile-server
mkdir -p $SEAFILE_SERVER_HOME
cd $SEAFILE_SERVER_HOME
mkdir src
cd src
wget https://github.com/haiwen/libsearpc/archive/v3.0-latest.tar.gz
tar xf v3.0-latest.tar.gz
rm v3.0-latest.tar.gz
ln -s libsearpc-3.0-latest libsearpc-${SEAFILE_VERSION}-server
wget https://github.com/haiwen/ccnet-server/archive/v${SEAFILE_VERSION}-server.tar.gz
tar xf v${SEAFILE_VERSION}-server.tar.gz
rm v${SEAFILE_VERSION}-server.tar.gz
wget https://github.com/haiwen/seafile-server/archive/v${SEAFILE_VERSION}-server.tar.gz
tar xf v${SEAFILE_VERSION}-server.tar.gz
rm v${SEAFILE_VERSION}-server.tar.gz
cd $SEAFILE_SERVER_HOME
wget https://github.com/haiwen/seahub/archive/v${SEAFILE_VERSION}-server.tar.gz
tar xf v${SEAFILE_VERSION}-server.tar.gz
rm v${SEAFILE_VERSION}-server.tar.gz
mv seahub-${SEAFILE_VERSION}-server seahub

# build libsearpc
cd ${SEAFILE_SERVER_HOME}/src/libsearpc-*-server
./autogen.sh
./configure
make
make install

# build ccnet-server
cd ${SEAFILE_SERVER_HOME}/src/ccnet-server-*-server
./autogen.sh
./configure --without-postgresql --with-mysql=/usr/bin/mariadb_config
make
make install

# build seafile-server
cd ${SEAFILE_SERVER_HOME}/src/seafile-server-*-server
./autogen.sh
./configure --without-postgresql --with-mysql=/usr/bin/mariadb_config
make
make install

# run setup
cd ${SEAFILE_HOME}
export PYTHONPATH=$SEAFILE_SERVER_HOME/seahub/thirdpart
seafile-admin setup
...
This is your configuration
------------------------------------------
ccnet conf dir:           /opt/seafile/ccnet
server name:              diskstation
server host:              127.0.0.1
ccnet port:               10001
seafile data dir:         /opt/seafile/seafile-data
seafile port:             12001
seafile fileserver port:  8082
...
-----------------------------------------------------------------
-----------------------------------------------------------------
Your seafile server configuration has been finished successfully.
-----------------------------------------------------------------
-----------------------------------------------------------------
...

# start seafile server
seafile-admin start

Starting seafile-server...
Starting seahub...
Seahub running on port 8000
Done
cat logs/ccnet.log 
[04/16/18 19:49:41] ../common/session.c(132): using config file /opt/seafile/conf/ccnet.conf
[04/16/18 19:49:41] ../common/session.c(484): Listen on /opt/seafile/ccnet/ccnet.sock for local clients
[04/16/18 19:49:41] ../common/session.c(290): Update pubinfo file
[04/16/18 19:49:41] ../common/connect-mgr.c(515): Opened port 10001 to listen for incoming peer connections
[04/16/18 19:49:42] ../common/session.c(398): Accepted a local client
[04/16/18 19:49:42] ../common/session.c(398): Accepted a local client
[04/16/18 19:49:42] ../common/session.c(398): Accepted a local client
[04/16/18 19:49:42] ../common/session.c(398): Accepted a local client
cat logs/controller.log 
[04/16/18 19:49:41] seafile-controller.c(154): starting ccnet-server ...
[04/16/18 19:49:41] seafile-controller.c(73): spawn_process: ccnet-server -F /opt/seafile/conf -c /opt/seafile/ccnet -f /opt/seafile/logs/ccnet.log -d -P /pids/ccnet.pid
[04/16/18 19:49:41] seafile-controller.c(88): spawned ccnet-server, pid 22951
[04/16/18 19:49:42] seafile-controller.c(555): ccnet daemon connected.
[04/16/18 19:49:42] seafile-controller.c(186): starting seaf-server ...
[04/16/18 19:49:42] seafile-controller.c(73): spawn_process: seaf-server -F /opt/seafile/conf -c /opt/seafile/ccnet -d /opt/seafile/seafile-data -l /opt/seafile/logs/seafile.log -P /pids/seaf-server.pid
[04/16/18 19:49:42] seafile-controller.c(88): spawned seaf-server, pid 22954
[04/16/18 19:49:42] seafile-controller.c(528): seafdav not enabled.
cat logs/seafile.log    
[04/16/18 19:49:42] http-server.c(161): fileserver: worker_threads = 10
[04/16/18 19:49:42] http-server.c(176): fileserver: fixed_block_size = 8388608
[04/16/18 19:49:42] http-server.c(191): fileserver: web_token_expire_time = 3600
[04/16/18 19:49:42] http-server.c(206): fileserver: max_indexing_threads = 1
[04/16/18 19:49:42] ../common/mq-mgr.c(54): [mq client] mq cilent is started
[04/16/18 19:49:42] listen-mgr.c(120): listen on port 12001 for block tranfer
[04/16/18 19:49:42] seafile-session.c(331): Failed to open template dir /opt/seafile/seafile-data/library-template: Error opening directory '/opt/seafile/seafile-data/library-template': No such file or directory.
[04/16/18 19:49:43] size-sched.c(96): Repo size compute queue size is 0
root@6b8a4928917f:/opt/seafile# 

Creating /opt/seafile/seafile-data/library-template did not help. seahub specific logs are stored into /tmpbut empty:

ll /tmp/
+total 12
drwxrwxrwt  3 root root 4096 Apr 16 19:55 ./
drwxr-xr-x 44 root root 4096 Apr 16 19:49 ../
-rw-r--r--  1 root root    0 Apr 16 19:47 seahub.log
drwx------  2 root root 4096 Apr 16 19:55 seahub_cache/
-rw-r--r--  1 root root    0 Apr 16 19:47 seahub_django_request.log
1 Like

That folder typically resides in your seafile-data folder where the startup files are located. Unfortunately, ARMv7 builds tend to scatter a Seafile installation across two or three separate folders, so it’s probably located in another folder.

The only thing located in that folder on a new 6.2.5 build in a Linux distro is seafile-tutorial.doc, which is installed with Seafile Server. It’s location on my build is /home/seafile-server/seafile-data/library-template.

I would try to find it in ARM and see where it is actually located.

1 Like

I do not think that it is related to that misplaced folder which (if installed correctly) only contains some tutorial-PDF. I also got rid of that error message after creating the folder but seahub still returns the same error.

Furthermore it’s not ARM-specific: I also reproduced this on Ubuntu running on x86_64.

You stated that you tried creating that folder yourself because it didn’t exist… However, Seafile installs it by default. Either it’s located somewhere else, or it did not get created during the build.

As for “Internal Server Error” reported by Seahub, it’s simply letting you know that the problem is with the backend. Your seafile error log you posted reported a missing folder. While your problem may not be related to that folder, you have something going on in the backend that is causing the internal server error. Django logs, seafile logs, system logs, etc may all provide some clues.

I just noticed one other thing. Your seafile-admin setup that you posted… I’ve provided it below. It set ccnet port to 10001 and seafile port to 12001, which is also reflected in your log files. Are you using NGinx or Apache, or are you just running standalone?

There is no library-template folder at all after make install. I can only locate seafile-tutorial.doc inside the source folder:

locate seafile-tutorial.doc
/opt/seafile/seafile-server/src/seafile-server-6.2.5-server/doc/seafile-tutorial.doc

I suppose the sea file installation is somehow broken.

As I already described in my initial post: I had a look into all the seafile-realted logs I could find but besides the error message about the missing library-template folder (which I eventually got rid of by simply creating it) there is nothing that indicates any error. Nevertheless it is somehow strange that the Django-related log files in /tmp remain completely empty.

Unfortunately, the manual is not updated often. I’m thinking that there is a step missing in it somewhere. I’ve not yet made a custom build, and for your sake and another’s sake, I was going to give it a try in a VM. However, I’m out of space on that particular machine and I have subsequently ordered a new hard drive and waiting for it to come in… So, yeah, you gave me an excuse to upgrade my hard drive. :wink:

You’re welcome :wink:

1 Like