Systemd ubuntu scripts in manual are faulty


#1

The scripts lack runlevel info and dont work on ubuntu 18.
also after completing them with runlevel info seahub exits with failure. but it can be started manually. which log to look in for that error?
https://manual.seafile.com/deploy/start_seafile_at_system_bootup.html

my syslog:

Oct  7 08:24:46 -pc systemd[1]: Starting seafile.service...
Oct  7 08:24:46 -pc systemd[1]: Starting seahub.service...
Oct  7 08:24:46 -pc systemd[3020]: seafile.service: Failed to execute command: Exec format error
Oct  7 08:24:46 -pc systemd[3020]: seafile.service: Failed at step EXEC spawning /etc/init.d/seafile: Exec format error
Oct  7 08:24:46 -pc systemd[3022]: seahub.service: Failed to execute command: Exec format error
Oct  7 08:24:46 -pc systemd[3022]: seahub.service: Failed at step EXEC spawning /etc/init.d/seahub: Exec 
format error
Oct  7 08:24:46 -pc systemd[1]: seafile.service: Control process exited, code=exited status=203
Oct  7 08:24:46 -pc systemd[1]: seafile.service: Failed with result 'exit-code'.
Oct  7 08:24:46 -pc systemd[1]: Failed to start seafile.service.
Oct  7 08:24:46 -pc systemd[1]: seahub.service: Control process exited, code=exited status=203
Oct  7 08:24:46 -pc systemd[1]: seahub.service: Failed with result 'exit-code'.
Oct  7 08:24:46 -pc systemd[1]: Failed to start seahub.service.

seafile.service file:

#!/bin/bash
### BEGIN INIT INFO
# Provides:          seafile_server
# Required-Start:    $all
# Required-Stop:
# Default-Start:     5
# Default-Stop:         4
# Short-Description: Halts USB power...
### END INIT INFO
[Unit]
Description=Seafile
# add mysql.service or postgresql.service depending on your database to the line below
After=network.target

[Service]
Type=forking
ExecStart=/seafile-server/seafile-server-latest/seafile.sh start
ExecStop=/seafile-server/seafile-server-latest/seafile.sh stop
User=user
Group=user

[Install]
WantedBy=multi-user.target

seahub.service file:

#!/bin/bash
### BEGIN INIT INFO
# Provides:          seafile_server
# Required-Start:    $all
# Required-Stop:
# Default-Start:     5
# Default-Stop:         4
# Short-Description: Halts USB power...
### END INIT INFO

[Unit]
Description=Seafile hub
After=seafile.service

[Service]
Type=forking
# change start to start-fastcgi if you want to run fastcgi
ExecStart=/seafile-server/seafile-server-latest/seahub.sh start
ExecStop=/seafile-server/seafile-server-latest/seahub.sh stop
User=user
Group=user

[Install]
WantedBy=multi-user.target

Runnint the script in a shell as user /seafile-server/seafile-server-latest/seahub.sh start works. so it seems seahub.sh start needs a bash shell to execute?


#2

Why do you start it with a bash shebang? It’s systemd, not SyS V init or some rc init.


#3

ok removed that, same result, seahub does not want to start, but starts manually

root@--pc:/seafile-server/seafile-pro-server-6.2.9# systemctl status seahub.service
● seahub.service - Seafile hub
   Loaded: loaded (/etc/systemd/system/seahub.service; enabled; vendor preset: enabled)
   Active: failed (Result: exit-code) since Sun 2018-10-07 09:50:04 CEST; 7s ago
  Process: 10923 ExecStart=/seafile-server/seafile-server-latest/seahub.sh start (code=exited, status=1/FAILURE)

Okt 07 09:49:59 --pc systemd[1]: Starting Seafile hub...
Okt 07 09:49:59 --pc seahub.sh[10923]: LC_ALL is not set in ENV, set to en_US.UTF-8
Okt 07 09:49:59 --pc seahub.sh[10923]: Starting seahub at port 8000 ...
Okt 07 09:50:04 --pc seahub.sh[10923]: Error:Seahub failed to start.
Okt 07 09:50:04 --pc seahub.sh[10923]: Please try to run "./seahub.sh start" again
Okt 07 09:50:04 --pc systemd[1]: seahub.service: Control process exited, code=exited status=1
Okt 07 09:50:04 --pc systemd[1]: seahub.service: Failed with result 'exit-code'.
Okt 07 09:50:04 --pc systemd[1]: Failed to start Seafile hub.
root@--pc:/seafile-server/seafile-pro-server-6.2.9# /seafile-server/seafile-server-latest/seahub.sh start

LC_ALL is not set in ENV, set to en_US.UTF-8
Starting seahub at port 8000 ...

Seahub is started

Done.

#4

I’ll look when I’m back.
[Unit]
Description=Seafile
# add mysql.service or postgresql.service depending on your database to the line below
After=network.target mysql.service

[Service]
Type=forking
ExecStart=/home/seafile/seafile-server-latest/seafile.sh start
ExecStop=/home/seafile/seafile-server-latest/seafile.sh stop
User=seafile
Group=seafile

[Install]
WantedBy=multi-user.target


#5

Can you please post your seahub.log and seafile.log?


#6

al there is in seahub.log (i started on October 7th with the systemd thing):

2018-09-25 06:33:42,590 [WARNING] django.request:170 get_response Not Found: /seafhttp/protocol-version
2018-09-27 06:07:41,888 [WARNING] django.request:170 get_response Not Found: /seafhttp/protocol-version
2018-09-28 06:53:03,964 [WARNING] django.request:170 get_response Not Found: /seafhttp/protocol-version
2018-10-02 06:48:33,707 [WARNING] django.request:170 get_response Not Found: /seafhttp/protocol-version
2018-10-02 13:05:56,113 [WARNING] django.request:170 get_response Not Found: /seafhttp/protocol-version
2018-10-06 06:44:07,606 [WARNING] django.request:170 get_response Not Found: /seafhttp/protocol-version
2018-10-07 08:29:02,054 [INFO] seafevents.db:74 create_engine_from_conf [seafevents] database: mysql, name: seahub-db
2018-10-07 08:29:02,094 [INFO] seafevents:109 is_audit_enabled audit is enabled
2018-10-07 08:29:11,789 [INFO] seafevents.db:74 create_engine_from_conf [seafevents] database: mysql, name: seahub-db
2018-10-07 08:29:11,830 [INFO] seafevents:109 is_audit_enabled audit is enabled
2018-10-07 08:29:32,796 [INFO] seafevents.db:74 create_engine_from_conf [seafevents] database: mysql, name: seahub-db
2018-10-07 08:29:32,835 [INFO] seafevents:109 is_audit_enabled audit is enabled
2018-10-07 08:52:16,315 [INFO] seafevents.db:74 create_engine_from_conf [seafevents] database: mysql, name: seahub-db
2018-10-07 08:52:16,372 [INFO] seafevents:109 is_audit_enabled audit is enabled
2018-10-07 09:18:07,135 [INFO] seafevents.db:74 create_engine_from_conf [seafevents] database: mysql, name: seahub-db
2018-10-07 09:18:07,233 [INFO] seafevents:109 is_audit_enabled audit is enabled
2018-10-07 09:18:15,108 [INFO] seafes:162 load_seafevents_conf [seafes] use highlighter plain
2018-10-07 09:21:40,685 [INFO] seafevents.db:74 create_engine_from_conf [seafevents] database: mysql, name: seahub-db
2018-10-07 09:21:40,742 [INFO] seafevents:109 is_audit_enabled audit is enabled
2018-10-07 09:21:42,613 [INFO] seafes:162 load_seafevents_conf [seafes] use highlighter plain
2018-10-07 09:21:49,690 [INFO] seafes:162 load_seafevents_conf [seafes] use highlighter plain
2018-10-07 09:24:34,764 [INFO] seafes:162 load_seafevents_conf [seafes] use highlighter plain
2018-10-07 09:27:36,758 [INFO] seafes:162 load_seafevents_conf [seafes] use highlighter plain

seafile.log:

[10/04/2018 11:44:33 PM] size-sched.c(103): Repo size compute queue size is 0
[10/04/2018 11:49:33 PM] size-sched.c(103): Repo size compute queue size is 0
[10/06/18 08:44:02] http-server.c(195): fileserver: worker_threads = 10
[10/06/18 08:44:02] http-server.c(208): fileserver: backlog = 32
[10/06/18 08:44:02] http-server.c(223): fileserver: fixed_block_size = 8388608
[10/06/18 08:44:02] http-server.c(238): fileserver: web_token_expire_time = 3600
[10/06/18 08:44:02] http-server.c(253): fileserver: max_indexing_threads = 1
[10/06/2018 08:44:02 AM] ../common/mq-mgr.c(61): [mq client] mq cilent is started
[10/06/2018 08:44:02 AM] filelock-mgr.c(924): Cleaning expired file locks.
[10/06/2018 08:44:03 AM] size-sched.c(103): Repo size compute queue size is 0
[10/06/2018 08:49:03 AM] size-sched.c(103): Repo size compute queue size is 0
[10/06/2018 08:54:03 AM] size-sched.c(103): Repo size compute queue size is 0
[10/06/2018 08:59:03 AM] size-sched.c(103): Repo size compute queue size is 0
[10/07/18 08:51:36] http-server.c(195): fileserver: worker_threads = 10
[10/07/18 08:51:36] http-server.c(208): fileserver: backlog = 32
[10/07/18 08:51:36] http-server.c(223): fileserver: fixed_block_size = 8388608
[10/07/18 08:51:36] http-server.c(238): fileserver: web_token_expire_time = 3600
[10/07/18 08:51:36] http-server.c(253): fileserver: max_indexing_threads = 1
[10/07/2018 08:51:36 AM] ../common/mq-mgr.c(61): [mq client] mq cilent is started
[10/07/2018 08:51:36 AM] filelock-mgr.c(924): Cleaning expired file locks.
[10/07/2018 08:51:37 AM] size-sched.c(103): Repo size compute queue size is 0
[10/07/2018 08:51:40 AM] Disconnected from daemon
[10/07/18 08:53:01] http-server.c(195): fileserver: worker_threads = 10
[10/07/18 08:53:01] http-server.c(208): fileserver: backlog = 32
[10/07/18 08:53:01] http-server.c(223): fileserver: fixed_block_size = 8388608
[10/07/18 08:53:01] http-server.c(238): fileserver: web_token_expire_time = 3600
[10/07/18 08:53:01] http-server.c(253): fileserver: max_indexing_threads = 1
[10/07/2018 08:53:01 AM] ../common/mq-mgr.c(61): [mq client] mq cilent is started
[10/07/2018 08:53:01 AM] filelock-mgr.c(924): Cleaning expired file locks.
[10/07/2018 08:53:02 AM] size-sched.c(103): Repo size compute queue size is 0
[10/07/2018 08:53:52 AM] Disconnected from daemon
[10/07/18 09:01:16] http-server.c(195): fileserver: worker_threads = 10
[10/07/18 09:01:16] http-server.c(208): fileserver: backlog = 32
[10/07/18 09:01:16] http-server.c(223): fileserver: fixed_block_size = 8388608
[10/07/18 09:01:16] http-server.c(238): fileserver: web_token_expire_time = 3600
[10/07/18 09:01:16] http-server.c(253): fileserver: max_indexing_threads = 1
[10/07/2018 09:01:16 AM] ../common/mq-mgr.c(61): [mq client] mq cilent is started
[10/07/2018 09:01:16 AM] filelock-mgr.c(924): Cleaning expired file locks.
[10/07/2018 09:01:17 AM] size-sched.c(103): Repo size compute queue size is 0
[10/07/2018 09:06:17 AM] size-sched.c(103): Repo size compute queue size is 0
[10/07/2018 09:11:17 AM] size-sched.c(103): Repo size compute queue size is 0
[10/07/2018 09:16:17 AM] size-sched.c(103): Repo size compute queue size is 0
[10/07/2018 09:21:17 AM] size-sched.c(103): Repo size compute queue size is 0
[10/07/2018 09:26:17 AM] size-sched.c(103): Repo size compute queue size is 0
[10/07/2018 09:31:17 AM] size-sched.c(103): Repo size compute queue size is 0
[10/07/18 09:33:24] http-server.c(195): fileserver: worker_threads = 10
[10/07/18 09:33:24] http-server.c(208): fileserver: backlog = 32
[10/07/18 09:33:24] http-server.c(223): fileserver: fixed_block_size = 8388608
[10/07/18 09:33:24] http-server.c(238): fileserver: web_token_expire_time = 3600
[10/07/18 09:33:24] http-server.c(253): fileserver: max_indexing_threads = 1
[10/07/2018 09:33:24 AM] ../common/mq-mgr.c(61): [mq client] mq cilent is started
[10/07/2018 09:33:24 AM] filelock-mgr.c(924): Cleaning expired file locks.
[10/07/2018 09:33:25 AM] size-sched.c(103): Repo size compute queue size is 0
[10/07/2018 09:38:25 AM] size-sched.c(103): Repo size compute queue size is 0
[10/07/2018 09:43:25 AM] size-sched.c(103): Repo size compute queue size is 0
[10/07/2018 09:47:48 AM] Disconnected from daemon
[10/07/18 09:48:39] http-server.c(195): fileserver: worker_threads = 10
[10/07/18 09:48:39] http-server.c(208): fileserver: backlog = 32

#7

Seems the logs of 9:50 were never written. Is user just symbolic or real? Maybe try it with sh -c "/home/seafile/seafile-server-latest/seafile.sh start", that could help.


#8

user is a replacement for my username, the paths i have also truncated


#9

Ok, some Summary
SeaFile starts manually with the same user as under systemd.
With systemd SeaFile breaks.
right?


#10

right, but seafile starts with systemd, not seahub. seahub starts manually. at the last boot neither seafile nor seahub started. i now saw that networking.service fails too, i will first look into that.


#11

That would clarify the problems.