dagger/dagger · error

mount hosts override %s: %w

Error message

mount hosts override %s: %w

What it means

Bind-mounting the prepared hosts-override file over /etc/hosts failed inside the isolated mount namespace. The %s names the temp file being mounted; typical failures are the temp file missing, the target being a symlink on read-only /etc, or propagation/type mismatch.

Source

Thrown at core/git_remote.go:757

	}
	if err := unix.Setns(int(cleanMntNS.Fd()), unix.CLONE_NEWNS); err != nil {
		return fmt.Errorf("setns clean mount namespace: %w", err)
	}
	if err := unix.Unshare(unix.CLONE_NEWNS); err != nil {
		return fmt.Errorf("unshare new mount namespace: %w", err)
	}

	syscall.Umask(0022)
	if err := overrideNetworkConfig(hosts, resolv); err != nil {
		return fmt.Errorf("failed to override network config: %w", err)
	}
	return runProcessGroup(ctx, cmd)
}

func overrideNetworkConfig(hostsOverride, resolvOverride string) error {
	if hostsOverride != "" {
		if err := mount.Mount(hostsOverride, "/etc/hosts", "", "bind"); err != nil {
			return fmt.Errorf("mount hosts override %s: %w", hostsOverride, err)
		}
	}
	if resolvOverride != "" {
		if err := mount.Mount(resolvOverride, "/etc/resolv.conf", "", "bind"); err != nil {
			return fmt.Errorf("mount resolv override %s: %w", resolvOverride, err)
		}
	}

	return nil
}

func runProcessGroup(ctx context.Context, cmd *exec.Cmd) error {
	cmd.SysProcAttr = &unix.SysProcAttr{
		Setpgid:   true,
		Pdeathsig: unix.SIGTERM,
	}
	if err := cmd.Start(); err != nil {
		return err

View on GitHub (pinned to 82ba2681db)

Solutions

  1. Confirm the temp hosts file still exists at mount time (no early cleanup)
  2. If /etc/hosts is a symlink, mount onto its resolved target instead
  3. Check for ENOMEM/busy mount-table errors and retry
Defensive patterns

Strategy: try-catch

When it happens

Trigger: Thrown at core/git_remote.go:757 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of dagger/dagger@82ba2681db (2026-09-05). Data as JSON: /api/errors/1d619bf12504ba75. Report an issue: GitHub.