hashicorp/nomad · error

mount point detection failed for volume (%s): %v

Error message

mount point detection failed for volume (%s): %v

What it means

After creating the staging directory, ensureStagingDir calls mount.IsNotAMountPoint to verify whether the path is already a mount point. If that detection itself fails, stageVolume aborts with this error carrying the wrapped OS/mount error.

Source

Thrown at client/pluginmanager/csimanager/volume.go:449

// and then validates that the path is not already a mount point for e.g an
// existing volume stage.
//
// Returns whether the directory is a pre-existing mountpoint, the staging path,
// and any errors that occurred.
func (v *volumeManager) ensureStagingDir(vol *structs.CSIVolume, usage *UsageOptions) (string, bool, error) {
	hostStagingPath := v.stagingDirForVolume(v.mountRoot, vol.Namespace, vol.ID, usage)

	// Make the staging path, owned by the Nomad User
	if err := os.MkdirAll(hostStagingPath, 0700); err != nil && !os.IsExist(err) {
		return "", false, fmt.Errorf("failed to create staging directory for volume (%s): %v", vol.ID, err)

	}

	// Validate that it is not already a mount point
	m := mount.New()
	isNotMount, err := m.IsNotAMountPoint(hostStagingPath)
	if err != nil {
		return "", false, fmt.Errorf("mount point detection failed for volume (%s): %v", vol.ID, err)
	}

	return hostStagingPath, !isNotMount, nil
}

// ensureAllocDir attempts to create a directory for use when publishing a volume
// and then validates that the path is not already a mount point (e.g when reattaching
// to existing allocs).
//
// Returns whether the directory is a pre-existing mountpoint, the publish path,
// and any errors that occurred.
func (v *volumeManager) ensureAllocDir(vol *structs.CSIVolume, alloc *structs.Allocation, usage *UsageOptions) (string, bool, error) {
	allocPath := v.allocDirForVolume(v.mountRoot, vol.ID, alloc.ID)

	// Make the alloc path, owned by the Nomad User
	if err := os.MkdirAll(allocPath, 0700); err != nil && !os.IsExist(err) {
		return "", false, fmt.Errorf("failed to create allocation directory for volume (%s): %v", vol.ID, err)
	}

View on GitHub (pinned to 482b49bf1a)

Solutions

  1. Verify /proc/self/mountinfo (or the OS mount table) is readable inside the Nomad client's environment
  2. Run the Nomad agent on a supported OS/without overly restrictive procfs masking (docker: do not mask /proc)
  3. Inspect the wrapped %v error for the exact syscall failure and address the OS-level cause
  4. Restart the client node if procfs is in a bad state, then retry the volume staging

Example fix

// docker run before (procfs masked causing mount detection failure)
docker run --read-only nomad ...
// after
docker run nomad ...  # do not mask /proc/self/mountinfo; run on supported host OS
Defensive patterns

Strategy: validation

Validate before calling

if _, err := os.Stat("/proc/self/mountinfo"); err != nil {
    return fmt.Errorf("mount table unreadable: %w", err)
}

Try / catch

path, isMount, err := vm.EnsureStagingDir(vol, usage)
if err != nil {
    if strings.Contains(err.Error(), "mount point detection failed") {
        // inspect/repair /proc mount table, then retry
    }
    return err
}

Prevention

When it happens

Trigger: m.IsNotAMountPoint(hostStagingPath) returns an error during stageVolume — typically a failure of the underlying stat/mountinfo read (e.g. /proc/mounts or mountinfo unavailable) on the host staging path.

Common situations: Node running in a restricted container without /proc/self/mountinfo; corrupted procfs; custom builds where the mount util is unsupported on the OS (e.g. Windows); permission issues reading mount tables.

Related errors


AI-assisted analysis of hashicorp/nomad@482b49bf1a (2026-09-04). Data as JSON: /api/errors/d9aa2736a367c2db. Report an issue: GitHub.