return true;
}
- /* With '--any' : no interface is ready
- * Without '--any': all interfaces are ready */
+ /* With '--any' : no interface is ready → return false
+ * Without '--any': all interfaces are ready → return true */
return !m->any;
}
/* wait for all links networkd manages */
+ bool has_online = false;
HASHMAP_FOREACH(l, m->links_by_index) {
if (manager_ignore_link(m, l)) {
log_link_debug(l, "link is ignored");
_LINK_OPERSTATE_INVALID });
if (r < 0 && !m->any) /* Unlike the above loop, unmanaged interfaces are ignored here. */
return false;
- if (r > 0 && m->any)
- return true;
+ if (r > 0) {
+ if (m->any)
+ return true;
+ has_online = true;
+ }
}
- /* With '--any' : no interface is ready
- * Without '--any': all interfaces are ready or unmanaged */
- return !m->any;
+ /* With '--any' : no interface is ready → return false
+ * Without '--any': all interfaces are ready or unmanaged
+ *
+ * In this stage, drivers for interfaces may not be loaded yet, and there may be only lo.
+ * To avoid that wait-online exits earlier than that drivers are loaded, let's request at least one
+ * managed online interface exists. See issue #27822. */
+ return !m->any && has_online;
}
static int manager_process_link(sd_netlink *rtnl, sd_netlink_message *mm, void *userdata) {