abiosoft/colima · error
error creating cni config dir: %w
Error message
error creating cni config dir: %w
What it means
During k3s provisioning, colima creates /etc/cni/net.d inside the guest VM ('sudo mkdir -p') before writing the flannel conflist, and that mkdir failed. Because everything runs over the guest runner, this almost always means the guest session/VM itself is unhealthy rather than a CNI-specific problem.
Source
Thrown at environment/container/kubernetes/cni.go:19
package kubernetes
import (
_ "embed"
"fmt"
"path/filepath"
"github.com/abiosoft/colima/cli"
"github.com/abiosoft/colima/embedded"
"github.com/abiosoft/colima/environment"
)
func installCniConfig(guest environment.GuestActions, a *cli.ActiveCommandChain) {
// fix cni config
a.Add(func() error {
flannelFile := "/etc/cni/net.d/10-flannel.conflist"
cniConfDir := filepath.Dir(flannelFile)
if err := guest.Run("sudo", "mkdir", "-p", cniConfDir); err != nil {
return fmt.Errorf("error creating cni config dir: %w", err)
}
flannel, err := embedded.Read("k3s/flannel.json")
if err != nil {
return fmt.Errorf("error reading embedded flannel config: %w", err)
}
return guest.Write(flannelFile, flannel)
})
}
View on GitHub (pinned to c3a5f9184d)
Solutions
- Retry from a clean state: 'colima stop && colima start'
- Check guest disk: 'colima ssh -- df -h'
- Verify the dir manually: 'colima ssh -- sudo mkdir -p /etc/cni/net.d'
- Recreate the VM if the guest is corrupted: 'colima delete && colima start'
Defensive patterns
Strategy: retry
Validate before calling
// cheap guest health gate before the chain step
if err := guest.RunQuiet("true"); err != nil {
return fmt.Errorf("guest unreachable before cni setup: %w", err)
} Try / catch
if err := guest.Run("sudo", "mkdir", "-p", cniConfDir); err != nil {
return fmt.Errorf("error creating cni config dir: %w", err)
// guest fs/ssh issues: a full 'colima stop && colima start' is the reliable retry
} Prevention
- Keep guest disk below ~90% usage
- Use 'colima stop' rather than killing the VM process
- Avoid mounting /etc of the guest read-only in custom images
When it happens
Trigger: guest.Run('sudo','mkdir','-p','/etc/cni/net.d') errors: SSH to guest broken, guest disk full or read-only, sudo failure, or VM stopped mid-chain.
Common situations: colima start interrupted then resumed, guest disk exhausted by images, custom guest image without sudo, VM crashed during provisioning.
Related errors
- error persisting kubernetes settings: %w
- no IP address assigned to network interface
- '%s' overlaps '%s'
- dependency check failed for VM: %w
- error starting vm: %w
AI-assisted analysis of abiosoft/colima@c3a5f9184d (2026-08-15).
Data as JSON: /api/errors/4f9921cf26c82dcf.
Report an issue: GitHub.