k3s-io/k3s · error

nix-store not found in PATH: install nix (https://nixos.org/

Error message

nix-store not found in PATH: install nix (https://nixos.org/download) to use the nix snapshotter

What it means

Returned by NixSupported() when the nix snapshotter is requested but the nix-store binary is not on PATH. k3s supports multiple containerd snapshotters (fuseoverlayfs, stargz, nix); the nix one shells out to nix-store, so k3s probes for the executable with exec.LookPath before delegating to nix.Supported(root). The error is a hard prerequisite failure, not a runtime snapshotter error.

Source

Thrown at pkg/agent/containerd/config_linux.go:140

	return containerd.New(addr)
}

func OverlaySupported(root string) error {
	return overlayutils.Supported(root)
}

func FuseoverlayfsSupported(root string) error {
	return fuseoverlayfs.Supported(root)
}

func StargzSupported(root string) error {
	return stargz.Supported(root)
}

func NixSupported(root string) error {
	if _, err := exec.LookPath("nix-store"); err != nil {
		return errors.New("nix-store not found in PATH: install nix (https://nixos.org/download) to use the nix snapshotter")
	}
	return nix.Supported(root)
}

View on GitHub (pinned to 6ba341e396)

Solutions

  1. Install nix (https://nixos.org/download) on the node and confirm `nix-store --version` works for the same user/context k3s runs as
  2. If nix is installed but not found, add its bin dir to PATH for the k3s systemd unit (e.g. Environment=PATH=/nix/var/nix/profiles/default/bin:/usr/bin:... ) and `systemctl daemon-reload`
  3. If you did not intend to use nix, drop --snapshotter=nix and use the default snapshotter

Example fix

# before
k3s agent --snapshotter=nix ...
# -> nix-store not found in PATH

# after (install nix, then)
nix-store --version
k3s agent --snapshotter=nix ...
Defensive patterns

Strategy: validation

Validate before calling

if nodeConfig.Snapshotter == "nix" {
    if _, err := exec.LookPath("nix-store"); err != nil {
        return fmt.Errorf("cannot use nix snapshotter: install nix first (https://nixos.org/download)")
    }
}

Prevention

When it happens

Trigger: Starting the agent with --snapshotter=nix (or a config enabling the nix snapshotter) on a host where nix-store is not installed or not in the service's PATH; running k3s as a systemd service whose PATH does not include /nix/var/nix/profiles/default/bin or the profile where nix is installed.

Common situations: Nix installed per-user (via nix-env) so root/systemd cannot see nix-store; single-user nix installation not linked into the global PATH; container images that enable the nix snapshotter without installing nix.

Related errors


AI-assisted analysis of k3s-io/k3s@6ba341e396 (2026-08-15). Data as JSON: /api/errors/34ad33ec8637033a. Report an issue: GitHub.