Skip to content

Check whether /nix/store and $TMPDIR have noexec set #157

Open

Description

@edolstra

If /tmp or /nix has noexec set, then builds fail mysteriously with messages like:

no configure script, doing nothing

Activity

  1. stale commented on Feb 16, 2021

    @stale

    I marked this as stale due to inactivity. → More info

  2. dbaynard commented on Oct 4, 2021

    @dbaynard

    I’ve encountered this; I bind-mounted a new tmpfs for nix builds.

    In https://github.com/NixOS/nixpkgs/blob/86a3d865f4b05fb8c913980b6d470802e70fe577/pkgs/stdenv/generic/setup.sh#L1000-L1045, the relevant lines seem to be

    if [[ -z "$configureScript" && -x ./configure ]]; then
        configureScript=./configure
    fi
    

    The executable bit is set, but on macos at least -x ./configure is still false on a noexec mount. The simplest way I found to test whether the bit is set independently of the mount is with stat -c '%a' ./configure or stat -f '%0Lp' ./configure (linux/macos) and then comparing octals… but that seems hacky. With that, though, we’d then attempt to execute ./configure and so get an error message at the correct point.

    I’m not sure how useful it is to actually fix this, but if there is an elegant solution it’s probably worthwhile.

  3. stale commented on Apr 16, 2022

    @stale

    I marked this as stale due to inactivity. → More info

  4. added
    feature
    UX
    error-messages
    and removed on Sep 12, 2022
  5. removed their assignment
    on Apr 26, 2024
  6. arianvp commented on Jan 1, 2025

    @arianvp
    Member

    It'd be nice if nix builds could work with noexec set on /tmp . It's actually a requirement in many hardened setups. What would be needed to make that work? Could we use something like PrivateTmp for nix builds where we add a new /tmp in a mount namespace ?

  7. added a commit that references this issue on Aug 4, 2025
  8. added a commit that references this issue on Aug 5, 2026
  9. added 2 commits that reference this issue on Aug 9, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    UXerror-messagesfeature

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions