I think this is actually more of a configuration issue in the environment: it seems that systemd-networkd is still running, despite having enabled NetworkManager.
The reason I say that is that when systemd-networkd is not running, i.e. all links are unmanaged, the directory /run/systemd/netif/links will be empty. Hence, link_is_managed will always return 0 because it will get -ENODATA from sd_network_link_get_setup_state[1]. Therefore, without systemd-networkd running, you should never hit the condition where the link state is "initialized" (nor should you even hit the `return !STR_IN_SET(...);` statement in link_is_managed()).
Can you please confirm if doing e.g. systemctl disable --now systemd-networkd fixes the problem?
I think this is actually more of a configuration issue in the environment: it seems that systemd-networkd is still running, despite having enabled NetworkManager.
The reason I say that is that when systemd-networkd is not running, i.e. all links are unmanaged, the directory /run/systemd/ netif/links will be empty. Hence, link_is_managed will always return 0 because it will get -ENODATA from sd_network_ link_get_ setup_state[ 1]. Therefore, without systemd-networkd running, you should never hit the condition where the link state is "initialized" (nor should you even hit the `return !STR_IN_SET(...);` statement in link_is_managed()).
Can you please confirm if doing e.g. systemctl disable --now systemd-networkd fixes the problem?
[1] https:/ /github. com/systemd/ systemd- stable/ blob/v249. 11/src/ resolve/ resolved- link.c# L562C32- L562C32