abiosoft/colima · error
error setting up DNS: %w
Error message
error setting up DNS: %w
What it means
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.
Source
Thrown at environment/vm/lima/lima.go:302
func (l limaVM) Created() bool {
stat, err := os.Stat(config.CurrentProfile().LimaFile())
return err == nil && !stat.IsDir()
}
func (l limaVM) User() (string, error) {
return l.RunOutput("whoami")
}
func (l limaVM) Arch() environment.Arch {
a, _ := l.RunOutput("uname", "-m")
return environment.Arch(a)
}
func (l *limaVM) addPostStartActions(a *cli.ActiveCommandChain, conf config.Config) {
// setup dns
a.Add(func() error {
if err := l.setupDNS(conf); err != nil {
return fmt.Errorf("error setting up DNS: %w", err)
}
return nil
})
// registry certs
a.Add(l.copyCerts)
// cross-platform emulation
a.Add(func() error {
// use binfmt when emulation is disabled i.e. host arch
if conf.Binfmt != nil && *conf.Binfmt {
if arch := environment.HostArch(); arch == environment.Arch(conf.Arch).Value() {
if err := core.SetupBinfmt(l.host, l, environment.Arch(conf.Arch)); err != nil {
logrus.Warn(fmt.Errorf("unable to enable qemu %s emulation: %w", arch, err))
}
}
}
View on GitHub (pinned to c3a5f9184d)
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.
Defensive patterns
Strategy: retry
Try / catch
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.
Prevention
- 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
When it happens
Trigger: 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.
Common situations: Corporate DNS setups passing multiple resolvers; hardened images; slow machines where post-start runs too early; first start after switching DNS settings.
Related errors
- failed to create dnsmasq config directory: %w
- failed to write dnsmasq config: %w
- failed to remove existing resolv.conf: %w
- failed to write resolv.conf: %w
- failed to restart dnsmasq service: %w
AI-assisted analysis of abiosoft/colima@c3a5f9184d (2026-08-15).
Data as JSON: /api/errors/5847cac439a460a1.
Report an issue: GitHub.