{"record":{"id":"110bd7321533a272","repo":"abiosoft/colima","slug":"error-setting-up-incus-w","errorCode":null,"errorMessage":"error setting up incus: %w","messagePattern":"error setting up incus: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"environment/container/incus/incus.go","lineNumber":115,"sourceCode":"\tvar value struct {\n\t\tDisk          int\n\t\tInterface     string\n\t\tBridgeGateway string\n\t\tSetStorage    bool\n\t}\n\tvalue.Disk = conf.Disk\n\tvalue.Interface = incusBridgeInterface\n\tvalue.BridgeGateway = bridgeGateway\n\tvalue.SetStorage = emptyDisk // set only when the disk is empty\n\n\tbuf, err := util.ParseTemplate(configYaml, value)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"error parsing incus config template: %w\", err)\n\t}\n\n\tstdin := bytes.NewReader(buf)\n\tif err := c.guest.RunWith(stdin, nil, \"sudo\", \"incus\", \"admin\", \"init\", \"--preseed\"); err != nil {\n\t\treturn fmt.Errorf(\"error setting up incus: %w\", err)\n\t}\n\n\t// provision successful\n\tif emptyDisk {\n\t\treturn nil\n\t}\n\n\tif !recoverStorage {\n\t\treturn c.wipeDisk(conf.Disk)\n\t}\n\n\tif _, err := c.guest.Stat(poolDiskFile); err != nil {\n\t\tlog.Warnln(fmt.Errorf(\"cannot recover disk: %w, creating new storage pool\", err))\n\t\treturn c.wipeDisk(conf.Disk)\n\t}\n\n\tfor {\n\t\tif err := c.recoverDisk(ctx); err != nil {","sourceCodeStart":97,"sourceCodeEnd":133,"githubUrl":"https://github.com/abiosoft/colima/blob/c3a5f9184d83a197184f897a9f07eb3c01b3bc88/environment/container/incus/incus.go#L97-L133","documentation":"'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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Retry provisioning after a clean stop: 'colima stop && colima start --runtime incus'","Reproduce manually to see the real error: 'colima ssh -- cat /tmp/preseed.yaml | sudo incus admin init --preseed'","Check incus daemon state: 'colima ssh -- sudo systemctl status incus.service incus.socket'","If existing pools/networks conflict, wipe and re-provision: 'colima delete && colima start'"],"exampleFix":null,"handlingStrategy":"retry","validationCode":"// ensure the guest daemon is up before preseeding\nif err := c.guest.RunQuiet(\"sudo\", \"incus\", \"wait-ready\", \"--timeout=30\"); err != nil {\n    return fmt.Errorf(\"incus daemon not ready for preseed: %w\", err)\n}","typeGuard":null,"tryCatchPattern":"if err := c.guest.RunWith(stdin, nil, \"sudo\", \"incus\", \"admin\", \"init\", \"--preseed\"); err != nil {\n    if out, cerr := c.guest.RunOutput(\"sudo\", \"incus\", \"storage\", \"list\", \"--format\", \"json\"); cerr == nil && strings.Contains(out, poolName) {\n        return nil // pool already exists; preseed conflict is benign\n    }\n    return fmt.Errorf(\"error setting up incus: %w\", err)\n}","preventionTips":["Start from a clean guest ('colima delete') when switching runtimes or re-provisioning incus","Match host and guest incus major versions","Ensure requested disk size fits the VM disk"],"tags":["incus","preseed","provisioning","vm"],"backgroundTag":null,"analyzedSha":"c3a5f9184d83a197184f897a9f07eb3c01b3bc88","analyzedAt":"2026-08-15T18:58:08.334Z","schemaVersion":2},"datasetVersion":"2026-08-16T03:17:38.424Z"}