You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
RFC: Hazards of the modern unprivileged Guix daemon configuration #36239
According to the Guix documentation, there are two ways to configure the Guix daemon:
running guix-daemon as "root", letting it run build processes as unprivileged users taken from a pool of build users...
running guix-daemon as a separate unprivileged user, relying on Linux's unprivileged user namespace functionality to set up isolated environments...
The latter is the option chosen when installing Guix on a systemd-based distribution with the installation script.
Unfortunately, the two configurations produce observably different build environments. Consequently, some packages' test suites fail on the unprivileged daemon. Some of those packages are dependencies of our Guix environments. For example, here is the test failure for python-distlib:
Users with an unprivileged daemon encounter such errors whenever a dependency is built locally rather than substituted, either because they pass --no-substitutes or because no substitutes exist for their platform (for example, on RISC-V systems). On x86_64 and aarch64 the problem is masked by substitutes, which are built on Guix's build farm with the privileged daemon.
Although failures of this class are known upstream, we should address the issue at the Bitcoin Core project level as well.
Here are some possible approaches:
Provide a shell script that detects the Guix daemon configuration and warns about the unprivileged one.
Document a migration path from the unprivileged daemon to the privileged one (note that Guix documents the migration in the opposite direction only).
Would the ideal solution here not be that we (and Guix) nudge users towards the more secure unprivileged solution, and that this worked to build correctly, i.e. the opposite of what you are recommending? Working under the assumption that these failures will be ironed out as the (relatively new) rootless-daemon approach gets more usage/testing.
If we must choose between one or the other today though, and the rootless approach is broken, then I'd agree that perhaps we can detect/warn towards requiring the root approach.
FWIW the nixpkgs Guix service uses the privileged approach, with no built-in option to change.
Document a migration path from the unprivileged daemon to the privileged one
I don't think telling users to use Guix in a less secure way, is a great solution, and that goes in the opposite direction of what Guix itself is doing.
Here are some possible approaches:
I think one of the options should be patching the (I assume few?) packages in our dependency graph to work around this for now (and submitting relevant changes upstream). That seems better than introducing a warning that the build might fail (option 1).
Would the ideal solution here not be that we (and Guix) nudge users towards the more secure unprivileged solution, and that this worked to build correctly, i.e. the opposite of what you are recommending? Working under the assumption that these failures will be ironed out as the (relatively new) rootless-daemon approach gets more usage/testing.
Document a migration path from the unprivileged daemon to the privileged one
I don't think telling users to use Guix in a less secure way, is a great solution, and that goes in the opposite direction of what Guix itself is doing.
I do not mean to nudge or force users toward permanently using a less secure Guix build daemon configuration. My goal is simply to ensure that people facing the same issue are aware of possible workarounds.
Here are some possible approaches:
I think one of the options should be patching the (I assume few?) packages in our dependency graph to work around this for now (and submitting relevant changes upstream). That seems better than introducing a warning that the build might fail (option 1).
Patching packages upstream, as is done in 482b131, doesn't change the fact that different Guix build daemon configurations provide different package build environments, which in turn can lead to non-reproducible builds.
Thanks for the discussion, everyone. I understand there are differing opinions here on whether to nudge users toward the privileged daemon or not. Since my goal is just to ensure users don't waste hours on broken builds, I am happy to take this PR in whatever direction you all agree on.
Option A: Leave the PR as is (Warning + Documentation) as @hebasto mentioned, even if upstream packages are patched, different daemon configurations fundamentally provide different build environments, which arguably goes against the spirit of reproducible builds. This PR ensures everyone is compiling in the exact same privileged environment.
Option B: Bump the Guix Commit natively - if the consensus is that we should absolutely not warn against the unprivileged daemon, the best solution is to just inherit the upstream Guix fixes. For example, Guix explicitly fixed the python-distlib unprivileged daemon in test failure 2 months ago (in Guix commit 482b131). We could simply bump the GUIX_COMMIT in contrib/guix/libexec/prelude.bash to the latest Guix master hash (e.g., 7e74121a40a8308166e328a23647cf6f3768e6c8) to pull in these fixes naturally without touching our manifests (contrib/guix/manifest_build.scm).
However, I understand that bumping the Guix commit affects the entire toolchain and is typically reserved for its own dedicated PR.
Let me know which of these two paths you prefer, and I'll update or close the PR accordingly!
Isn't this a case of the build either succeeding (reproducible), or it not completing at all?
Patching packages upstream, as is done in 482b131, doesn't change the fact
In any case, why wouldn't the issue here be mitigated by:
patching the (I assume few?) packages in our dependency graph
If our manifest is fixed, why would the different build daemons produce different results?
Theoretically, the daemon mode is an unpinned input to the build environment. For example, a toolchain component can observe the difference in the build environment at configure time and choose a different code path, which in turn changes its behaviour and therefore the Bitcoin Core binaries it produces.
I don't expect this to be the case for our current dependency graph, but it can only be verified by building with --no-substitutes under the two daemon configurations and comparing the results.
Theoretically, the daemon mode is an unpinned input to the build environment. For example, a toolchain component can observe the difference in the build environment at configure time and choose a different code path, which in turn changes its behaviour and therefore the Bitcoin Core binaries it produces.
our build environment is containerised though, right. so this shouldn’t be an issue for us?
or do you mean guix builds a different derivation depending on daemon or not (this would seem ver concerning!)
Note that the derivation and the output path are identical, yet the contents of probe differ. Both builds succeed, so this is a different-output case, not a build-failure case.
Right. It is one thing if a package embeds the uid at compile time into itself. It seems certainly a bug if a package then embeds that stuff in some way or another into Bitcoin Core. Such a bug should be fixed and reported upstream, just like any other upstream bug?
Activity
hebasto commentedon Sep 13, 2026
The test failure for this package has been fixed in
482b131.willcl-ark commentedon Sep 14, 2026
Would the ideal solution here not be that we (and Guix) nudge users towards the more secure unprivileged solution, and that this worked to build correctly, i.e. the opposite of what you are recommending? Working under the assumption that these failures will be ironed out as the (relatively new) rootless-daemon approach gets more usage/testing.
If we must choose between one or the other today though, and the rootless approach is broken, then I'd agree that perhaps we can detect/warn towards requiring the root approach.
FWIW the nixpkgs Guix service uses the privileged approach, with no built-in option to change.
fanquake commentedon Sep 14, 2026
I don't think telling users to use Guix in a less secure way, is a great solution, and that goes in the opposite direction of what Guix itself is doing.
I think one of the options should be patching the (I assume few?) packages in our dependency graph to work around this for now (and submitting relevant changes upstream). That seems better than introducing a warning that the build might fail (option 1).
hebasto commentedon Sep 14, 2026
I do not mean to nudge or force users toward permanently using a less secure Guix build daemon configuration. My goal is simply to ensure that people facing the same issue are aware of possible workarounds.
Patching packages upstream, as is done in
482b131, doesn't change the fact that different Guix build daemon configurations provide different package build environments, which in turn can lead to non-reproducible builds.fanquake commentedon Sep 14, 2026
Isn't this a case of the build either succeeding (reproducible), or it not completing at all?
In any case, why wouldn't the issue here be mitigated by:
If our manifest is fixed, why would the different build daemons produce different results?
Ronin95 commentedon Sep 14, 2026
Thanks for the discussion, everyone. I understand there are differing opinions here on whether to nudge users toward the privileged daemon or not. Since my goal is just to ensure users don't waste hours on broken builds, I am happy to take this PR in whatever direction you all agree on.
Option A: Leave the PR as is (Warning + Documentation) as @hebasto mentioned, even if upstream packages are patched, different daemon configurations fundamentally provide different build environments, which arguably goes against the spirit of reproducible builds. This PR ensures everyone is compiling in the exact same privileged environment.
Option B: Bump the Guix Commit natively - if the consensus is that we should absolutely not warn against the unprivileged daemon, the best solution is to just inherit the upstream Guix fixes. For example, Guix explicitly fixed the
python-distlibunprivileged daemon in test failure 2 months ago (in Guix commit482b131). We could simply bump theGUIX_COMMITincontrib/guix/libexec/prelude.bashto the latest Guix master hash (e.g.,7e74121a40a8308166e328a23647cf6f3768e6c8) to pull in these fixes naturally without touching our manifests (contrib/guix/manifest_build.scm).However, I understand that bumping the Guix commit affects the entire toolchain and is typically reserved for its own dedicated PR.
Let me know which of these two paths you prefer, and I'll update or close the PR accordingly!
maflcko commentedon Sep 17, 2026
I think this is also the correct fix to the general problem here: If there is a bug in guix upstream (or even in an upstream package), the bug should be fixed there. In the meantime, any of the already documented workarounds can be used during installation (e.g. https://github.com/bitcoin/bitcoin/blob/master/contrib/guix/INSTALL.md#workaround-3-disable-the-tests-in-the-guix-source-code-for-this-single-derivation)
Same goes for non-reproducibility, but I guess I am just repeating what was already said above by the others?
Maybe this issue can be closed?
fanquake commentedon Sep 19, 2026
Yea. I think we've gone with the option of:
as 49fec20 in #36233, and those changes can be up-streamed as needed, i.e https://codeberg.org/guix/guix/issues/10128#issuecomment-20014321.
hebasto commentedon Sep 30, 2026
Theoretically, the daemon mode is an unpinned input to the build environment. For example, a toolchain component can observe the difference in the build environment at configure time and choose a different code path, which in turn changes its behaviour and therefore the Bitcoin Core binaries it produces.
I don't expect this to be the case for our current dependency graph, but it can only be verified by building with
--no-substitutesunder the two daemon configurations and comparing the results.Sjors commentedon Sep 30, 2026
FWIF I always use
--no-substituteshebasto commentedon Sep 30, 2026
I'm wondering what your current Guix daemon configuration is?
Sjors commentedon Sep 30, 2026
@hebasto
guix-daemon.service:So it's privileged IIUC. I'll look into changing that...
willcl-ark commentedon Sep 30, 2026
our build environment is containerised though, right. so this shouldn’t be an issue for us?
or do you mean guix builds a different derivation depending on daemon or not (this would seem ver concerning!)
hebasto commentedon Sep 30, 2026
Consider the following MRE.
With the privileged Guix daemon on Fedora 44:
With the unprivileged Guix daemon on Ubuntu 26.04:
Note that the derivation and the output path are identical, yet the contents of
probediffer. Both builds succeed, so this is a different-output case, not a build-failure case.willcl-ark commentedon Oct 6, 2026
I think I'd expect outputs to have different permissions as a difference between the two privilege models?
Surely the entire idea is that outputs are not root-owned, unless I'm missing something here...
maflcko commentedon Oct 6, 2026
Right. It is one thing if a package embeds the uid at compile time into itself. It seems certainly a bug if a package then embeds that stuff in some way or another into Bitcoin Core. Such a bug should be fixed and reported upstream, just like any other upstream bug?
Not sure what needs to be done here. I think a few builders can follow https://guix.gnu.org/manual/devel/en/html_node/Build-Environment-Setup.html#Migrating-to-the-Unprivileged-Daemon if they want (and then share that they did so in their guix builds).
willcl-ark commentedon Oct 6, 2026
I have patched my NixOS system to use an local nixpkgs with an unprivileged Guix package.
Will kick a Guix build off later this evening and report back...
willcl-ark commentedon Oct 7, 2026
This seems to currently work correctly per results in: #36029 (comment)
hebasto commentedon Oct 13, 2026
You also have to disable substitutes.