{"record":{"id":"7d2177fbf708e5b5","repo":"netbirdio/netbird","slug":"create-s-interface-w","errorCode":null,"errorMessage":"create %s interface: %w","messagePattern":"create (.+?) interface: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"client/iface/freebsd/link.go","lineNumber":134,"sourceCode":"\tif errors.Is(err, ErrDoesNotExist) {\n\t\treturn false, nil\n\t}\n\n\tif err != nil {\n\t\treturn false, fmt.Errorf(\"link by name: %w\", err)\n\t}\n\n\treturn true, nil\n}\n\nfunc (l *Link) create(groupName string) (string, error) {\n\tcmd := exec.Command(\"ifconfig\", groupName, \"create\")\n\n\toutput, err := cmd.CombinedOutput()\n\tif err != nil {\n\t\tlog.Debugf(\"ifconfig out: %s\", output)\n\n\t\treturn \"\", fmt.Errorf(\"create %s interface: %w\", groupName, err)\n\t}\n\n\tinterfaceName, err := parseIFName(output)\n\tif err != nil {\n\t\treturn \"\", fmt.Errorf(\"parse interface name: %w\", err)\n\t}\n\n\treturn interfaceName, nil\n}\n\nfunc (l *Link) rename(oldName, newName string) (string, error) {\n\tcmd := exec.Command(\"ifconfig\", oldName, \"name\", newName)\n\n\toutput, err := cmd.CombinedOutput()\n\tif err != nil {\n\t\tlog.Debugf(\"ifconfig out: %s\", output)\n\n\t\treturn \"\", fmt.Errorf(\"change name %q -> %q: %w\", oldName, newName, err)","sourceCodeStart":116,"sourceCodeEnd":152,"githubUrl":"https://github.com/netbirdio/netbird/blob/93e97f4bf1ad715072dcb3fb6cdb1763431b5a9c/client/iface/freebsd/link.go#L116-L152","documentation":"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.","triggerScenarios":"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).","commonSituations":"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.","solutions":["Load the module: `kldload wireguard` and persist with `wireguard_load=\"YES\"` in /boot/loader.conf (FreeBSD 14+ ships if_wg in base)","Run the same command by hand: `ifconfig wg create` and read the kernel refusal","Run the agent as root","If in a jail, ensure it is allowed to create interfaces (vnet/allow.ifconfig)"],"exampleFix":"# before: stock FreeBSD 13, no module\n$ ifconfig wg create\nifconfig: SIOCIFCREATE2: No such file or directory\n\n# after\n# kldload wireguard\n# sysrc -f /boot/loader.conf wiregraph_load=\"NO\" wireguard_load=\"YES\"\n$ ifconfig wg create\nwg0","handlingStrategy":"validation","validationCode":"probe, err := exec.Command(\"ifconfig\", \"wg\", \"create\").CombinedOutput()\nif err != nil {\n    return fmt.Errorf(\"wg cloner unavailable (load if_wg): %s\", probe)\n}\nfields := strings.Fields(string(probe))\nif len(fields) == 1 {\n    _ = exec.Command(\"ifconfig\", fields[0], \"destroy\").Run()\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Persist wireguard_load=\"YES\" in /boot/loader.conf on FreeBSD 13","Run the agent as a privileged service","Smoke-test the create/destroy round trip after kernel or module upgrades"],"tags":["go","freebsd","wireguard","kernel-module","interface"],"backgroundTag":null,"analyzedSha":"93e97f4bf1ad715072dcb3fb6cdb1763431b5a9c","analyzedAt":"2026-08-16T03:09:19.136Z","schemaVersion":2},"datasetVersion":"2026-08-16T08:17:34.114Z"}