netbirdio/netbird · error

up: %w

Error message

up: %w

What it means

wgLink.up() on freebsd executes `ifconfig <name> up` through client/iface/freebsd/link.go and wraps a non-zero exit as 'up: <err>', with ifconfig stderr logged at debug level. It is the standalone bring-up step in wg_link_freebsd.go, distinct from the up() call inside assignAddr.

Source

Thrown at client/iface/device/wg_link_freebsd.go:55

func (l *wgLink) recreate() error {
	if err := l.link.Recreate(); err != nil {
		return fmt.Errorf("recreate: %w", err)
	}

	return nil
}

func (l *wgLink) setMTU(mtu int) error {
	if err := l.link.SetMTU(mtu); err != nil {
		return fmt.Errorf("set mtu: %w", err)
	}

	return nil
}

func (l *wgLink) up() error {
	if err := l.link.Up(); err != nil {
		return fmt.Errorf("up: %w", err)
	}

	return nil
}

func (l *wgLink) assignAddr(address *wgaddr.Address) error {
	link, err := freebsd.LinkByName(l.name)
	if err != nil {
		return fmt.Errorf("link by name: %w", err)
	}

	prefixLen := address.Network.Bits()
	maskBits := uint32(0xffffffff) << (32 - prefixLen)
	mask := fmt.Sprintf("0x%08x", maskBits)

	log.Infof("assign addr %s mask %s to %s interface", address.IP, mask, l.name)

	if err := link.AssignAddr(address.IP.String(), mask); err != nil {

View on GitHub (pinned to 93e97f4bf1)

Solutions

  1. Check debug logs for the ifconfig stderr captured alongside this error
  2. Ensure ifconfig is resolvable in the service environment PATH
  3. Run the daemon with privileges to administer network interfaces
  4. Confirm the interface still exists (ifconfig <name>) and retry
Defensive patterns

Strategy: try-catch

Validate before calling

// confirm the interface exists before bringing it up
if _, err := freebsd.LinkByName(ifaceName); err != nil {
    return fmt.Errorf("interface %s not present: %w", ifaceName, err)
}

Try / catch

if err := link.Up(); err != nil {
    if errors.Is(err, os.ErrNotExist) || strings.Contains(err.Error(), "does not exist") {
        // interface vanished: re-create before retrying
    }
    return fmt.Errorf("bring up interface: %w", err)
}

Prevention

When it happens

Trigger: The wg interface was destroyed between creation and this call; insufficient privileges to administer the interface; ifconfig not in the daemon's PATH; ifconfig exiting nonzero with a driver-level complaint.

Common situations: FreeBSD jails without interface permissions, service environments with a scrubbed minimal PATH, another process destroying the wg interface concurrently.

Related errors


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