{"record":{"id":"561b4b9bb7745ca7","repo":"abiosoft/colima","slug":"unable-to-assign-host-ip-addresses-to-the-vm-w","errorCode":null,"errorMessage":"unable to assign host IP addresses to the VM: %w","messagePattern":"unable to assign host IP addresses to the VM: %w","errorType":"console","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"environment/vm/lima/lima.go","lineNumber":344,"sourceCode":"\t\t\t\treturn nil\n\t\t\t}\n\n\t\t\t// disable qemu\n\t\t\tif err := l.RunQuiet(\"stat\", \"/proc/sys/fs/binfmt_misc/qemu-x86_64\"); err == nil {\n\t\t\t\terr = l.Run(\"sudo\", \"sh\", \"-c\", `echo 0 > /proc/sys/fs/binfmt_misc/qemu-x86_64`)\n\t\t\t\tif err != nil {\n\t\t\t\t\tlogrus.Warn(fmt.Errorf(\"unable to disable qemu x86_84 emulation: %w\", err))\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\treturn nil\n\t})\n\n\t// replicate addresses when network address is disabled\n\ta.Add(func() error {\n\t\tif err := l.replicateHostAddresses(conf); err != nil {\n\t\t\tlogrus.Warnln(fmt.Errorf(\"unable to assign host IP addresses to the VM: %w\", err))\n\t\t}\n\t\treturn nil\n\t})\n\n\t// preserve state\n\ta.Add(func() error {\n\t\tif err := configmanager.SaveToFile(conf, config.CurrentProfile().StateFile()); err != nil {\n\t\t\tlogrus.Warnln(fmt.Errorf(\"error persisting Colima state: %w\", err))\n\t\t}\n\t\treturn nil\n\t})\n\n\t// save store settings\n\ta.Add(func() error {\n\t\tif len(l.limaConf.AdditionalDisks) == 0 {\n\t\t\treturn nil\n\t\t}\n","sourceCodeStart":326,"sourceCodeEnd":362,"githubUrl":"https://github.com/abiosoft/colima/blob/c3a5f9184d83a197184f897a9f07eb3c01b3bc88/environment/vm/lima/lima.go#L326-L362","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Treat as cosmetic first: verify inside the VM with 'colima ssh -- ip addr show dev lo' whether the addresses are actually missing","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","If the addresses must not be managed by colima, start without --network-host-address","Upgrade colima: post-start timing and duplicate-address handling have been improved across releases"],"exampleFix":"# before: warning on every restart because addresses persist on lo\ncolima start --network-host-address\n# after: add is idempotent when guarded in the guest\ncolima ssh -- sudo ip address add 192.168.5.2/24 dev lo 2>/dev/null || true","handlingStrategy":"validation","validationCode":"// before replicating, check which addresses already exist on the guest lo\nfunc missingHostAddresses(l *limaVM) ([]net.IP, error) {\n    out, err := l.RunOutput(\"ip\", \"-j\", \"addr\", \"show\", \"dev\", \"lo\")\n    if err != nil {\n        return nil, err\n    }\n    // parse JSON, drop IPs already present, return the remainder to add\n    return filterExisting(util.HostIPAddresses(), out)\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Treat the warning as non-fatal — the VM is already running when it appears","Re-run 'colima start' after the guest is fully booted; the add is naturally retried","Do not combine --network-address with --network-host-address; the replication path only runs when address assignment is off"],"tags":["network","vm","ip-address","startup","host-addresses"],"backgroundTag":null,"analyzedSha":"c3a5f9184d83a197184f897a9f07eb3c01b3bc88","analyzedAt":"2026-08-15T18:58:08.334Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}