abiosoft/colima · error

error setting up sudoers for route: %w

Error message

error setting up sudoers for route: %w

What it means

On macOS hosts, colima installs a sudoers file (embedded.InstallSudoers) so it can run /sbin/route without a password prompt; that install step failed. The wrapped error typically comes from writing /etc/sudoers.d/colima or validating it with visudo.

Source

Thrown at environment/container/incus/route.go:34

// addContainerRoute adds a macOS route for the Incus container subnet
// via the VM's col0 IP address, making containers directly reachable from the host.
func (c *incusRuntime) addContainerRoute() error {
	if !util.MacOS() {
		return nil
	}

	vmIP := limautil.IPAddress(config.CurrentProfile().ID)
	if vmIP == "127.0.0.1" || vmIP == "" {
		return nil
	}

	if !util.SubnetAvailable(BridgeSubnet) {
		log.Warnf("subnet %s conflicts with host network, skipping route setup", BridgeSubnet)
		return nil
	}

	if err := embedded.InstallSudoers(c.host); err != nil {
		return fmt.Errorf("error setting up sudoers for route: %w", err)
	}

	// delete any stale route first (ignore errors)
	_ = c.removeContainerRoute()

	if err := c.host.RunQuiet("sudo", "/sbin/route", "add", "-net", BridgeSubnet, vmIP); err != nil {
		return fmt.Errorf("error adding route for %s via %s: %w", BridgeSubnet, vmIP, err)
	}

	return nil
}

// removeContainerRoute removes the macOS route for the Incus container subnet.
func (c *incusRuntime) removeContainerRoute() error {
	if !util.MacOS() {
		return nil
	}

View on GitHub (pinned to c3a5f9184d)

Solutions

  1. Verify /etc/sudoers contains '@includedir /etc/sudoers.d' (visudo -c)
  2. Check the file: 'sudo cat /etc/sudoers.d/colima' and 'sudo visudo -c'
  3. Manually re-run colima start so the sudo prompt can be answered
  4. If sudoers is centrally managed, add an equivalent rule for the route command
Defensive patterns

Strategy: validation

Validate before calling

// preflight the sudoers include dir before provisioning
if _, err := os.Stat("/etc/sudoers.d"); err != nil {
    return fmt.Errorf("/etc/sudoers.d missing; ensure @includedir is configured in /etc/sudoers")
}

Try / catch

if err := embedded.InstallSudoers(c.host); err != nil {
    return fmt.Errorf("error setting up sudoers for route: %w", err)
    // user-actionable: run 'sudo visudo -c' and check /etc/sudoers.d/colima, then retry colima start
}

Prevention

When it happens

Trigger: embedded.InstallSudoers(c.host) fails: /etc/sudoers.d missing or not included by /etc/sudoers, write permission denied (sudo password entry failed), sudoers validation rejected the file, or the embedded sudoers asset is missing.

Common situations: Hardened macOS with sudoers include disabled, corporate machines with managed /etc/sudoers, interrupted first-run where the sudo prompt timed out, macOS upgrade resetting sudoers.d.

Related errors


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