Seafile server hiccup

I am running seafile server 4.3 on a raspberry pi using nginx. I know, the server version is old now, but you know, never touch a running system… And to be honest, I am not really good at linux etc. and it took me quite a while to get the server running in the first place.

So, today I could not connect anymore, neither from the windows client, nor from a mobile client. The windows error message was “Sorry, but the requested page is unavailable due to a server hiccup. Our engineers have been notified, so check back later.”

Checking the seafile.log was difficult, as the raspberry pi took about half an hour to scroll to the latest entries. The log has increased over the course of the two years I have been running the server to about 250 MB, and the raspberry editor can hardly cope with that.

Anyway, the latest entries are from July 3 to July 5, stating: “http-server.c(1354): Failed to write block 9b1979a4…”.

I don’t quite understand why there has been no error message dating from today.

I’ve just checked the remaining disk space on the SD card. Everything is OK.

So - any ideas how I could continue with my troubleshooting bearing in mind my limited understanding of Linux and the internal workings of the Seafile server?

I stopped seafile and and seahub.

Then I started seafile server with ./seafile.sh start
Done.

I tried to start seahub with ./seahub-sh startfastcgi
Error:Seahub failed to start.

Use tail -f for that.

Try to run seaf-fsck.sh and repair the issues.

Please post the last entries of seahub.log and seahub_django_request.log (of course with tail -f)

Here are the log results:

seahub.log:

Blockquote
File “/home/seafile/seafile-server-4.3.0/seahub/thirdpart/Django-1.5.12-py2.7.egg/django/db/models/base.py”, line 546, in save
force_update=force_update, update_fields=update_fields)
File “/home/seafile/seafile-server-4.3.0/seahub/thirdpart/Django-1.5.12-py2.7.egg/django/db/models/base.py”, line 626, in save_base
rows = manager.using(using).filter(pk=pk_val)._update(values)
File “/home/seafile/seafile-server-4.3.0/seahub/thirdpart/Django-1.5.12-py2.7.egg/django/db/models/query.py”, line 605, in _update
return query.get_compiler(self.db).execute_sql(None)
File “/home/seafile/seafile-server-4.3.0/seahub/thirdpart/Django-1.5.12-py2.7.egg/django/db/models/sql/compiler.py”, line 1020, in execute_sql
cursor = super(SQLUpdateCompiler, self).execute_sql(result_type)
File “/home/seafile/seafile-server-4.3.0/seahub/thirdpart/Django-1.5.12-py2.7.egg/django/db/models/sql/compiler.py”, line 846, in execute_sql
cursor.execute(sql, params)
File “/home/seafile/seafile-server-4.3.0/seahub/thirdpart/Django-1.5.12-py2.7.egg/django/db/backends/sqlite3/base.py”, line 366, in execute
six.reraise(utils.DatabaseError, utils.DatabaseError(*tuple(e.args)), sys.exc_info()[2])
File “/home/seafile/seafile-server-4.3.0/seahub/thirdpart/Django-1.5.12-py2.7.egg/django/db/backends/sqlite3/base.py”, line 362, in execute
return Database.Cursor.execute(self, query, params)
DatabaseError: database is locked

seahub_django_request.log:

Blockquote
2018-07-05 17:17:50,020 [ERROR] django.request:210 handle_uncaught_exception Internal Server Error: /api2/avatars/user/xyz@xyz.com/resized/80/
Traceback (most recent call last):
File “/home/seafile/seafile-server-4.3.0/seahub/thirdpart/Django-1.5.12-py2.7.egg/django/core/handlers/base.py”, line 185, in get_response
response = middleware_method(request, response)
File “/home/seafile/seafile-server-4.3.0/seahub/thirdpart/Django-1.5.12-py2.7.egg/django/contrib/sessions/middleware.py”, line 38, in process_response
request.session.save()
File “/home/seafile/seafile-server-4.3.0/seahub/thirdpart/Django-1.5.12-py2.7.egg/django/contrib/sessions/backends/db.py”, line 57, in save
obj.save(force_insert=must_create, using=using)
File “/home/seafile/seafile-server-4.3.0/seahub/thirdpart/Django-1.5.12-py2.7.egg/django/db/models/base.py”, line 546, in save
force_update=force_update, update_fields=update_fields)
File “/home/seafile/seafile-server-4.3.0/seahub/thirdpart/Django-1.5.12-py2.7.egg/django/db/models/base.py”, line 626, in save_base
rows = manager.using(using).filter(pk=pk_val)._update(values)
File “/home/seafile/seafile-server-4.3.0/seahub/thirdpart/Django-1.5.12-py2.7.egg/django/db/models/query.py”, line 605, in _update
return query.get_compiler(self.db).execute_sql(None)
File "/home/seafile/seafile-server-4.3.0/seahub/thirdpart/Django-1.5.12-py2.7.egg/django/db/model

I have run seaf-fsck.sh: no errors, nothing corrupted!

The user where seafile is running has no permission to acces the seafile databes. You should change the owner of them. Are you using SQLite or MariaDB?

I am using SQLite.

Strange, I haven’t changed any permissions. All of a sudden, I could not access the server anymore. I wonder what happened…

By the way: thanks a lot for your help, very appreciated indeed!

Can you show me the outptut of ls -l in your SQLite folder?

Sorry if I appear a bit clueless… I set up the server following some step by step instructions that I had to modify a bit. That was more than two years ago. The details are a bit hazy now for me.

When I check the instructions I used, the only reference to SQL is the initial command “sudo apt-get install sqlite3”, so I assume that my server uses sqlite. However, when I ceck the directories, I only find two folders related to sql in the seafile-server-latest folder (I hope that is the right one): setup-seafile-mysql.py and setup-seafile-mysql.sh

When I check the official guide here: https://manual.seafile.com/deploy/using_sqlite.html
I cannot see any sqlite folder. Where is that supposed to be?

Sorry that for late answer, I had much to do. It should be /seafile-server-latest/.

The result of “ls -l” in the diretory /seafile-server-latest/ is:

total 128
-rw-r–r-- 1 seafile seafile 10867 Jul 24 2015 check_init_admin.py
-rwxr-xr-x 1 seafile seafile 1876 Jul 24 2015 reset-admin.sh
drwxr-xr-x 2 seafile seafile 4096 Jul 8 18:01 runtime
-rwxr-xr-x 1 seafile seafile 1860 Jul 24 2015 seaf-fsck.sh
-rwxr-xr-x 1 seafile seafile 3236 Jul 24 2015 seaf-fuse.sh
-rwxr-xr-x 1 seafile seafile 2755 Jul 24 2015 seaf-gc.sh
drwxr-xr-x 5 seafile seafile 4096 Jul 24 2015 seafile
-rwxr-xr-x 1 seafile seafile 4279 Jul 24 2015 seafile.sh
drwxr-xr-x 12 seafile seafile 4096 Jul 24 2015 seahub
-rwxr-xr-x 1 seafile seafile 6541 Jul 24 2015 seahub.sh
-rw-r–r-- 1 seafile seafile 44246 Jul 24 2015 setup-seafile-mysql.py
-rwxr-xr-x 1 seafile seafile 2743 Jul 24 2015 setup-seafile-mysql.sh
-rwxr-xr-x 1 seafile seafile 19798 Jul 24 2015 setup-seafile.sh
drwxr-xr-x 4 seafile seafile 4096 Jul 24 2015 upgrade

From manual:

For SQLite, the database files are also under the ‘haiwen’ directory. The locations are:
ccnet/PeerMgr/usermgr.db: contains user information
ccnet/GroupMgr/groupmgr.db: contains group information
seafile-data/seafile.db: contains library metadata
seahub.db: contains tables used by the web front end (seahub)

Thank you! I’m using MariaDB and I don’t know where I could find it, I just found an old screenshot where they where directly in seafile-server-latest

Can show the output of ls -l for this directories?

Here are the results for the various subdirectories of the haiwen directory:

ccnet/PeerMgr/usermgr.db

total 16
-rw-r–r-- 1 seafile seafile 13312 Apr 21 2016 usermgr.db

ccnet/GroupMgr/groupmgr.db:

total 8
-rw-r–r-- 1 seafile seafile 7168 Apr 23 2016 groupmgr.db

seafile-data/seafile.db

total 144
drwxr-xr-x 2 seafile seafile 4096 Apr 20 2016 commits
drwxr-xr-x 2 seafile seafile 4096 Apr 20 2016 fs
drwxr-xr-x 2 seafile seafile 4096 Mar 27 18:00 httptemp
drwxr-xr-x 2 seafile seafile 4096 Apr 20 2016 library-template
-rw-r–r-- 1 seafile seafile 23 Apr 20 2016 seafile.conf
-rw-r–r-- 1 seafile seafile 114688 Jul 8 18:28 seafile.db
drwxr-xr-x 5 seafile seafile 4096 Apr 20 2016 storage
drwxr-xr-x 2 seafile seafile 4096 Jul 8 18:16 tmpfiles

seahub.db:

-rw-r–r-- 1 seafile seafile 626264064 Jul 5 20:11 seahub.db

Since everything is right, it seems SQLite doesn’t support your version anymore. You have to upgrade, please remind that you have to do every minor step. I would just upgrade 6.2.5, 6.3 isn’t stable.

1 Like

Thank you so much for your help! I will follow your advice and try to upgrade!

I have just upgraded and everything works again!
Thanks again!

Weird. At some time before this was happening I had tried seafile 2.6 on a pi, just because I was curious how looked at this time. I worked for me, but maybe just libaries v1 didn’t have complicated database entries, which aren’t recommend now.