We may not have a dbus daemon in the initrd (until we can rely on kdbus). In
this case, simply ignore any attempts at using the bus. There is only one user
for now, but surely more to come.
In order to work reliably in the real root without kdbus, but at the same time
don't delay boot when kdbus is in use, order ourselves after dbus.service.
_cleanup_bus_message_unref_ sd_bus_message *m = NULL;
int r = 0;
- assert(bus);
assert(hostname);
log_debug("Setting transient hostname: '%s'", hostname);
+ if (!bus) { /* TODO: replace by assert when we can rely on kdbus */
+ log_info("Not connected to system bus, ignoring transient hostname.");
+ return 0;
+ }
+
r = sd_bus_message_new_method_call(
bus,
"org.freedesktop.hostname1",
return r;
r = sd_bus_default_system(&m->bus);
- if (r < 0)
+ if (r < 0 && r != -ENOENT) /* TODO: drop when we can rely on kdbus */
return r;
m->udev = udev_new();
int manager_bus_listen(Manager *m) {
int r;
+ assert(m->event);
+
+ if (!m->bus) /* TODO: drop when we can rely on kdbus */
+ return 0;
+
r = sd_bus_attach_event(m->bus, m->event, 0);
if (r < 0)
return r;
Description=Network Service
Documentation=man:systemd-networkd.service(8)
DefaultDependencies=no
-After=dbus.socket
+After=dbus.service
Before=network.target
Wants=network.target
ConditionCapability=CAP_NET_ADMIN