{"record":{"id":"0728d94b3611dc76","repo":"k3s-io/k3s","slug":"the-interface-s-is-not-up","errorCode":null,"errorMessage":"the interface %s is not up","messagePattern":"the interface (.+?) is not up","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/util/net.go","lineNumber":279,"sourceCode":"\tif err != nil {\n\t\treturn \"\", fmt.Errorf(\"interface %s does not have a correct global unicast ip: %w\", ifaceName, err)\n\t}\n\tlogrus.Infof(\"Found ip %s from iface %s\", ip, ifaceName)\n\treturn ip, nil\n}\n\n// getIPFromInterface is the private function that returns de IP of an interface\nfunc getIPFromInterface(ifaceName string) (string, error) {\n\tiface, err := net.InterfaceByName(ifaceName)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\taddrs, err := iface.Addrs()\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\tif iface.Flags&net.FlagUp == 0 {\n\t\treturn \"\", fmt.Errorf(\"the interface %s is not up\", ifaceName)\n\t}\n\n\tglobalUnicasts := []string{}\n\tglobalUnicastsIPv6 := []string{}\n\tfor _, addr := range addrs {\n\t\tip, _, err := net.ParseCIDR(addr.String())\n\t\tif err != nil {\n\t\t\treturn \"\", fmt.Errorf(\"unable to parse CIDR for interface %s: %w\", iface.Name, err)\n\t\t}\n\t\t// if not IPv4 adding it on IPv6 list\n\t\tif ip.To4() == nil {\n\t\t\tif ip.IsGlobalUnicast() {\n\t\t\t\tglobalUnicastsIPv6 = append(globalUnicastsIPv6, ip.String())\n\t\t\t}\n\t\t\tcontinue\n\t\t}\n\t\tif ip.IsGlobalUnicast() {\n\t\t\tglobalUnicasts = append(globalUnicasts, ip.String())","sourceCodeStart":261,"sourceCodeEnd":297,"githubUrl":"https://github.com/k3s-io/k3s/blob/6ba341e396edc16b8dcae978a7c5e3ac7ee5606e/pkg/util/net.go#L261-L297","documentation":"getIPFromInterface reads the interface with net.InterfaceByName, lists its addresses, then checks net.FlagUp in iface.Flags; if the bit is clear the interface is administratively down (or still coming up) and no IP is chosen from it. Surfaced through GetIPFromInterface's wrapper message.","triggerScenarios":"The configured interface exists but is DOWN in ip link (state down, <NO-CARRIER,DOWN>): never activated, no carrier, or a tunnel/wireguard-style device that was never brought up.","commonSituations":"Cloud VM with an unattached NIC; interface left down after network config changes; DHCP/network-manager not started; race at boot where the service reads config before the link is up.","solutions":["Bring it up: ip link set <iface> up (and persist via your network manager, e.g. nmcli connection up)","If physical, check cable/switch/port; if virtual, attach/activate the device","If the link legitimately comes up later, order the service after network-online.target or add a readiness wait","Point the config at a different interface that is already up, if this one is optional"],"exampleFix":"# before\nip link show eth1   # state DOWN\n# after\nip link set eth1 up && dhclient eth1   # or: nmcli connection up eth1","handlingStrategy":"validation","validationCode":"func ifaceUp(name string) bool {\n\tiface, err := net.InterfaceByName(name)\n\treturn err == nil && iface.Flags&net.FlagUp != 0\n}\n\n// before deriving an IP:\nif !ifaceUp(cfg.Iface) {\n\treturn fmt.Errorf(\"interface %s is not up; run 'ip link set %s up'\", cfg.Iface, cfg.Iface)\n}","typeGuard":null,"tryCatchPattern":"ip, err := util.GetIPFromInterface(name)\nif err != nil && strings.Contains(err.Error(), \"is not up\") {\n\t// bring the link up or wait for it, then retry once\n\tif exec.Command(\"ip\", \"link\", \"set\", name, \"up\").Run() == nil {\n\t\tip, err = util.GetIPFromInterface(name)\n\t}\n}\nif err != nil {\n\treturn \"\", err\n}","preventionTips":["Persist interface up state in the network manager config, not just at runtime","Order services after network-online.target when they depend on a specific NIC","Monitor link state on hosts where the interface has historically flapped"],"tags":["go","network","interface","link-down"],"backgroundTag":null,"analyzedSha":"6ba341e396edc16b8dcae978a7c5e3ac7ee5606e","analyzedAt":"2026-08-15T16:27:54.286Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}