Failing nix build cannot clean up temporary build directory, leading to "cannot unlink /tmp/drv-name/": Directory not empty #503

Closed
opened 2024-09-08 00:04:32 +00:00 by frontear · 3 comments

Describe the bug

As described above, the Nix (Lix?) builder fails to correctly clean up if a build fails, which slowly grinds a larger build to a halt (if this error occurs while building a dependant, for example). I personally noticed this when attempting to build packages from nixos-cosmic. After a little bit of time, a package would fail and the larger derivation that depended on these packages existing fails as well. This issue does not seem to be happening with Nix 2.18.5 (which I pulled directly from nixpkgs).

I also see this particular issue marked as a Nix regression upstream, as can be found here: https://github.com/NixOS/nix/issues/5207

If you have a problem with a specific package or NixOS,
you probably want to file an issue at https://github.com/NixOS/nixpkgs/issues.

Steps To Reproduce

  1. Obtain a correct revision of Lix (mine is nix (Lix, like Nix) 2.92.0-devpre20240830_d75df91)
  2. Clone my dotfiles repository via git clone https://github.com/Frontear/dotfiles
  3. Switch to the failing-build branch.
  4. Attempt a build from a derivation in my flake via nix build .#cachixJobs.LAPTOP-3DT4F02 (this is simply a pkgs.linkFarmFromDrvs derivation that builds nixos-cosmic packages, lix, and some other little tidbits for my binary cache).
  5. This will take time, but eventually one of the cosmic packages will fail with the above error.

Expected behavior

Expecting the build to take a long time but eventually succeed, because the derivations are correct. At the minimum though, even if it fails, it shouldn't fail with cleanup issues.

nix --version output

nix (Lix, like Nix) 2.92.0-devpre20240830_d75df91

Additional context

https://github.com/NixOS/nix/issues/5207
https://github.com/NixOS/nix/issues/9412

## Describe the bug As described above, the Nix (Lix?) builder fails to correctly clean up if a build fails, which slowly grinds a larger build to a halt (if this error occurs while building a dependant, for example). I personally noticed this when attempting to build packages from [nixos-cosmic](https://github.com/lilyinstarlight/nixos-cosmic). After a little bit of time, a package would fail and the larger derivation that depended on these packages existing fails as well. This issue does not seem to be happening with `Nix 2.18.5` (which I pulled directly from nixpkgs). I also see this particular issue marked as a Nix regression upstream, as can be found here: https://github.com/NixOS/nix/issues/5207 If you have a problem with a specific package or NixOS, you probably want to file an issue at https://github.com/NixOS/nixpkgs/issues. ## Steps To Reproduce 1. Obtain a correct revision of Lix (mine is `nix (Lix, like Nix) 2.92.0-devpre20240830_d75df91`) 2. Clone my dotfiles repository via `git clone https://github.com/Frontear/dotfiles` 3. Switch to the `failing-build` branch. 4. Attempt a build from a derivation in my flake via `nix build .#cachixJobs.LAPTOP-3DT4F02` (this is simply a `pkgs.linkFarmFromDrvs` derivation that builds nixos-cosmic packages, lix, and some other little tidbits for my binary cache). 5. This will take time, but eventually one of the cosmic packages will fail with the above error. ## Expected behavior Expecting the build to take a long time but eventually succeed, because the derivations are correct. At the minimum though, even if it fails, it shouldn't fail with cleanup issues. ## `nix --version` output ``` nix (Lix, like Nix) 2.92.0-devpre20240830_d75df91 ``` ## Additional context https://github.com/NixOS/nix/issues/5207 https://github.com/NixOS/nix/issues/9412
frontear added the
bug
label 2024-09-08 00:04:32 +00:00
Author

Nevermind! I did not take the time to carefully comb the logs, it is in fact a package itself that is failing to build. Furthermore it fails on Nix 2.18.5 (it had gone further than Lix so I suspected it had fixed the issue, but evidently not). Closing as invalid!

Nevermind! I did not take the time to carefully comb the logs, it is in fact a package itself that is failing to build. Furthermore it fails on Nix 2.18.5 (it had gone further than Lix so I suspected it had fixed the issue, but evidently not). Closing as invalid!
Owner

Hm. Well, we do still want to fix such bugs. I would really like a more minimal reproducer though, as that would make it much easier to figure out what is going wrong here.

Hm. Well, we do still want to fix such bugs. I would really like a more minimal reproducer though, as that would make it much easier to figure out what is going wrong here.
Author

Hi!

I definitely will look into grabbing a simpler reproducible environment for this, I actually ended up dropping cosmic completely after this, especially because I wasn't even using it much, which led to me forgetting about this issue.

Hi! I definitely will look into grabbing a simpler reproducible environment for this, I actually ended up dropping cosmic completely after this, especially because I wasn't even using it much, which led to me forgetting about this issue.
Sign in to join this conversation.
No milestone
No project
No assignees
2 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference: lix-project/lix#503
No description provided.