abiosoft/colima · warning

unable to assign host IP addresses to the VM: %w

Error message

unable to assign host IP addresses to the VM: %w

What it means

Warning logged during VM startup when colima cannot replicate the host's IP addresses onto the VM loopback interface. When Network.Address is disabled but Network.HostAddresses is enabled, replicateHostAddresses runs 'sudo ip address add <hostIP>/24 dev lo' inside the guest for every host IP; any failure is caught and downgraded to a logrus.Warn because it is not fatal to the start sequence.

Source

Thrown at environment/vm/lima/lima.go:344

				return nil
			}

			// disable qemu
			if err := l.RunQuiet("stat", "/proc/sys/fs/binfmt_misc/qemu-x86_64"); err == nil {
				err = l.Run("sudo", "sh", "-c", `echo 0 > /proc/sys/fs/binfmt_misc/qemu-x86_64`)
				if err != nil {
					logrus.Warn(fmt.Errorf("unable to disable qemu x86_84 emulation: %w", err))
				}
			}
		}

		return nil
	})

	// replicate addresses when network address is disabled
	a.Add(func() error {
		if err := l.replicateHostAddresses(conf); err != nil {
			logrus.Warnln(fmt.Errorf("unable to assign host IP addresses to the VM: %w", err))
		}
		return nil
	})

	// preserve state
	a.Add(func() error {
		if err := configmanager.SaveToFile(conf, config.CurrentProfile().StateFile()); err != nil {
			logrus.Warnln(fmt.Errorf("error persisting Colima state: %w", err))
		}
		return nil
	})

	// save store settings
	a.Add(func() error {
		if len(l.limaConf.AdditionalDisks) == 0 {
			return nil
		}

View on GitHub (pinned to c3a5f9184d)

Solutions

  1. Treat as cosmetic first: verify inside the VM with 'colima ssh -- ip addr show dev lo' whether the addresses are actually missing
  2. If missing, re-run 'colima start' (the action is idempotent once the guest is fully booted) or add manually: colima ssh -- sudo ip address add <IP>/24 dev lo
  3. If the addresses must not be managed by colima, start without --network-host-address
  4. Upgrade colima: post-start timing and duplicate-address handling have been improved across releases

Example fix

# before: warning on every restart because addresses persist on lo
colima start --network-host-address
# after: add is idempotent when guarded in the guest
colima ssh -- sudo ip address add 192.168.5.2/24 dev lo 2>/dev/null || true
Defensive patterns

Strategy: validation

Validate before calling

// before replicating, check which addresses already exist on the guest lo
func missingHostAddresses(l *limaVM) ([]net.IP, error) {
    out, err := l.RunOutput("ip", "-j", "addr", "show", "dev", "lo")
    if err != nil {
        return nil, err
    }
    // parse JSON, drop IPs already present, return the remainder to add
    return filterExisting(util.HostIPAddresses(), out)
}

Prevention

When it happens

Trigger: Starting with host address replication enabled (conf.Network.Address == false && conf.Network.HostAddresses == true) while 'sudo ip address add' fails in the guest: address already assigned ('RTNETLINK answers: File exists' after a restart), guest network not fully up when the post-start action runs, or sudo/PATH issues inside the VM.

Common situations: Running 'colima start --network-host-address' twice or restarting after an unclean shutdown so the /24 addresses persist on lo; host has unusual interfaces (VPN tunnels, docker bridges) whose IPs cannot be added; older guest image lacking iproute2 privileges.

Related errors


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