Programster's Blog

Tutorials focusing on Linux, programming, and open-source

Repairing Seafile

If you have any issues with seafile such as:

  • missing libraries
  • errors in the logs such as Error prepare statement SELECT r.repo_id...

... then this little error fixing guide will likely solve the issue.


Stop Seafile

The very first thing to do, is stop the the seafile processes from running. E.g.

/bin/bash /path/to/seafile-server-latest/ stop
/bin/bash /path/to/seafile-server-latest/ stop

Take A Backup

I always take a backup before messing around with stuff. It's just generally a good idea, and if you are using something like AWS or DigitalOcean then it is very easy to just take a snapshot. Do that now.

Remove the Cache

For some issues, you may just need to remove the cache.

sudo rm -rf /tmp/seahub_cache

Check/Fix MySQL Database

Run the following command to run a check and try to automatically repair any issues in your database.

mysqlcheck -u root -p --all-databases --auto-repair

Run seaf-fsck

Navigate to the seafile-server-latest folder and execute seafile's in-built filesystem checker.


This can take a long time if you aren't using SSDs for your storage and have a lot of data.

Start Seafile

Now that you have performed all the steps, start seafile again.

/bin/bash /path/to/seafile-server-latest/ start
/bin/bash /path/to/seafile-server-latest/ start


Last updated: 2nd September 2018
First published: 16th August 2018