hashicorp/packer · warning

failed to write local binary checksum file: %s

Error message

failed to write local binary checksum file: %s

What it means

InstallLatest failed to write the sidecar checksum file (<binary>.SHA256SUM) next to the freshly installed plugin binary. It logs a warning, then removes the just-installed binary and skips to the next version — the plugin is effectively not installed by this attempt.

Source

Thrown at packer/plugin-getter/plugins.go:932

						err = fmt.Errorf("could not create final plugin binary file: %w", err)
						errs = multierror.Append(errs, err)
						return nil, errs
					}
					if _, err := outputFile.Write(outputFileData.Bytes()); err != nil {
						err = fmt.Errorf("could not write final plugin binary file: %w", err)
						errs = multierror.Append(errs, err)
						return nil, errs
					}
					outputFile.Close()

					cs, err = checksum.Checksummer.Sum(&outputFileData)
					if err != nil {
						err := fmt.Errorf("failed to checksum binary file: %s", err)
						errs = multierror.Append(errs, err)
						log.Printf("[WARNING] %v, ignoring", err)
					}
					if err := os.WriteFile(outputFileName+checksum.Checksummer.FileExt(), []byte(hex.EncodeToString(cs)), 0644); err != nil {
						err := fmt.Errorf("failed to write local binary checksum file: %s", err)
						errs = multierror.Append(errs, err)
						log.Printf("[WARNING] %v, ignoring", err)
						os.Remove(outputFileName)
						continue
					}

					// Success !!
					return &Installation{
						BinaryPath: strings.ReplaceAll(outputFileName, "\\", "/"),
						Version:    "v" + version.String(),
					}, nil
				}

			}
		}
	}

	if len(versions) == 0 {

View on GitHub (pinned to eb36e3c3e4)

Solutions

  1. Free disk space on the plugins partition and re-run `packer init`
  2. Fix ownership/permissions on ~/.packer.d/plugins (e.g. sudo chown -R $USER ~/.packer.d)
  3. Remove leftover partial files from the plugin directory and retry cleanly
  4. Avoid running multiple packer init processes concurrently against the same plugin path
  5. Set PACKER_PLUGIN_PATH to a writable directory if the default is restricted

Example fix

// before
-rw-r--r-- 1 root root plugin_v1.0.0  # installed by sudo, sidecar write as user fails
// after
sudo chown -R $USER ~/.packer.d && packer init .
Defensive patterns

Strategy: validation

Validate before calling

import "os"
// verify plugins dir is writable before init
test := filepath.Join(pluginDir, ".write-test")
if err := os.WriteFile(test, []byte("x"), 0o644); err != nil {
    return fmt.Errorf("cannot write to %s: %w", pluginDir, err)
}
os.Remove(test)

Prevention

When it happens

Trigger: os.WriteFile(outputFileName+checksum.Checksummer.FileExt(), ...) fails during InstallLatest — no write permission in the plugin dir, disk full, or path collision.

Common situations: Full disk after writing a large plugin binary; plugin directory owned by another user; read-only filesystem mount; concurrent packer processes racing in the same plugin directory.

Related errors


AI-assisted analysis of hashicorp/packer@eb36e3c3e4 (2026-09-05). Data as JSON: /api/errors/bdc33452db8e85a0. Report an issue: GitHub.