YunoHost-Apps / seafile_ynh

Seafile package for YunoHost
https://seafile.com
MIT License
14 stars 19 forks source link

Unable to install seafile 9.0.2~ynh2 on YH 11.0.10.2: Failed to start Seafile hub #101

Closed gitacrobat closed 1 year ago

gitacrobat commented 1 year ago

Describe the bug

Installing Seafile through YH admin panel or CLI command ends with an error about failing to start seahub service.

Context

Steps to reproduce

```
sudo yunohost app install seafile
```

Logs

https://paste.yunohost.org/raw/uwujubedok

matthiasbe commented 1 year ago

I'm having the same problem

Any way to fix this by hand ?

Logs of seafile hub:

Jan 30 10:11:45 systemd[1]: Starting Seafile hub...
Jan 30 10:11:45 seahub.sh[1290]: LC_ALL is not set in ENV, set to en_US.UTF-8
Jan 30 10:11:46 seahub.sh[1290]: Starting seahub at port 8000 ...
Jan 30 10:11:55 seahub.sh[1290]: Error:Seahub failed to start.
Jan 30 10:11:55 seahub.sh[1290]: Please try to run "./seahub.sh start" again
Jan 30 10:11:55 systemd[1]: seahub.service: Control process exited, code=exited, status=1/FAILURE
Jan 30 10:11:55 systemd[1]: seahub.service: Failed with result 'exit-code'.
Jan 30 10:11:55 systemd[1]: Failed to start Seafile hub.
Jan 30 10:11:55 systemd[1]: seahub.service: Consumed 5.160s CPU time.

The result is a 502 "Bad Gateway" when accessing the app.

matthiasbe commented 1 year ago

Trying to fix this with the manual.

Go to the Seafile home: /opt/yunohost/seafile/seafile-server-latest, and switch to root user with sudo su.

The difficulty is that sudo -u seafile ./seahub.sh start hides the python errors, and only shows "seahub failed to start". From this thread it says you can use the deprecated sudo -u seafile ./seahub.sh start-fastcgi to troubleshoot, because it has a similar behavior and print python errors. This help me find the missing packages.

To install the python package, you should not use the bare sudo pip3 install ... command. The python packages for Seafile belong to the seafile home user (/opt/yunohost/seafile/.local/lib/python3.9/site-packages/). To modify this local package repository, the command is sudo -u seafile pip3 --user install ... (you execute the command as the user "seafile", and update the local packages).

Another information, is that some packages are present in /opt/yunohost/seafile/seafile-server-9.0.2/seahub/thirdpart/. The python packages should match the versions of these files.

It may be different for others, but for me, I had to do

 sudo -u seafile pip3 install --user cffi==1.15.0
 mv seahub/thirdpart/PIL/ seahub/thirdpart/PIL_old
 seahub/thirdpart/MySQLdb/ seahub/thirdpart/MySQLdb_old

The mv command also solve conflicts I think, I got this from the same thread.

And problem was solved. I also issued the command sudo -u seafile pip3 install --user django==3.2.* Pillow pylibmc captcha jinja2 sqlalchemy==1.4.3 django-pylibmc django-simple-captcha python3-ldap mysqlclient pycryptodome==3.12.0 cffi==1.15.0 lxml from the manual, downgrading django from 4.1.5 to 3.2.16 and SQLAlchemy from 2.0.0 to 1.4.3 but I'm not sure it had impact. Beware that in the manual they tell to use cffi 1.14.0, but it is the 1.15.0 version that matches local files.

gitacrobat commented 1 year ago

I can confirm the error is gone with the current testing branch.

baptisteGag commented 1 year ago

Hello,

Thanks !

I did try the testing branch, and it is not installing as of today. To fix it, and mostly helped by matthiasbe's post :

1/ install seafile without removing on failure : yunohost app install seafile --no-remove-on-failure

2/ Fix python's packages : sudo -u seafile pip3 install --user django==3.2.* Pillow==9.0.1 pylibmc captcha jinja2 sqlalchemy==1.4.3 django-pylibmc django-simple-captcha python3-ldap mysqlclient pycryptodome==3.12.0 cffi==1.15.0 lxml

3/ Confirm startup as no more module issue and is working in normal-mode :

root@app:/opt/yunohost/seafile/seafile-server-9.0.2# sudo -u seafile ./seahub.sh start-fastcgi

Starting seahub (fastcgi) at 127.0.0.1:8000 ...
Unknown command: 'runfcgi'
Type 'manage.py help' for usage.
Error:Seahub failed to start.

root@app:/opt/yunohost/seafile/seafile-server-9.0.2# sudo -u seafile ./seahub.sh start

Starting seahub at port 8000 ...

Seahub is started

Done.

4/ Cleanup and startup :

sudo -u seafile ./seahub.sh stop

systemctl start seahub
systemctl status seahub