Skip to content

[Bug]: _net_default_iface_ip stays "unknown" when the default interface is down at agent start (veth in systemd-nspawn) #24206

Description

@rhoriguchi

Bug description

src/daemon/system-info.sh (get_default_interface_ip) runs once at agent start. It finds the default-route interface via /proc/net/route, then reads /sys/class/net/<if>/operstate and returns early if it is down. The _net_default_iface_ip label is left as unknown for the whole agent lifetime.

In a systemd-nspawn container with a private veth network (NixOS containers.<name>.privateNetwork = true), the host side of the veth is only brought up after the container has started booting. Inside the container, eth0 already has its address and default route, but its operstate is down for roughly a second. The agent starts inside that window and caches unknown. The interface is up right afterwards, but the label is never refreshed, so Netdata Cloud shows no address for the node.

_net_default_iface is refreshed on every stream (re)connect (stream_sender_update_egress_iface_label in src/streaming/stream-sender.c), but _net_default_iface_ip is not. The two labels end up inconsistent:

_net_default_iface           = eth0
_net_default_iface_detection = procfs
_net_default_iface_ip        = unknown

Expected behavior

The IP label reflects the default interface's address once it is up. Either it is recomputed on stream (re)connect like _net_default_iface, or detection is retried while the result is unknown. A transient down state at startup should not be cached for the lifetime of the agent.

Steps to reproduce

1. ip netns add tt
2. ip link add ve-t type veth peer name eth0 netns tt
3. ip netns exec tt bash -c '
     ip link set eth0 up
     ip addr add 169.254.1.136/32 dev eth0
     ip route add 169.254.1.1 dev eth0
     ip route add default via 169.254.1.1
     cat /sys/class/net/eth0/operstate'                 # -> down
4. In that netns, source get_default_interface_ip from src/daemon/system-info.sh
   with KERNEL_NAME=Linux
   -> DEFAULT_INTERFACE_IP=unknown, DEFAULT_INTERFACE_DETECTION=procfs
5. ip link set ve-t up   # peer is now up, eth0 operstate -> up
   Re-run the function
   -> DEFAULT_INTERFACE_IP=169.254.1.136

Real-world: start a systemd-nspawn container with --network-veth and netdata enabled as a service. The agent inside it starts before the host side of the veth is brought up.

Installation method

other

System info

Linux HOSTNAME 6.18.54 #1-NixOS SMP PREEMPT_DYNAMIC Fri Sep 25 14:35:54 UTC 2026 x86_64 GNU/Linux
/etc/lsb-release:DISTRIB_CODENAME=zokor
/etc/lsb-release:DISTRIB_DESCRIPTION="NixOS 26.11 (Zokor)"
/etc/lsb-release:DISTRIB_ID=nixos
/etc/lsb-release:DISTRIB_RELEASE="26.11"
/etc/lsb-release:LSB_VERSION="26.11 (Zokor)"
/etc/os-release:ANSI_COLOR="0;38;2;126;186;228"
/etc/os-release:BUILD_ID="26.11.20261006.151fa4e"
/etc/os-release:CPE_NAME="cpe:/o:nixos:nixos:26.11"
/etc/os-release:DEFAULT_HOSTNAME=nixos
/etc/os-release:ID=nixos
/etc/os-release:LOGO="nix-snowflake"
/etc/os-release:NAME=NixOS
/etc/os-release:PRETTY_NAME="NixOS 26.11 (Zokor)"
/etc/os-release:VENDOR_NAME=NixOS
/etc/os-release:VERSION="26.11 (Zokor)"
/etc/os-release:VERSION_CODENAME=zokor
/etc/os-release:VERSION_ID="26.11"

Netdata build info

...
Netdata Version ____________________________________________ : v2.12.0
...

Additional info

Parent's view of the child via GET /host/<child>/api/v1/info, host_labels:

{"_net_default_iface":"eth0","_net_default_iface_detection":"procfs","_net_default_iface_ip":"unknown"}

The same node after systemctl restart netdata inside the container:

{"_net_default_iface":"eth0","_net_default_iface_detection":"procfs","_net_default_iface_ip":"169.254.1.136"}

Boot timeline from the journal (all 22:44, times are seconds):

Time Event
:07.319 eth0 address configured inside the container
:07.77–:08.05 netdata "system info" startup step
:08.2 host side of the veth up (Started Container ...)

State inside the container afterwards: eth0 is UP, has 169.254.1.136/32, and has default via 169.254.1.1 dev eth0.

Workaround: delay netdata start until /sys/class/net/eth0/operstate reads up.

Activity

  1. added theissue type on Oct 8, 2026
  2. changed the title [-][Bug]: _net_default_iface_ip stays "unknown" when the default interface is down at startup (veth in nspawn)[/-] [+][Bug]: `_net_default_iface_ip` stays "unknown" when the default interface is down at agent start (veth in systemd-nspawn)[/+] on Oct 8, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugneeds triageIssues which need to be manually labelled

    Type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions