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

NixSupported probes for the nix snapshotter before enabling it: exec.LookPath('nix-store') fails, so the nix snapshotter cannot be used. The error names the remedy explicitly (install nix).

Source

Thrown at pkg/containerd/utility_linux.go:29

	stargz "github.com/containerd/stargz-snapshotter/service"
	"github.com/pdtpartners/nix-snapshotter/pkg/nix"
)

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) and confirm `nix-store --version` works from the same environment k3s runs in (systemd service context).
  2. If nix is not actually wanted, switch back to the default snapshotter: restart with --snapshotter overlayfs (or remove the nix image-store config).
  3. For multi-user nix installs, ensure /nix/var/nix/daemon socket is reachable by the k3s service user.

Example fix

# before
k3s server --snapshotter nix   # nix-store: not found
# after (either)
nix-env -iA nixpkgs.nix && k3s server --snapshotter nix
# or fall back to the default
k3s server --snapshotter overlayfs
Defensive patterns

Strategy: validation

Validate before calling

// Check the binary exists before selecting the snapshotter:
if cfg.Snapshotter == "nix" {
	if _, err := exec.LookPath("nix-store"); err != nil {
		log.Fatalf("--snapshotter nix requires nix; install from https://nixos.org/download")
	}
}

Try / catch

if err := containerd.NixSupported(root); err != nil {
	if strings.Contains(err.Error(), "nix-store not found in PATH") {
		cfg.Snapshotter = "overlayfs" // deliberate downgrade, or abort to install nix
	}
}

Prevention

When it happens

Trigger: Containerd configured to use the nix snapshotter (e.g., --snapshotter nix or image-store selection) on a host where nix is not installed or not on the service's PATH.

Common situations: Config copied from a NixOS-style setup onto a plain Linux host; nix installed per-user but k3s runs as a systemd service with a minimal PATH; container image missing the nix binary.

Related errors


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