netbirdio/netbird · error

up %s interface: %w

Error message

up %s interface: %w

What it means

up() brings the interface up with `ifconfig <name> up` and wraps a non-zero exit. It fails when the interface no longer exists (destroyed concurrently or never created under that name), on privilege denial, or when the kernel refuses to set IFF_UP for the device.

Source

Thrown at client/iface/freebsd/link.go:224

	cmd = exec.Command("ifconfig", l.name, "inet6", "fe80::/64")
	if out, err := cmd.CombinedOutput(); err != nil {
		log.Debugf("adding address command '%v' failed with output: %s", cmd.String(), out)
	}

	return nil
}

func (l *Link) up(name string) error {
	var stderr bytes.Buffer

	cmd := exec.Command("ifconfig", name, "up")
	cmd.Stderr = &stderr

	err := cmd.Run()
	if err != nil {
		log.Debugf("ifconfig out: %s", stderr.String())

		return fmt.Errorf("up %s interface: %w", name, err)
	}

	return nil
}

func (l *Link) down(name string) error {
	var stderr bytes.Buffer

	cmd := exec.Command("ifconfig", name, "down")
	cmd.Stderr = &stderr

	err := cmd.Run()
	if err != nil {
		log.Debugf("ifconfig out: %s", stderr.String())

		return fmt.Errorf("down %s interface: %w", name, err)
	}

View on GitHub (pinned to 93e97f4bf1)

Solutions

  1. Confirm the interface exists first with `ifconfig <name>`
  2. Re-run setup cleanly: netbird down then netbird up
  3. Run the agent as root
  4. Check dmesg and the debug log for driver-level errors on the device

Example fix

// before
if err := link.Up(); err != nil {
    return err
}

// after
if _, err := net.InterfaceByName(name); err != nil {
    return fmt.Errorf("cannot bring up missing interface %s", name)
}
if err := link.Up(); err != nil {
    return err
}
Defensive patterns

Strategy: retry

Validate before calling

if _, err := net.InterfaceByName(name); err != nil {
    return fmt.Errorf("interface %s missing before Up()", name)
}

Try / catch

if err := link.Up(); err != nil {
    if _, lerr := net.InterfaceByName(name); lerr != nil {
        // vanished mid-flight: recreate then retry once
        return recreateAndUp(name)
    }
    return err
}

Prevention

When it happens

Trigger: Calling Link.Up() after the interface was destroyed by another path, or when an earlier failed rename left the actual name different from l.name; unprivileged runs.

Common situations: Race between teardown and setup paths; interface name mismatch after a partially failed Add(); jails without interface admin rights.

Related errors


AI-assisted analysis of netbirdio/netbird@93e97f4bf1 (2026-08-16). Data as JSON: /api/errors/fd6ddd17b0e84d2c. Report an issue: GitHub.