8000 nix profile add leaves its temporary profile tree in TMPDIR after success · Issue #16809 · NixOS/nix · GitHub
[go: up one dir, main page]

Skip to content

nix profile add leaves its temporary profile tree in TMPDIR after success #16809

Open

Description

@LiGoldragon

Describe the bug

nix profile add (install) leaves its temporary profile-building directory in $TMPDIR after it exits successfully. Each run leaves one nix-<pid>-<random> directory, which holds the profile's whole symlink tree and manifest.json.

For a desktop profile (Home Manager's installPackages step runs nix profile install), one leftover tree holds about 1.1 million entries; icon themes account for most of them. On a host whose /tmp is on the root filesystem, 79 such directories accumulated over a few weeks, about 26 million inodes in all. That exhausted the root's inodes, and later activations failed with No space left on device while creating symlinks.

Steps To Reproduce

mkdir -p /tmp/leak/tmp
TMPDIR=/tmp/leak/tmp nix profile add --profile /tmp/leak/prof "$(nix build --no-link --print-out-paths nixpkgs#jq.bin)"
echo "exit=$?"            # exit=0
find /tmp/leak/tmp        # nix-<pid>-<random>/manifest.json and bin/ remain
TMPDIR=/tmp/leak/tmp nix profile add --profile /tmp/leak/prof "$(nix build --no-link --print-out-paths nixpkgs#htop)"
find /tmp/leak/tmp        # a second nix-<pid>-<random>/ remains beside the first

Expected behavior

The temporary directory is removed when the command finishes, as it is once its contents have been added to the store.

Metadata

nix (Nix) 2.35.3, x86_64-linux, NixOS.

Activity

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

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions

      0