{"record":{"id":"974c777e33bfba87","repo":"kubernetes/kops","slug":"error-mounting-configdrive-s-v","errorCode":null,"errorMessage":"error mounting configdrive '%s': %v","messagePattern":"error mounting configdrive '(.+?)': (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"upup/pkg/fi/cloudup/openstack/openstackmetadata/metadata.go","lineNumber":121,"sourceCode":"\tdev := path.Join(DiskByLabelPath, ConfigDriveLabel)\n\tif _, err := os.Stat(dev); os.IsNotExist(err) {\n\t\tout, err := mds.mounter.Exec.Command(\n\t\t\t\"blkid\", \"-l\",\n\t\t\t\"-t\", fmt.Sprintf(\"LABEL=%s\", ConfigDriveLabel),\n\t\t\t\"-o\", \"device\",\n\t\t).CombinedOutput()\n\t\tif err != nil {\n\t\t\treturn nil, fmt.Errorf(\"unable to run blkid: %v\", err)\n\t\t}\n\t\tdev = strings.TrimSpace(string(out))\n\t}\n\n\terr := mds.mounter.Mount(dev, mds.mountTarget, \"iso9660\", []string{\"ro\"})\n\tif err != nil {\n\t\terr = mds.mounter.Mount(dev, mds.mountTarget, \"vfat\", []string{\"ro\"})\n\t}\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"error mounting configdrive '%s': %v\", dev, err)\n\t}\n\tdefer mds.mounter.Unmount(mds.mountTarget)\n\n\tf, err := os.Open(\n\t\tpath.Join(mds.mountTarget, mds.configDrivePath))\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"error reading '%s' on config drive: %v\", mds.configDrivePath, err)\n\t}\n\tdefer f.Close()\n\n\treturn mds.parseMetadata(f)\n}\n\n// getFromMetadataService tries to get metadata from a metadata service endpoint and returns it as InstanceMetadata.\n// If the service endpoint cannot be contacted or reports a different status than StatusOK it will return an error.\nfunc (mds MetadataService) getFromMetadataService() (*InstanceMetadata, error) {\n\tvar client http.Client\n","sourceCodeStart":103,"sourceCodeEnd":139,"githubUrl":"https://github.com/kubernetes/kops/blob/4c8573c808a73d578c5eadc86d410646ea0b0d73/upup/pkg/fi/cloudup/openstack/openstackmetadata/metadata.go#L103-L139","documentation":"After blkid locates the config-drive device, getFromConfigDrive (upup/pkg/fi/cloudup/openstack/openstackmetadata/metadata.go:121) tries to mount it read-only as iso9660, then as vfat. If both mount attempts fail, the device path and error are wrapped in this message.","triggerScenarios":"mds.mounter.Mount(dev, mountTarget, \"iso9660\", ro) and the vfat retry both fail — the kernel lacks the filesystem modules, the mount target directory does not exist, the process lacks mount privileges, or dev is empty/garbage from a failed blkid probe.","commonSituations":"Containerized environments without --privileged or CAP_SYS_ADMIN; missing iso9660/vfat kernel modules on minimal hosts; /mount-target not created before mounting; config drive attached as a non-iso9660/vfat format.","solutions":["Ensure the process runs with mount privileges (root / CAP_SYS_ADMIN, privileged container).","Verify kernel support: `modprobe iso9660` and `modprobe vfat` on the instance.","Create the mount target directory before the metadata lookup runs.","Confirm the device found by blkid is a valid config-drive image (`file <dev>` / `blkid <dev>`)."],"exampleFix":"// before\nerr := mds.mounter.Mount(dev, mds.mountTarget, \"iso9660\", []string{\"ro\"})\n// after — ensure the mount point exists first\nif err := os.MkdirAll(mds.mountTarget, 0755); err != nil {\n    return nil, fmt.Errorf(\"unable to create mount target: %v\", err)\n}\nerr := mds.mounter.Mount(dev, mds.mountTarget, \"iso9660\", []string{\"ro\"})","handlingStrategy":"fallback","validationCode":"// Ensure mount privileges and kernel support before attempting config-drive mount\nif err := exec.Command(\"mount\", \"--bind\", \"/\", \"/\").Run(); err != nil {\n    return errors.New(\"process lacks mount privileges (need root/CAP_SYS_ADMIN)\")\n}\nif err := os.MkdirAll(\"/mnt/config-drive\", 0755); err != nil {\n    return fmt.Errorf(\"cannot create mount target: %v\", err)\n}","typeGuard":null,"tryCatchPattern":"meta, err := mds.getFromConfigDrive()\nif err != nil {\n    if strings.Contains(err.Error(), \"error mounting configdrive\") {\n        // both iso9660 and vfat failed — try the metadata service instead\n        return mds.getFromMetadataService()\n    }\n    return nil, err\n}","preventionTips":["Run nodeup/metadata code in privileged contexts (root, CAP_SYS_ADMIN).","Ensure iso9660 and vfat kernel modules are loaded on the host.","Create the mount target directory before lookup.","Keep the metadata service in the search order as a fallback source."],"tags":["openstack","config-drive","mount","metadata"],"backgroundTag":"mount-failed","analyzedSha":"4c8573c808a73d578c5eadc86d410646ea0b0d73","analyzedAt":"2026-09-05T04:13:19.212Z","contentChangedAt":"2026-09-05T04:13:19.212Z","schemaVersion":2},"datasetVersion":"2026-09-12T07:17:12.445Z"}