{"record":{"id":"8c526f08a30d6934","repo":"lima-vm/lima","slug":"failed-to-create-mount-point-q-w","errorCode":null,"errorMessage":"failed to create mount point %#q: %w","messagePattern":"failed to create mount point %#q: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/guestpatch/macos/macos_darwin.go","lineNumber":71,"sourceCode":"\tattached, err := attachImageWithRetry(ctx, disk, 3)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"failed to attach disk: %w\", err)\n\t}\n\tif attached == nil || attached.Data == \"\" {\n\t\treturn errors.New(\"failed to find data slice in attached disk\")\n\t}\n\tdataDevPath := \"/dev/\" + attached.Data\n\tdefer func() {\n\t\t// Detaching the data slice is enough to detach the whole ASIF.\n\t\tif err := asifutil.DetachASIF(dataDevPath); err != nil {\n\t\t\tlogrus.WithError(err).Warnf(\"failed to detach %#q (%#q)\", dataDevPath, disk)\n\t\t}\n\t}()\n\n\tinstDir := filepath.Dir(disk)\n\tmnt := filepath.Join(instDir, filenames.MntDir)\n\tif err := os.MkdirAll(mnt, 0o755); err != nil {\n\t\treturn fmt.Errorf(\"failed to create mount point %#q: %w\", mnt, err)\n\t}\n\tdefer func() {\n\t\tif err := os.Remove(mnt); err != nil {\n\t\t\tlogrus.WithError(err).Warnf(\"failed to remove mount point %#q\", mnt)\n\t\t}\n\t}()\n\treturn writeGuestFiles(ctx, dataDevPath, mnt)\n}\n\n// patchFixOwnership attaches the disk image and patches APFS inode\n// records on the raw container device to set root:wheel ownership.\nfunc patchFixOwnership(ctx context.Context, disk string) error {\n\tattached, err := attachImageWithRetry(ctx, disk, 3)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"failed to attach disk for ownership fix: %w\", err)\n\t}\n\tif attached == nil || attached.Data == \"\" {\n\t\treturn errors.New(\"failed to find data slice in attached disk\")","sourceCodeStart":53,"sourceCodeEnd":89,"githubUrl":"https://github.com/lima-vm/lima/blob/dd909d0973cd84fa35f9e1693181b4585ea616c1/pkg/guestpatch/macos/macos_darwin.go#L53-L89","documentation":"Before mounting the Data volume, patchWriteGuestFiles creates the instance's mount point directory (<instance dir>/mnt) with os.MkdirAll. If directory creation fails (permission problem, path is a file, read-only volume), the OS error is wrapped with this message including the path.","triggerScenarios":"Patch -> patchWriteGuestFiles when os.MkdirAll(mnt, 0o755) fails — the instance directory is not writable, a file named 'mnt' exists at that path, or the filesystem is read-only.","commonSituations":"LIMA_HOME on a read-only or restricted-permission volume; instance dir owned by another user; leftover file named 'mnt' from a previous crash; running limactl under a different user than the instance owner.","solutions":["Check the wrapped OS error (EACCES/ENOTDIR/EEXIST-as-file) and the quoted path.","Verify write permission on the instance directory and correct ownership (`ls -ld`).","Remove any regular file occupying the mnt path.","Ensure the volume holding LIMA_HOME is writable (not read-only mounted)."],"exampleFix":"// before: mnt path occupied by a file\n$ ls ~/.lima/inst/mnt -> regular file\n// after\n$ rm ~/.lima/inst/mnt   # remove stale file\n$ chmod u+w ~/.lima/inst","handlingStrategy":"validation","validationCode":"// pre-validate the mount point path is creatable\nmnt := filepath.Join(filepath.Dir(disk), \"mnt\")\nif fi, err := os.Lstat(mnt); err == nil && !fi.IsDir() {\n\treturn fmt.Errorf(\"%s exists and is not a directory; remove it first\", mnt)\n}","typeGuard":null,"tryCatchPattern":"if err := patchWriteGuestFiles(ctx, disk); err != nil {\n\tif strings.Contains(err.Error(), \"failed to create mount point\") {\n\t\tlog.WithError(err).Error(\"check permissions/ownership of the instance directory\")\n\t}\n\treturn err\n}","preventionTips":["Run limactl as the same user that owns the instance directory.","Ensure LIMA_HOME resides on a writable volume.","Clean up stale files named 'mnt' after crashes.","Check directory permissions when patching instances in shared LIMA_HOME setups."],"tags":["guestpatch","macos","filesystem","mount"],"backgroundTag":"mkdir-permission-denied","analyzedSha":"dd909d0973cd84fa35f9e1693181b4585ea616c1","analyzedAt":"2026-09-01T14:24:59.842Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}