Getting mount related error

seeing this error when running builds inside nix shell on debian 12

src/main/tools/linux-sandbox-pid1.cc:320: "mount(/tmp/nix-shell.tHU8ZX, /tmp/nix-shell.tHU8ZX, nullptr, MS_BIND | MS_REC, nullptr)": No such file or directory

any pointers on how to solve would be greatly appreciated.

Not sure, but could it be that you need

sudo sysctl -w kernel.unprivileged_userns_clone=1

to enable user namespace (debian used to disable them by default, I think they recently enabled it by default but not sure)

If it does not solve your issue, can you maybe give the exact steps you follow so that we can reproduce the bug with minimal efforts?

1 Like

I also running into the same issue, after upgrading from bazel 6 to bazel 7 in my nix flake.

We hit this as well in Bazel 7 and found this fix which solved it for us:

You should be able to add a wrapper around the bazel executable and run unset TMPDIR TMP to fix it. For example, we have:

  bazel-wrapper = final.writeShellScriptBin "bazel" ''
    unset TMPDIR TMP
    exec ${final.pkgs.bazel_7}/bin/bazel "$@"
  '';