abiosoft/colima · error

cannot list storage pool disks: %w

Error message

cannot list storage pool disks: %w

What it means

During storage recovery, colima runs 'sudo ls <poolDisksDir> | grep ".img$" in the guest and the pipeline exited non-zero. Note the grep: it exits 1 when NOTHING matches, so this error fires both when listing genuinely fails and when the directory simply contains no .img disk files.

Source

Thrown at environment/container/incus/incus.go:443

		"incus-ui-canonical",
	}

	return debutil.UpdateRuntime(ctx, c.guest, c, packages...)
}

func (c *incusRuntime) poolImported() bool {
	script := strings.NewReplacer(
		"{pool_name}", poolName,
	).Replace("sudo zpool list -H -o name | grep '^{pool_name}$'")
	return c.guest.RunQuiet("sh", "-c", script) == nil
}

func (c *incusRuntime) recoverDisk(ctx context.Context) error {
	var disks []string
	str, err := c.guest.RunOutput("sh", "-c", "sudo ls "+poolDisksDir+" | grep '.img$'")

	if err != nil {
		return fmt.Errorf("cannot list storage pool disks: %w", err)
	}

	disks = strings.Fields(str)
	if len(disks) == 0 {
		return fmt.Errorf("no existing storage pool disks found")
	}

	log := c.Logger(ctx)

	log.Println()
	log.Println("Running 'incus admin recover' ...")
	log.Println()
	log.Println(fmt.Sprintf("Found %d storage pool source(s):", len(disks)))
	for _, disk := range disks {
		log.Println("  " + poolDisksDir + "/" + disk)
	}
	log.Println()

View on GitHub (pinned to c3a5f9184d)

Solutions

  1. Check the directory in the guest: 'colima ssh -- sudo ls -la /var/lib/incus/disks'
  2. If files exist but have different names, verify which colima version created them (layout migration may be needed)
  3. If genuinely empty, answer 'no' at the recovery prompt so colima wipes and recreates the pool
  4. Ensure /var/lib/incus (data disk) is mounted before starting colima
Defensive patterns

Strategy: validation

Validate before calling

// distinguish 'no matches' (grep exit 1) from real listing failures
str, err := c.guest.RunOutput("sh", "-c", "sudo ls "+poolDisksDir+" 2>/dev/null | grep '.img$' || true")
if err != nil {
    return fmt.Errorf("cannot list storage pool disks: %w", err)
}

Try / catch

str, err := c.guest.RunOutput("sh", "-c", "sudo ls "+poolDisksDir+" | grep '.img$'")
if err != nil {
    if strings.Contains(err.Error(), "exit status 1") {
        // grep found nothing — treat as 'no disks', not a hard error
        return fmt.Errorf("no existing storage pool disks found")
    }
    return fmt.Errorf("cannot list storage pool disks: %w", err)
}

Prevention

When it happens

Trigger: RunOutput('sh','-c','sudo ls ... | grep ".img$"') errors: poolDisksDir missing/empty, no *.img files (grep exit 1), sudo failure, or guest SSH broken.

Common situations: Data disk mounted but pool disks were deleted manually, first start after a wipe where the directory was removed, path drift after a colima version changed the disk layout, /var/lib/incus not mounted.

Related errors


AI-assisted analysis of abiosoft/colima@c3a5f9184d (2026-08-15). Data as JSON: /api/errors/0cc17d3da8b4e9f1. Report an issue: GitHub.