{"record":{"id":"5847cac439a460a1","repo":"abiosoft/colima","slug":"error-setting-up-dns-w","errorCode":null,"errorMessage":"error setting up DNS: %w","messagePattern":"error setting up DNS: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"environment/vm/lima/lima.go","lineNumber":302,"sourceCode":"func (l limaVM) Created() bool {\n\tstat, err := os.Stat(config.CurrentProfile().LimaFile())\n\treturn err == nil && !stat.IsDir()\n}\n\nfunc (l limaVM) User() (string, error) {\n\treturn l.RunOutput(\"whoami\")\n}\n\nfunc (l limaVM) Arch() environment.Arch {\n\ta, _ := l.RunOutput(\"uname\", \"-m\")\n\treturn environment.Arch(a)\n}\n\nfunc (l *limaVM) addPostStartActions(a *cli.ActiveCommandChain, conf config.Config) {\n\t// setup dns\n\ta.Add(func() error {\n\t\tif err := l.setupDNS(conf); err != nil {\n\t\t\treturn fmt.Errorf(\"error setting up DNS: %w\", err)\n\t\t}\n\t\treturn nil\n\t})\n\n\t// registry certs\n\ta.Add(l.copyCerts)\n\n\t// cross-platform emulation\n\ta.Add(func() error {\n\t\t// use binfmt when emulation is disabled i.e. host arch\n\t\tif conf.Binfmt != nil && *conf.Binfmt {\n\t\t\tif arch := environment.HostArch(); arch == environment.Arch(conf.Arch).Value() {\n\t\t\t\tif err := core.SetupBinfmt(l.host, l, environment.Arch(conf.Arch)); err != nil {\n\t\t\t\t\tlogrus.Warn(fmt.Errorf(\"unable to enable qemu %s emulation: %w\", arch, err))\n\t\t\t\t}\n\t\t\t}\n\t\t}\n","sourceCodeStart":284,"sourceCodeEnd":320,"githubUrl":"https://github.com/abiosoft/colima/blob/c3a5f9184d83a197184f897a9f07eb3c01b3bc88/environment/vm/lima/lima.go#L284-L320","documentation":"This is the top-level wrapper in the post-start action chain for the guest DNS setup (setupDNS, i.e. the dnsmasq flow: mkdir, write config, rewrite resolv.conf, restart service). Any failure inside those steps is re-wrapped as 'error setting up DNS', so the underlying cause (186-190 in this list) appears in the wrapped chain. It fails the post-start chain, so start reports an error even though the VM itself booted.","triggerScenarios":"Starting with DNS settings that activate in-guest dnsmasq while any of the guest-side steps fails (custom images missing dnsmasq/sudo, read-only /etc, systemd not ready, SSH hiccup). The VM is up, but DNS inside the guest is not configured as requested.","commonSituations":"Corporate DNS setups passing multiple resolvers; hardened images; slow machines where post-start runs too early; first start after switching DNS settings.","solutions":["Read the wrapped error to find the failing sub-step (mkdir/write/resolv.conf/systemctl) and fix that specific cause.","Retry `colima stop && colima start`; boot races with guest services frequently clear.","Simplify DNS config (host resolvers only) to skip the in-guest dnsmasq path entirely.","For custom images, pre-install dnsmasq and systemd, and ensure /etc is writable."],"exampleFix":null,"handlingStrategy":"retry","validationCode":null,"typeGuard":null,"tryCatchPattern":"Go: when start fails with this wrapper, unwrap to identify the dnsmasq sub-step, retry stop/start once for boot races, then switch DNS config if persistent.","preventionTips":["Prefer host-resolver DNS settings on custom images","Ensure guest has dnsmasq/sudo/systemd when using in-guest DNS","Keep guest image official and disk space healthy"],"tags":["dns","post-start","wrapper","colima","guest"],"backgroundTag":null,"analyzedSha":"c3a5f9184d83a197184f897a9f07eb3c01b3bc88","analyzedAt":"2026-08-15T18:58:08.334Z","schemaVersion":2},"datasetVersion":"2026-08-16T03:17:38.424Z"}