abiosoft/colima · error

error setting up incus: %w

Error message

error setting up incus: %w

What it means

'sudo incus admin init --preseed' inside the guest rejected the rendered preseed config. The command's own stderr is wrapped, so the concrete cause (invalid yaml, pre-existing storage pool/network name conflicts, permission issue) is in the wrapped error text.

Source

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

	var value struct {
		Disk          int
		Interface     string
		BridgeGateway string
		SetStorage    bool
	}
	value.Disk = conf.Disk
	value.Interface = incusBridgeInterface
	value.BridgeGateway = bridgeGateway
	value.SetStorage = emptyDisk // set only when the disk is empty

	buf, err := util.ParseTemplate(configYaml, value)
	if err != nil {
		return fmt.Errorf("error parsing incus config template: %w", err)
	}

	stdin := bytes.NewReader(buf)
	if err := c.guest.RunWith(stdin, nil, "sudo", "incus", "admin", "init", "--preseed"); err != nil {
		return fmt.Errorf("error setting up incus: %w", err)
	}

	// provision successful
	if emptyDisk {
		return nil
	}

	if !recoverStorage {
		return c.wipeDisk(conf.Disk)
	}

	if _, err := c.guest.Stat(poolDiskFile); err != nil {
		log.Warnln(fmt.Errorf("cannot recover disk: %w, creating new storage pool", err))
		return c.wipeDisk(conf.Disk)
	}

	for {
		if err := c.recoverDisk(ctx); err != nil {

View on GitHub (pinned to c3a5f9184d)

Solutions

  1. Retry provisioning after a clean stop: 'colima stop && colima start --runtime incus'
  2. Reproduce manually to see the real error: 'colima ssh -- cat /tmp/preseed.yaml | sudo incus admin init --preseed'
  3. Check incus daemon state: 'colima ssh -- sudo systemctl status incus.service incus.socket'
  4. If existing pools/networks conflict, wipe and re-provision: 'colima delete && colima start'
Defensive patterns

Strategy: retry

Validate before calling

// ensure the guest daemon is up before preseeding
if err := c.guest.RunQuiet("sudo", "incus", "wait-ready", "--timeout=30"); err != nil {
    return fmt.Errorf("incus daemon not ready for preseed: %w", err)
}

Try / catch

if err := c.guest.RunWith(stdin, nil, "sudo", "incus", "admin", "init", "--preseed"); err != nil {
    if out, cerr := c.guest.RunOutput("sudo", "incus", "storage", "list", "--format", "json"); cerr == nil && strings.Contains(out, poolName) {
        return nil // pool already exists; preseed conflict is benign
    }
    return fmt.Errorf("error setting up incus: %w", err)
}

Prevention

When it happens

Trigger: guest.RunWith(stdin=preseed, 'sudo','incus','admin','init','--preseed') exits non-zero: preseed references a network/pool that already exists, incus daemon is not reachable in the guest, sudo fails, or incus version rejects a preseed key.

Common situations: Re-provisioning over a half-configured incus state, guest incus socket down (incus.socket not activated), incus version change that renamed preseed fields, insufficient disk for the requested pool size.

Related errors


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