YunoHost-Apps / forgejo_ynh

Forgejo package for YunoHost
GNU General Public License v3.0
14 stars 5 forks source link

Cannot reinstall the app after uninstalling #71

Open andreatitolo opened 5 months ago

andreatitolo commented 5 months ago

Hello! and thank you for packaging the app for younohost. As per title, I installed Forgejo on my VPS, I then removed it and tried to reinstall it after a while. But I get an error during the installation process (the ui is at the "starting a systemd service" step).

Yunohost version: 11.2.9.1 Debian version: Debian 11.8

I tested this also on a local server (RaspberryPI) and I was able to reproduce the same issue. Log is here: https://paste.yunohost.org/raw/yukanovoki.

The error is highlighted in yunohost as Command error: pq: relation "login_source" does not exist. Could something interfere with the app installation process? Nothing has changed since I first installed it tough.

grosmanal commented 5 months ago

Hello @andreatitolo Thank you for your report.

I think the real problem is that forgejo is not able to start :

The service forgejo didn't fully executed the action start before the timeout.

and

Jan 19 21:35:14 forgejo[7772]: Failed to load writer mode "router" for logger router: invalid log writer type (mode): router, maybe it needs something like '\''MODE=file'\'' in [log.router] section
Jan 19 21:35:14 forgejo[7772]: Failed to load writer mode "xorm" for logger xorm: invalid log writer type (mode): xorm, maybe it needs something like '\''MODE=file'\'' in [log.xorm] section

Could you please try this :

andreatitolo commented 5 months ago

Hmmm, that's weird. I had to rebuild the debian vps server for other reasons, so I started with a fresh installation. I tried uninstalling and reinstalling forgejo, and everything worked flawlessly.

However, on the local server I still get that error (and I don't have a /var/log/forgejo file or folder. Now the only difference between the two servers currently (apart from the architecture) is that the local one is running Tailscale, as it was the vps server before the rebuild and when I had the error.

From a diagnosis in the yunohost panel, Tailscale seems to alter the /etc/resolv.conf file. Could this interfere in some ways with Forgejo?

grosmanal commented 5 months ago

Could you please check if a database named «forgejo» exists in postgres ?

And then, try to install (once again) forgejo app.

andreatitolo commented 5 months ago

Hi, I tried the above, but there is no line named forgejo in the postgres database, so the drop is not possible

I am attaching an image just as a reference (there were some root errors apparently).

postgres-ynh

grosmanal commented 5 months ago

OK, next try. Could you try to install forgejo from command line with the -n flag : yunohost app install forgejo -n It will keep forgejo binary on your server even if the installation process fails.

Then you could try to launch forgejo manually : sudo -u forgejo /var/www/forgejo/forgejo web -p 6000

…and post here logs found on standard output, or /var/log/forgejo/forgejo.log or /var/log/syslog

andreatitolo commented 5 months ago

Hi, thanks, installation failed as expected. Here are the output of the launch command

root@machine.name:~# sudo -u forgejo /var/www/forgejo/forgejo web -p 6000
2024/01/24 13:37:40 cmd/web.go:242:runWeb() [I] Starting Forgejo on PID: 233417
2024/01/24 13:37:40 cmd/web.go:111:showWebStartupMessage() [I] Forgejo version: 1.21.4+0 built with GNU Make 4.4.1, go1.21.6 : bindata, timetzdata, sqlite, sqlite_unlock_notify
2024/01/24 13:37:40 cmd/web.go:112:showWebStartupMessage() [I] * RunMode: prod
2024/01/24 13:37:40 cmd/web.go:113:showWebStartupMessage() [I] * AppPath: /var/www/forgejo/forgejo
2024/01/24 13:37:40 cmd/web.go:114:showWebStartupMessage() [I] * WorkPath: /var/www/forgejo
2024/01/24 13:37:40 cmd/web.go:115:showWebStartupMessage() [I] * CustomPath: /var/www/forgejo/custom
2024/01/24 13:37:40 cmd/web.go:116:showWebStartupMessage() [I] * ConfigFile: /var/www/forgejo/custom/conf/app.ini
2024/01/24 13:37:40 cmd/web.go:117:showWebStartupMessage() [I] Prepare to run web server
2024/01/24 13:37:40 routers/init.go:113:InitWebInstalled() [I] Git version: 2.30.2, Wire Protocol Version 2 Enabled (home: /home/yunohost.app/forgejo/data/home)
Failed to load writer mode "router" for logger router: invalid log writer type (mode): router, maybe it needs something like 'MODE=file' in [log.router] section
Failed to load writer mode "xorm" for logger xorm: invalid log writer type (mode): xorm, maybe it needs something like 'MODE=file' in [log.xorm] section

And the log file found at /var/log/forgejo/forgejo.log: https://haste.archaeo.cc/oxutizogik.sql

grosmanal commented 5 months ago

The only error I can see in logs is the one about /home/yunohost.app/forgejo/data/queues/common/LOCK. Please remove the directory /home/yunohost.app/forgejo/data/queues and make sure that all directories in /home/yunohost.app/forgejo/ are owned by forgejo user. Then retry to start forgejo again.

andreatitolo commented 5 months ago

No luck with that either, there was a weird stuff that the owner of the forgejo folder was indeed the forgejo user, but the subfolders where owned by firefly-iii (another app installed on the same domain). I changed owner and group of those + subfolders, but launching the command sudo -u forgejo /var/www/forgejo/forgejo web -p 6000 I get the same error as before abour router and xorm.

Not sure if that's relevant but I had to run the launch command as root, as if I run it as non-roor I get something like this:

Sorry, user wsf is not allowed to execute '/var/www/forgejo/forgejo web -p 6000' as forgejo on domain.com.

I'll attach the log again but I can see once more the error about /home/yunohost.app/forgejo/data/queues/common/LOCK, even tough I removed that directory before and I can see the ownership of the forgejo folders is indeed the forgejo user.

https://haste.archaeo.cc/hapayokalo.sql

grosmanal commented 5 months ago

(sorry for the late reply) It's the user forgejo who should launch forgejo. I don't understand why the error message talks about user wsf. Do you know this user ? Do you use an external LDAP, or something like that to provide your users ?

oatmealm commented 1 week ago

removing the application filder helped me re-installing. I was seeing this error, before:

Command error: pq: relation "login_source" does not exist

and the installation would abort.

10x!