I restarted my RPi today and afterwards Seafile broke down:
seafile | 2024-03-12T14:54:56.822688658Z waiting for mysql server to be ready: %s (2003, "Can't connect to MySQL server on 'seafile_db' ([Errno 111] Connection refused)")
seafile | 2024-03-12T14:54:56.822790490Z waiting for mysql server to be ready: %s (2003, "Can't connect to MySQL server on 'seafile_db' ([Errno 111] Connection refused)")
seafile | 2024-03-12T14:54:56.822808176Z waiting for mysql server to be ready: %s (2003, "Can't connect to MySQL server on 'seafile_db' ([Errno 111] Connection refused)")
seafile | 2024-03-12T14:54:56.822824157Z waiting for mysql server to be ready: %s (2003, "Can't connect to MySQL server on 'seafile_db' ([Errno 111] Connection refused)")
seafile | 2024-03-12T14:54:56.822839824Z waiting for mysql server to be ready: %s (2003, "Can't connect to MySQL server on 'seafile_db' ([Errno 111] Connection refused)")
From mysql service I see connection attempts:
seafile-mysql | 2024-03-12T14:54:56.816885319Z 2024-03-12 14:54:56 3 [Warning] Aborted connection 3 to db: 'unconnected' user: 'seafile' host: '172.28.0.4' (Got an error reading communication packets)
I checked the username/password (from seafile/conf/ccnet.conf) and I can connect to the mysql instance just fine (either locally from mysql container or from the bash in seafile container):
$ docker compose exec -it seafile /bin/bash
root@c6e222dbffef:/opt/seafile# mysql -hseafile-mysql -useafile -p
Enter password:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 28
Server version: 5.5.5-10.11.7-MariaDB-1:10.11.7+maria~ubu2204 mariadb.org binary distribution
Copyright (c) 2000, 2024, Oracle and/or its affiliates.
Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
mysql> show databases;
+--------------------+
| Database |
+--------------------+
| ccnet_db |
| information_schema |
| seafile_db |
| seahub_db |
+--------------------+
4 rows in set (0.00 sec)
Services:
```
$ docker compose ps
NAME IMAGE COMMAND SERVICE CREATED STATUS PORTS
seafile seafileltd/seafile-mc:latest "/sbin/my_init -- /s…" seafile 14 minutes ago Up 14 minutes 80/tcp
seafile-memcached memcached:1.6 "memcached -m 256" memcached 57 minutes ago Up 20 minutes
seafile-mysql mariadb:10.11 "docker-entrypoint.s…" seafile_db 14 minutes ago Up 14 minutes (healthy)
```
I ran into the exact same issue this afternoon. I was at a loss how to fix it, because I have set up seafile already a number times in different containers and did not have this problem.
I’m somewhat reluctant to downgrade (not sure if supported and what would be the implications) by switching image: seafileltd/seafile-mc:latest to previous version…
Seems like you might be dealing with something similar to what I did. If either Seafile (or seadoc or MySQL, etc) is running on docker, and the other service is running on the host machine, they will be on different networks. A docker container is somewhat like a different computer running on the same LAN. You can configure multiple docker containers to run on the same network, but I don’t think you can configure them to run on the same network as the host.
So a docker program won’t be able to connect to MySQL running on localhost because it’s running on a different network. You have to edit your my.cnf file (or 50-server.cnf if you’re using Mariadb) and set the bind address to 0.0.0.0. I tried adding multiple bind addresses, including 127.0.0.1 (localhost) and the docker IP addresses, but Mariadb wouldn’t start back up, so I just used 0.0.0.0, which lets any IP address connect. I also had to open the MySQL port on my ufw firewall.
My error was exactly the same (Errno 111), so hopefully this works for you too. This really should be documented in the server manual, because it took me forever to figure it out.
Unfortunately in my case I’m using docker compose and all elements are handled by it (and they use same network). What’s more - this exact setup was working just fine but I think seafile got updated during my system update (I’m using “latest” image tag) and something changed.
As for the connectivity - I entered containers of seafile (which reports the error), I installed mysql client and connected just fine to the database!
It looks like seafile tries something funny it I can’t put my finger on it
If you just updated your system, I’d make sure that all of the python packages are installed. Another thing I ran into was that Seafile ran fine on Ubuntu 20.04 with python 3.12. After I updated to Ubuntu 22.04, Seahub would no longer start with python 3.12, but it would with python 3.10. Although now it seems to work with both versions… I would imagine that the docker containers use their own python libraries, so this probably isn’t the problem.
You might check to see if you can log access attempts to the MySQL database to see if you can narrow down what’s causing the problem.
Hmm… python packages shouldn’t be an issue as I do everything inside docker (so python is within seafile images provided by devs) but I’ll try to see mysql logs - indeed maybe there should be more info
This may be related to a closed port issue. Or no connectivity.
Can you check the docker compose configuration?
Also eg. for me - I had serious issues with docker and resolving the domain names, but maybe I’m just a noob… Every time I install the freaking docker it screws my server, so now I’m just virtualizing that shit with Nextcloud AIO docker solution (yea, no more Seafile for me, thanks - issues with v11 upgrade got me extremely frustrated).
Hey, did you find a way to fix this? I’m having the exact same problem. Seadrive seems to be able to connect to the seafile server, but the webserver doesn’t seem to be able to start, and I’m getting the same error 111:
Starting seahub at port 8000 …
Error:Seahub failed to start.
Please try to run “./seahub.sh start” again
Traceback (most recent call last):
File “/scripts/start.py”, line 95, in
waiting for mysql server to be ready: %s (2003, “Can’t connect to MySQL server on ‘db’ ([Errno 111] Connection refused)”)
main()
File “/scripts/start.py”, line 81, in main
call(‘{} start’.format(get_script(‘seahub.sh’)))
File “/scripts/utils.py”, line 70, in call
I just restored this as a VM in proxmox from a pbs backup from a day ago, when everything was working perfectly fine.
@murtaza-nasir Actualy I don’t remember what fixed it in the issue. I think I was downgrading/upgrading the image version while debugging it that at one point it started…
to be honest, between this issue and seafile android up not working correctly (issues with photo update) I just gave up on seafile and move to syncthing - it works more reliably and I’m sure my photos are backed up…
While seafile works I keep to backup stuff from my laptop (backup-of-a-backup) and sometimes share stuff but next time it breaks or whatnot it’ll be out of the window…
LOL… so seafile crashed again for some weird reason (I get 502 from nginx-proxy-manager)… sersiously… Windows powered by CrowdStrike was more stable and reliable on friday than seafile xD
No, I’m using it on my RaspberryPi4 (so arm64) but I think that my previous solution was to actually down/remove the whole thing (so docker compose down and then docker compose rm) because simply using stop doesn’t update the image…