-
-
Notifications
You must be signed in to change notification settings - Fork 7
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
[Bug]: perhaps SNAPCRAFT_MANAGED_MODE=n should be set #31
Comments
I'm not sure why you're running with I'd like to see how you're getting around the requirements of systemd inside a container when running as non-root, as the usage of systemd is a design goal of this image, and cannot be run as non-root. It also requires privileged mode via Docker or the systemd support from podman (podman is minimally tested and likely doesn't work, and last I recall required running through |
I have just been digging into this, and I have to admit, using
I haven't fully explained the scenario. We're not running without any root user at all, as you say it wouldn't be possible to run systemd as non-root. We have configured the When not running in CI, and being run locally on an end users device, this helps make file permissions in the home directory easier to work with [ they don't end up with files owned as root there ]. It also enhances the security slightly and avoids the potential of unhappy accidents, as they can pass in any commands to run etc. When running in CI, it always runs as root on ephemeral infrastructure, with a very specific command set, and there are no issues around file permissions etc. Our systemd
Slight caveat, that get's modified to The reason we want to sue this locally, as well as in CI, is makes the build env consistent in all cases, when locally hacking/testing and building and publishing for production. Hope that explanation makes some sense. Back the original question, should Like I said , it's more a discussion point. Perhaps the answer is no, but I was interested to get your PoV 🙂 The primary reason to change it from our perspective it so prevent enforcing This fundamentally breaks the process when running as non-root. This only seems to be an issue using the non-legacy snapcraft code, so with building core22 base snaps. So I guess my question would be, what is the reason to set Thanks! |
One other issue that I just found which may be useful to consider. It seems like when using snapcraft fails with this error:
For instance, the reference
I believe this is somehow related to the fact that snap assets are copied to the users home directory, but some non-part elements do not seem copied, such as For comparison I did try using the snapcraft snap with the multipass provider, and the |
What happened?
Hi @diddledani
This is probably more of a discussion point, than a bug, as such. The answer may be that the current setting is the most correct after all.
First of all , full disclaimer, I am having to use a forked version of this repo. This is due to some internal reasons that wouldn't make sense to try and accommodate in this project directly. But I'm keeping it in sync as much as is practical. As it's a fork, we have also added the possibility to run snapcraft as non root user, because we are using the docker image to run locally sometimes as well as in CI, and on your own local host it's more secure and practical to use non root. [ Actually, I guess the non-root feature could be up-streamed if it was useful :) ]
The problem
It seems that for core22 snaps, setting
SNAPCRAFT_MANAGED_MODE=y
has some subtly different effects than < core22. The problem I found is that it seems to enforce setting/root
as the home path, which doesn't work well when the users is not root.https://github.com/snapcore/snapcraft/blob/main/snapcraft/utils.py#L167-L169
https://github.com/snapcore/snapcraft/blob/main/snapcraft/parts/lifecycle.py#L664-L667
I can of course simply change this for non-root users only in our fork, by setting
SNAPCRAFT_MANAGED_MODE=n
in that case. However, there are other benefits in CI environments of not using/root
for the rest of the project components, ans so am wondering if change toSNAPCRAFT_MANAGED_MODE=n
wholesale for every scenario makes more sense.Also worth noting we are running with
--destructive-mode
Any thoughts ? Is setting
SNAPCRAFT_MANAGED_MODE=y
needed for any other reason ?What should have happened?
perhaps SNAPCRAFT_MANAGED_MODE=n should be set ?
Output of
snap info $snap_name
Output of
snap connections $snap_name
Output of
snap version
Relevant log output
No response
Teminal output of app
No response
The text was updated successfully, but these errors were encountered: