netbirdio/netbird · error

create %s interface: %w

Error message

create %s interface: %w

What it means

create() runs `ifconfig wg create` to clone a new WireGuard-group interface (wg0, wg1, ...) and this error wraps a non-zero exit. On FreeBSD the 'wg' cloner comes from the if_wg kernel module, so the dominant cause is the module not being loaded; privilege denial and exhausted cloner limits also produce it.

Source

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

	if errors.Is(err, ErrDoesNotExist) {
		return false, nil
	}

	if err != nil {
		return false, fmt.Errorf("link by name: %w", err)
	}

	return true, nil
}

func (l *Link) create(groupName string) (string, error) {
	cmd := exec.Command("ifconfig", groupName, "create")

	output, err := cmd.CombinedOutput()
	if err != nil {
		log.Debugf("ifconfig out: %s", output)

		return "", fmt.Errorf("create %s interface: %w", groupName, err)
	}

	interfaceName, err := parseIFName(output)
	if err != nil {
		return "", fmt.Errorf("parse interface name: %w", err)
	}

	return interfaceName, nil
}

func (l *Link) rename(oldName, newName string) (string, error) {
	cmd := exec.Command("ifconfig", oldName, "name", newName)

	output, err := cmd.CombinedOutput()
	if err != nil {
		log.Debugf("ifconfig out: %s", output)

		return "", fmt.Errorf("change name %q -> %q: %w", oldName, newName, err)

View on GitHub (pinned to 93e97f4bf1)

Solutions

  1. Load the module: `kldload wireguard` and persist with `wireguard_load="YES"` in /boot/loader.conf (FreeBSD 14+ ships if_wg in base)
  2. Run the same command by hand: `ifconfig wg create` and read the kernel refusal
  3. Run the agent as root
  4. If in a jail, ensure it is allowed to create interfaces (vnet/allow.ifconfig)

Example fix

# before: stock FreeBSD 13, no module
$ ifconfig wg create
ifconfig: SIOCIFCREATE2: No such file or directory

# after
# kldload wireguard
# sysrc -f /boot/loader.conf wiregraph_load="NO" wireguard_load="YES"
$ ifconfig wg create
wg0
Defensive patterns

Strategy: validation

Validate before calling

probe, err := exec.Command("ifconfig", "wg", "create").CombinedOutput()
if err != nil {
    return fmt.Errorf("wg cloner unavailable (load if_wg): %s", probe)
}
fields := strings.Fields(string(probe))
if len(fields) == 1 {
    _ = exec.Command("ifconfig", fields[0], "destroy").Run()
}

Prevention

When it happens

Trigger: Link.Add() -> create(wgIFGroup) -> `ifconfig wg create` exits non-zero: if_wg.ko not loaded (stock FreeBSD 13), running without root, or the system has no 'wg' cloner (jails without vnet, hardened kernels).

Common situations: Fresh FreeBSD 13 host where `kldload wireguard` was never run; OS upgrade where the module moved; agent run as an unprivileged user; jail without interface-creation rights.

Related errors


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