lima-vm/lima · error
failed to create mount point %#q: %w
Error message
failed to create mount point %#q: %w
What it means
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.
Source
Thrown at pkg/guestpatch/macos/macos_darwin.go:71
attached, err := attachImageWithRetry(ctx, disk, 3)
if err != nil {
return fmt.Errorf("failed to attach disk: %w", err)
}
if attached == nil || attached.Data == "" {
return errors.New("failed to find data slice in attached disk")
}
dataDevPath := "/dev/" + attached.Data
defer func() {
// Detaching the data slice is enough to detach the whole ASIF.
if err := asifutil.DetachASIF(dataDevPath); err != nil {
logrus.WithError(err).Warnf("failed to detach %#q (%#q)", dataDevPath, disk)
}
}()
instDir := filepath.Dir(disk)
mnt := filepath.Join(instDir, filenames.MntDir)
if err := os.MkdirAll(mnt, 0o755); err != nil {
return fmt.Errorf("failed to create mount point %#q: %w", mnt, err)
}
defer func() {
if err := os.Remove(mnt); err != nil {
logrus.WithError(err).Warnf("failed to remove mount point %#q", mnt)
}
}()
return writeGuestFiles(ctx, dataDevPath, mnt)
}
// patchFixOwnership attaches the disk image and patches APFS inode
// records on the raw container device to set root:wheel ownership.
func patchFixOwnership(ctx context.Context, disk string) error {
attached, err := attachImageWithRetry(ctx, disk, 3)
if err != nil {
return fmt.Errorf("failed to attach disk for ownership fix: %w", err)
}
if attached == nil || attached.Data == "" {
return errors.New("failed to find data slice in attached disk")View on GitHub (pinned to dd909d0973)
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).
Example fix
// before: mnt path occupied by a file $ ls ~/.lima/inst/mnt -> regular file // after $ rm ~/.lima/inst/mnt # remove stale file $ chmod u+w ~/.lima/inst
Defensive patterns
Strategy: validation
Validate before calling
// pre-validate the mount point path is creatable
mnt := filepath.Join(filepath.Dir(disk), "mnt")
if fi, err := os.Lstat(mnt); err == nil && !fi.IsDir() {
return fmt.Errorf("%s exists and is not a directory; remove it first", mnt)
} Try / catch
if err := patchWriteGuestFiles(ctx, disk); err != nil {
if strings.Contains(err.Error(), "failed to create mount point") {
log.WithError(err).Error("check permissions/ownership of the instance directory")
}
return err
} Prevention
- 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.
When it happens
Trigger: 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.
Common situations: 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.
Understand the failure class
Background: mkdir permission denied (EACCES): failed to create directory errors explained — this error's family across 32 libraries.
Related errors
- failed to mount %#q on %#q: %w (output=%#q)
- failed to create temp file: %w
- failed to write temp plist: %w
- failed to create a temporary file for signing QEMU binary: %
- field `mountType` must be %#q or %#q for QEMU driver on macO
AI-assisted analysis of lima-vm/lima@dd909d0973 (2026-09-01).
Data as JSON: /api/errors/8c526f08a30d6934.
Report an issue: GitHub.