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.

Steps

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/seahub.sh stop
/bin/bash /path/to/seafile-server-latest/seafile.sh 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.

./seaf-fsck.sh

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/seahub.sh start
/bin/bash /path/to/seafile-server-latest/seafile.sh start

References

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

This blog is created by Stuart Page

I'm a freelance web developer and technology consultant based in Surrey, UK, with over 10 years experience in web development, DevOps, Linux Administration, and IT solutions.

Need support with your infrastructure or web services?

Get in touch