lima-vm/lima · critical

reading volume omap

Error message

reading volume omap: %w

What it means

Once findVolume locates the volume superblock matching the requested role, it reads that volume's omap block (physical address from apfsOmapOIDOff) to obtain the omap B-tree root address. This error wraps the readBlock failure for that block. It indicates the volume superblock was found but its omap could not be read.

Solutions

  1. Check the image is complete (size matches the source disk capacity).
  2. Try a different volumeRole if the wrong volume was targeted and its storage was trimmed.
  3. Run fsck_apfs against the image from a macOS host to repair volume metadata.
  4. Re-take the disk image from a cleanly shut-down VM.
  5. Restore the image from backup if corruption is confirmed.
Defensive patterns

Strategy: try-catch

Try / catch

if err := apfs.Chown(diskPath, role, uid, gid, paths...); err != nil {
	if strings.Contains(err.Error(), "reading volume omap") {
		log.Warn("target volume omap unreadable; image may be truncated or volume removed")
		return err
	}
	return err
}

Prevention

When it happens

Trigger: The volume's omap physical address is out of range for the image file, the image is truncated, or an I/O error (bad sector, permission) occurs while reading that specific block.

Common situations: Incomplete disk image copies, corrupted volumes inside an otherwise readable container, or images where the target volume was deleted and its omap blocks were reused/trimmed.

Related errors


AI-assisted analysis of lima-vm/lima@dd909d0973 (2026-09-01). Data as JSON: /api/errors/10933319185504eb. Report an issue: GitHub.

Appendix: source

Thrown at pkg/apfs/chown.go:278

		if err != nil {
			continue // skip volumes we can't resolve
		}
		volBlock, err := c.readBlock(volPhysAddr)
		if err != nil {
			continue
		}
		if verifyChecksum(volBlock) != nil {
			continue
		}
		if le.Uint32(volBlock[apfsMagicOff:]) != apfsMagic {
			continue
		}
		volRole := le.Uint16(volBlock[apfsRoleOff:])
		if volRole == role {
			omapAddr := le.Uint64(volBlock[apfsOmapOIDOff:])
			omapBlock, err := c.readBlock(omapAddr)
			if err != nil {
				return nil, fmt.Errorf("reading volume omap: %w", err)
			}
			return &volumeInfo{
				omapTreeAddr: le.Uint64(omapBlock[omapTreeOIDOff:]),
				rootTreeOID:  le.Uint64(volBlock[apfsRootTreeOIDOff:]),
				latestXID:    le.Uint64(volBlock[objXIDOff:]),
			}, nil
		}
	}
	return nil, fmt.Errorf("no volume with role %#x found", role)
}

// omapLookup searches the omap B-tree for a virtual OID, returning
// the physical address from the entry with the highest xid <= maxXID.
func (c *container) omapLookup(omapTreeAddr, oid, maxXID uint64) (uint64, error) {
	blk, err := c.readBlock(omapTreeAddr)
	if err != nil {
		return 0, err
	}

View on GitHub (pinned to dd909d0973)