Skip to content
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

Start.sh bug on Debian while executing on non-root user #120

Closed
LookedPath opened this issue May 4, 2022 · 2 comments
Closed

Start.sh bug on Debian while executing on non-root user #120

LookedPath opened this issue May 4, 2022 · 2 comments
Assignees

Comments

@LookedPath
Copy link

Hello,
if you execute the start.sh script with a non-root user the /sbin/route command won't be found and so the startup procedure won't continue.
This is because /sbin is not in the path of non root users.
You should consider using an alternative method to check for an internet connection or adding /sbin to the path if it's not already present.

@TheRemote
Copy link
Owner

TheRemote commented May 4, 2022

Hello,

Thanks for reminding me of this. Someone let me know on my web site that this was indeed still a thing a few weeks ago here. I believe this issue is specific to Debian (at least I haven't heard of it happening on any other ones). I used to have the path hard coded to get around the Debian issue but what ended up happening is that some other flavors didn't have the route binary on the /sbin path so the "fix" was causing it to break on other platforms.

Because I've been on both sides of this problem at different times I coded a solution for both like this:

if [ -e '/sbin/route' ]; then
    DefaultRoute=$(/sbin/route -n | awk '$4 == "UG" {print $2}')
else
    DefaultRoute=$(route -n | awk '$4 == "UG" {print $2}')
fi

It's a little bit more hacky than I usually like to do but this issue has a bit of history on here and this should take care of both scenarios. Supporting a wide range of flavors can often lead to a few inconsistencies like this and it's a wonder there aren't a lot more of them in the script. Thank you!

@LookedPath
Copy link
Author

Yeah I believe this is an issue with just Debian as I haven't seen it happen on any other distro.
I manually solved my issue by adding /sbin to the path of the user that launches the server and by launching again the setup script, that added /sbin to the path and it started working again.
Making a script that works on multiple platforms must be a nightmare, thank you for the quick response and the quick fix.

@TheRemote TheRemote self-assigned this May 11, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants