-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
Nix build processes on non-NixOS have nogroup
in their supplementary groups
#3245
Comments
Can you also |
I edited the description to add some more information about the test failure and sandbox environment. :) |
It kind of looks like before entering the sandbox there was an extra group (or maybe This is a debugging direction proposal, not a real answer. of course. |
Sorry, it looks like when I edited the description most recently GitHub actually had me edit an old version, and some information was lost. I've put it back. |
Are you running Nix in a single-user mode? How many groups you user id has? |
No @7c6f434c, all of the above are in multi-user mode (for the non-NixOS users bog-standard Nix installs, by running the installer script from the site). I (NixOS) have six; the Arch user has four; the Ubuntu user has nine. |
(nobody is in The Nix daemon shouldn't know anything about our user groups, though, right? |
I can't reproduce this on Ubuntu 18.04 or 19.04. Note however that this is expected behaviour when using a chroot store as a non-root user. To quote from /* Drop additional groups here because we can't do it
after we've created the new user namespace. FIXME:
this means that if we're not root in the parent
namespace, we can't drop additional groups; they will
be mapped to nogroup in the child namespace. There does
not seem to be a workaround for this. (But who can tell
from reading user_namespaces(7)?)
See also https://lwn.net/Articles/621612/. */
if (getuid() == 0 && setgroups(0, 0) == -1)
throw SysError("setgroups failed"); |
Hm, seven copies of nogroup does kind of matches one-main and six-additional groups… but if you are using Nix-daemon… For further debugging I would consider starting some very slow build ( |
This is because group mapping is not properly setup in a UID namespace. |
Thanks for the tips in this issue 👍. What I ended up doing was take my user out of all groups except its primary one just to work around this for now. Seems like there's an issue also open in the Go repository, which gave me the tip that these specific tests break because of the |
I marked this as stale due to inactivity. → More info |
Workaround for <golang/go#42525> (Also related to <NixOS/nix#3245>)
Workaround for <golang/go#42525> (Also related to <NixOS/nix#3245>)
Workaround for <golang/go#42525> (Also related to <NixOS/nix#3245>)
Workaround for <golang/go#42525> (Also related to <NixOS/nix#3245>) (cherry picked from commit af3cd7c)
Workaround for <golang/go#42525> (Also related to <NixOS/nix#3245>) (cherry picked from commit a66d9c8)
Still hitting this after 3 years...
|
After some researching on user namespace, i think this should be closed as I think the best course of action is to just warn the user when they are not building using the nix daemon. |
We need root permission to drop supplementary groups, and if we don't do that, some builds can fail in user namespace, most noteably go. Related: NixOS#3245
We need root permission to drop supplementary groups, and if we don't do that, some builds can fail in user namespace, most notably go. Related: NixOS#3245
We need root permission to drop supplementary groups, and if we don't do that, some builds can fail in user namespace, most notably go. Related: NixOS#3245
Workaround for <golang/go#42525> (Also related to <NixOS/nix#3245>)
Workaround for <golang/go#42525> (Also related to <NixOS/nix#3245>)
We need root permission to drop supplementary groups, and if we don't do that, some builds can fail in user namespace, most notably go. Related: NixOS#3245
We need root permission to drop supplementary groups, and if we don't do that, some builds can fail in user namespace, most notably go. Related: NixOS#3245
We need root permission to drop supplementary groups, and if we don't do that, some builds can fail in user namespace, most notably go. Related: NixOS#3245
We need root permission to drop supplementary groups, and if we don't do that, some builds can fail in user namespace, most notably go. Related: NixOS#3245
Nix on non-NixOS seems to add
nogroup
to the build process's supplementary groups, even thoughnixbld
isn't actually a member ofnogroup
in the sandbox.NixOS (note the lack of
64434(nogroup)
at the end of theid
line):Arch (thanks @paddygord):
Ubuntu 18.04 (thanks @tiagolam):
We're all using Nix 2.3.1.
This breaks tests for Go (e.g.
go_bootstrap
in nixpkgs): the Go test suite includes a testTestChown
that attempts to change the group for each supplementary group given bygetgroups
, but this fails fornogroup
. The failure looks like so:/etc/passwd
in the sandbox looks like this (on both NixOS and non-NixOS):and
/etc/group
looks like this:The text was updated successfully, but these errors were encountered: