-
Notifications
You must be signed in to change notification settings - Fork 74
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
Not as root incompatible with docker-based custompios build #141
Comments
https://github.com/mainsail-crew/MainsailOS/blob/develop/src/modules/crowsnest/start_chroot_script This is how we install crowsnest with custompios |
And we also provide a custompios module for it: https://github.com/mainsail-crew/crowsnest/blob/master/custompios/README.md |
I use the provided start_chroot_script and config--the problem is that if you build using custompios's instructions for docker-based builds, docker uses the root user to build which conflicts with this check against root https://github.com/guysoft/CustomPiOS/wiki/Building-with-Docker |
ah ok. then we have to wait for @KwadFan. |
I forked the repo and am testing a fix. I think replacing ${SUDO_USER} with ${USER} should be acceptable. ${SUDO_USER} refers to the logged in user and I think will always be root for docker, but if you want to make sure the user executing the command is not root, and is a sudoer, then ${USER} is better, with the SUDO_USER check following left there. |
I tried to follow your thought process. But it shouldnt matter who builds the image. The custompiosos module skipps checking for root ^^ Otherwise we werent also not able to build Images. Please attach some kind of log and your config file. Regards Kwad |
from my CustomPiOS build log: Launch crowsnest install routine ...
make: *** [Makefile:17: install] Error 1 ${SUDO_USER} evaluates to root when building from docker, so in the install.sh it triggers the not_as_root_msg, even if i call make install as non-root, i.e, sudo -u SOMEOTHERSUDOER make install. can you clarify what you mean that the custompios module skips checking for root? the custompios module calls make install, which calls install.sh that has the check for root? |
I will have a PR for you soon to review, hopefully it will clarify things.
|
btw, if you are not building the pi image from a docker container, you will not have run into this issue. this is a docker-based build specific issue |
…patibility Addresses mainsail-crew#141
I finally found time to test the docker setup and fiddle around with it a little bit.
You mentioned this in #142, so did you change the Now to my results. It seems like there is no Running the following script inside the CustomPiOS docker (edit: with a custom module mentioned inside the next post): echo ${USER}
echo ${BASE_USER}
echo ${SUDO_USER} Gives following results without calling with
pi
And with root
root Note: Those empty lines aren't defined and not just wrong formatting. So your modifications inside #142 and #155 both only account for the change to a |
Here my test setup to get the users.
This will print out to green "lines" and between the results. |
There is a difference between directly echoing environment variables in Custompios's docker image versus echoing environment variables as part of the "build/package" process for custompios. When you call build in custompios, environment variables are injected, so they will no longer be empty. SUDO_USER and USER I would call OS variables. SUDO_USER is empty if you are not sudoing as the user running the command. The only change I made to my crowsnest start_chroot_script that differs from yours is: echo_green "Launch crowsnest install routine as ${BASE_USER}..." to make it work with my fork/PR. If I use the original start_chroot_script where it is "sudo make install" , and I point at your master HEAD, I get the error I shared where it prints not_as_root_msg |
You are partly correct with the thing you wrote. Also as a small note. The test module I provided is also the correct way to get the "buildchain" variables and even if it would be wrong. Those printed on my personal branch have to be the correct ones, as those shouldn't differ between echo and calling them inside an if statement. |
I just realized that you made a mistake.
That's wrong the correct one would be |
I was originally pointing at https://github.com/mainsail-crew/crowsnest/ not your specific fork |
Using your repo & using make install ... �[31mcrowsnest�[0m - A webcam daemon for multiple Cams and stream services. This worked. I'm trying to think about what happened when I first tried this, with no changes. I only forked because I ran into a problem, otherwise I would not bother :). I think when I first tried to build, I ran into the "need_sudo_msg" which says please try sudo make install. Perhaps the pi user was not a sudoer yet? I'm running another build, this time pointing at mainsail-crew/crowsnest instead of your fork just to confirm. |
Only my fork will work atm, as there is already the fix implemented 😄 |
Cool! I'm happy to discard my PR, really didn't like 99% copy of the install script lol. I'm also glad that we were able to confirm that there's a legitimate issue there |
Can also confirm the need root message against the mainsail-crew/crowsnest:HEAD . Now I know how I got to the mess I did :)
Exiting... |
@mitant |
Works! |
Is your feature request related to a problem? Please describe
When using CustomPiOs to build a custom image with crowsnest as a module, the build fails because of the following lines:
Describe the solution you'd like
Allow root to install, generate a warning message instead and let it proceed. Or add a new make target that disables this check, like make install-docker
Describe alternatives you've considered
No response
Additional information
No response
The text was updated successfully, but these errors were encountered: