A few weeks ago I installed Gitea on a Debian 8 server, following the install instructions and opting for supervisor control. Everything was fine and I’ve been using Gitea since then with no problems.
Yesterday I decided to update to v.1.7.0, so I downloaded the new binary and linked it as gitea (I use “ln -s” to make a quick change to new files, while keeping the old ones).
The thing is, I cannot start the new version via supervisorctl:
supervisorctl start gitea
gitea: ERROR (abnormal termination)
All permissions are set to git:git
app.ini ets run user to git: RUN_USER = git
stderr.log shows: ...s/setting/setting.go:1029 NewContext()] [E] Expect user 'git' but current user is: root
If I go back to v.1.6.4, the same configuration runs without errors.
I’m lost, any idea on how to solve this issue? Thanks!
You’re right, I investigated the issue and found it was a supervisor configuration error: I was running supervisorctl as root (unsafe habit, I know), to quickly solve a permission issue with the supervisor socket.
I found that Gitea checks the running user at line 1039 in setting.go:
If the running user is different from the RUN_USER = git defined in the Security section in app.ini.conf, Gitea exits via log.Fatal()
As I was running supervisorctl as root, Gitea found the inconsistence and correctly exited.
I solved the issue by reconfiguring supervisor, following this post:
Gitea 1.7.0 must have changed something (again, that’s correctly done from a security PoV), because I didn’t have this error with v.1.6.4.
@ruliezz
I don’t know if the above helps to solve your issue, I’m sorry I cannot reproduce it here, but I suggest to check the permissions, as hinted by @elfuego
I have this issue too, and tried the supervisor reconfiguration, added my git user to the supervisor group, change the permission in the supervisor’s config to 0770 and added the chown=root:supervisor
but gitea 1.7.1 (nor 1.7.0) is still failing to start. In supervisor.log:
2019-02-03 09:45:43,526 INFO exited: gitea (exit status 1; not expected)
2019-02-03 09:45:44,528 INFO gave up: gitea entered FATAL state, too many start retries too quickly
1.6.3 is fine
EDIT: I’ve tried the setuid/setgid permission as well
@Geobomatic
What’s in supervisor-gitea-stderr.log?
You can find the specific gitea error there. Mine was:
2019/01/25 12:48:21 …s/setting/setting.go:1029 NewContext()] [E] Expect user ‘git’ but current user is: root
Eventually I found there was a missing definition in my /etc/supervisor/conf.d/gitea.conf:
[program:gitea]
user=git ;<-- This is needed! Without it, supervisor runs gitea as root, not git
environment = HOME="/home/git", USER=“git”;<-- this defines enviroment’s variables only! directory=/home/git/;<-- I changed homedir, yours could be different command=/home/git/gitea web autostart=true autorestart=true startsecs=10 stdout_logfile=/home/git/log/supervisor-gitea-stdout.log stdout_logfile_maxbytes=1MB stdout_logfile_backups=10 stdout_capture_maxbytes=1MB stdout_logfile=/home/git/log/supervisor-gitea-stderr.log stderr_logfile_maxbytes=1MB stderr_logfile_backups=10 stderr_capture_maxbytes=1MB
Your configuration looks exactly like mine, and you get the same error as i did: supervisor runs gitea as “root”, and gitea stops because it needs to be run as “git”.
Please try removing the spaces in your gitea.conf arond the “=”, it’s the only difference I can see, please try:
Thanks, for you understanding I am not using supervisor but just the binary. I have tried to run is as git instead of gitea but still it complains about:
panic: interface conversion: interface {} is float64, not bool