-
-
Notifications
You must be signed in to change notification settings - Fork 5.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Failed to get home directory: Cannot specify home directory because it's empty #9541
Comments
The FHS compliant script wasn't really intended to be used with special inits like that - rather it was just to make normal working practice work - with that init it's intended that you just point it to the Gitea binary. (The purpose of the FHS compliant script is to allow one to use standard scripts without special adjustments. I'm also not certain how start-stop-daemon reacts to a script in exec - it may work but you likely need to use the pid option on the Gitea command and adjust accordingly.) However let's look at what went wrong:
gitea/contrib/init/debian/gitea Line 44 in d59536c
I suspect that DAEMON_ARGS is being passed as a single argument and not being split by field when it's passed to exec. I suspect that line should use ${DAEMON_ARGS} instead to ensure that the arguments are split. (No surrounding quotes and I'm not sure if that's the right syntax.) Some judicious use of echo should be able to prove my suspicions.
https://github.com/unknwon/com/blob/da59b551951d50441ca26b7a8cd81317f34df87f/path.go#L63-L80 If this returns an error then you get the log message you're seeing. Basically it looks like the HOME environment variable isn't set. That's very odd as if it's in the environment for the FHS script then it should be in the environment for the Gitea command, leading to the conclusion that: gitea/contrib/init/debian/gitea Lines 42 to 44 in d59536c
Is not passing the HOME variable to Gitea A quick look at stack overflow confirms my suspicion, start-stop-daemon does not pass the environment: https://serverfault.com/questions/128389/can-start-stop-daemon-use-environmental-variables The exec command would need to be So although the problem looked like it was with the FHS script and the interaction with the init script at the start - I suspect it's more a few bugs with the init script. See if you can fix the two things I've mentioned and if restart works properly with the FHS script in place - if not you might need to point the init script directly at the shadowed Gitea binary but keep in touch with us and we can update the contrib script with your findings. |
Thanks for your response, and for being willing to provide support for my nonstandard configuration.
I replaced
This seems to conflict with the previous change, as it omits
I tried reverting the changes I just made to the init script, setting
but then went back to my browser and am still able to browse Gitea. If it's still running then I am not particularly committed to using the init script or the FSH script. Those are just the things I tried. What do you think is the path of least resistance to a working setup with SysVinit? |
Okay, I did try rebooting with the init script pointing directly to the binary in |
Ok. Redrop the -c from Daemon args and stick into the Gitea FHS script: if [ -z "$HOME" ]; then
export HOME="/home/$USER"
fi (That's assuming that user gets set otherwise you could just export HOME=/home/git.) I'm still concerned that the arguments are being passed as a single argument not as separate arguments. You could test that by adding an echo in the appropriate place in the script. That could be the fault of the start-stop-daemon script. As I said above I would worry that stop and restart aren't going to work properly with execing a script - you likely need to make Gitea make it's own pid file In terms of actual Gitea issues here - I think we should reconsider if we really need the HOME environment set. We probably do because of git and gpg but I'll have a think. Finally why are you using sysvinit? It really does require a lot of shell knowledge. |
Thanks. You put me on the right track, and I think I have everything working now. I decided to give up on the FSH wrapper, accept that Gitea looks for everything in its own directory, and wherever that annoys me to give Gitea a symlink to my preferred location.
Gitea now runs with no errors and respects Thanks for all your help. Closing. |
[x]
):Description
I have installed Gitea on Debian 10, mostly following these instructions, deviating in the following ways:
I installed the FSH-compliant wrapper script to
/usr/bin
I installed the Gitea 1.10.1 binary to
/usr/lib/gitea/gitea
, since that's where the wrapper script expects it to be.I am using SysVinit rather than systemd, so instead of the systemd unit file I used this init script, changing
DAEMON=/usr/local/bin/$NAME
toDAEMON=/usr/bin/$NAME
in order to point to the FHS wrapper script.I ran
sudo service gitea start
, and at first everything seemed fine. I was able to install Gitea via the web interface, create a user, and push several repos. However, upon making some changes to/etc/gitea/app.ini
and runningsudo service gitea restart
, I got the following warning and error:Although Gitea restarted successfully, I found that my changes to
app.ini
had not taken effect. These messages also appeared when I ran Gitea for the first time, but I did not pay close attention to them at the time.The first message appears to be an issue of
"/etc/gitea/app.ini"
getting appended to the custom config path. My suspicion was that this is because of the lineDAEMON_ARGS="web -c /etc/$NAME/app.ini"
, and that the-c
argument might be redundant with the wrapper script. I tried changing it toDAEMON_ARGS="web"
, and restarted Gitea.This time, I only got the second message:
Failed to get home directory: ...
. However, Gitea no longer worked properly. Many pages gave a 500 error. I then reverted my change to the init script and restarted, but still got the 500 errors. I tried hacking at the init and wrapper scripts for a while, but could not get back to where I was, let alone fix the original problem. I gave up, deleted all Gitea files, and started fresh.I am now back to where I was, with the same two messages and my changes to
app.ini
not taking effect. This time I don't want to mess with anything before I understand exactly what's going on. Can anyone provide some insight? Thanks.The text was updated successfully, but these errors were encountered: