kubernetes/kops · error
unable to run blkid: %v
Error message
unable to run blkid: %v
What it means
getFromConfigDrive (upup/pkg/fi/cloudup/openstack/openstackmetadata/metadata.go:111) shells out to the blkid utility to locate the block device labeled with the config-drive label. If blkid is missing, not in PATH, or exits nonzero (including when no matching device exists), this error is returned.
Source
Thrown at upup/pkg/fi/cloudup/openstack/openstackmetadata/metadata.go:111
return nil, err
}
defer os.Remove(mountTarget)
return newMetadataService(MetadataLatestServiceURL, MetadataLatestPath, getDefaultMounter(), mountTarget, DefaultMetadataSearchOrder).getMetadata()
}
// getFromConfigDrive tries to get metadata by mounting a config drive and returns it as InstanceMetadata
// It will return an error if there is no disk labelled as ConfigDriveLabel or other errors while mounting the disk, or reading the file occur.
func (mds MetadataService) getFromConfigDrive() (*InstanceMetadata, error) {
dev := path.Join(DiskByLabelPath, ConfigDriveLabel)
if _, err := os.Stat(dev); os.IsNotExist(err) {
out, err := mds.mounter.Exec.Command(
"blkid", "-l",
"-t", fmt.Sprintf("LABEL=%s", ConfigDriveLabel),
"-o", "device",
).CombinedOutput()
if err != nil {
return nil, fmt.Errorf("unable to run blkid: %v", err)
}
dev = strings.TrimSpace(string(out))
}
err := mds.mounter.Mount(dev, mds.mountTarget, "iso9660", []string{"ro"})
if err != nil {
err = mds.mounter.Mount(dev, mds.mountTarget, "vfat", []string{"ro"})
}
if err != nil {
return nil, fmt.Errorf("error mounting configdrive '%s': %v", dev, err)
}
defer mds.mounter.Unmount(mds.mountTarget)
f, err := os.Open(
path.Join(mds.mountTarget, mds.configDrivePath))
if err != nil {
return nil, fmt.Errorf("error reading '%s' on config drive: %v", mds.configDrivePath, err)
}View on GitHub (pinned to 4c8573c808)
Solutions
- Boot the instance with a config drive attached, or fall back to the metadata service by configuring search order to include MetadataID.
- Install the blkid binary (part of util-linux) in the image/environment where metadata lookup runs.
- Run the process as root so blkid can probe block devices.
- Manually verify with `blkid -l -t LABEL=config-2 -o device` on the instance to confirm a device is present.
Example fix
// before
out, err := mds.mounter.Exec.Command("blkid", "-l", "-t", fmt.Sprintf("LABEL=%s", ConfigDriveLabel), "-o", "device").CombinedOutput()
if err != nil {
return nil, fmt.Errorf("unable to run blkid: %v", err)
}
// after — no config drive? fall through so the metadata service can be tried
out, err := mds.mounter.Exec.Command("blkid", "-l", "-t", fmt.Sprintf("LABEL=%s", ConfigDriveLabel), "-o", "device").CombinedOutput()
if err != nil {
return nil, nil // no config drive present; getMetadata will try the next source
} Defensive patterns
Strategy: fallback
Validate before calling
// Confirm blkid exists and a config-drive-labeled device is present before calling
if _, err := exec.LookPath("blkid"); err != nil {
return errors.New("blkid not installed; install util-linux or use the metadata service")
}
out, err := exec.Command("blkid", "-l", "-t", "LABEL=config-2", "-o", "device").CombinedOutput()
if err != nil {
return errors.New("no config-drive device found; boot instance with --config-drive true")
} Try / catch
meta, err := mds.getFromConfigDrive()
if err != nil {
if strings.Contains(err.Error(), "unable to run blkid") {
// no config drive / no blkid — let getMetadata try the metadata service next
return mds.getFromMetadataService()
}
return nil, err
} Prevention
- Include util-linux (blkid) in node images used for OpenStack instances.
- Boot instances with a config drive attached.
- Run metadata lookups as root so blkid can probe devices.
- Configure search order "configDrive, metadataService" so a missing drive falls back gracefully.
When it happens
Trigger: Executing `blkid -l -t LABEL=<ConfigDriveLabel> -o device` via the mounter's Exec returns a nonzero exit code — blkid not installed, insufficient privileges (needs root), or no device carrying the config-drive label.
Common situations: Instance booted without --config-drive true so no config-drive device exists; minimal container images (e.g. distroless) without blkid; running nodeup without root/CAP_SYS_ADMIN so blkid cannot probe devices.
Related errors
- error mounting configdrive '%s': %v
- error reading '%s' on config drive: %v
- error getting cloud instance group %q: %v
- unable to fetch metadata: %w
- %s is not a valid metadata search order option. Supported op
AI-assisted analysis of kubernetes/kops@4c8573c808 (2026-09-05).
Data as JSON: /api/errors/a4584c27c236b5df.
Report an issue: GitHub.