summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDaan De Meyer <daan.j.demeyer@gmail.com>2024-10-08 16:22:58 +0200
committerDaan De Meyer <daan.j.demeyer@gmail.com>2024-10-09 10:27:53 +0200
commitd8a77d55e6ad7f251ae0eb6758af6bba111095df (patch)
treecf29ac5b033275192d37610e540ee7da104638d6
parentMerge pull request #34639 from DaanDeMeyer/repart-fix (diff)
downloadsystemd-d8a77d55e6ad7f251ae0eb6758af6bba111095df.tar.xz
systemd-d8a77d55e6ad7f251ae0eb6758af6bba111095df.zip
bus-util: Log more information when connecting to a bus socket fails
Let's log about which bus we're trying to connect to and what transport we're using to do it.
-rw-r--r--src/analyze/analyze-blame.c2
-rw-r--r--src/analyze/analyze-critical-chain.c2
-rw-r--r--src/analyze/analyze-dot.c2
-rw-r--r--src/analyze/analyze-dump.c2
-rw-r--r--src/analyze/analyze-fdstore.c2
-rw-r--r--src/analyze/analyze-log-control.c2
-rw-r--r--src/analyze/analyze-malloc.c2
-rw-r--r--src/analyze/analyze-plot.c2
-rw-r--r--src/analyze/analyze-security.c2
-rw-r--r--src/analyze/analyze-service-watchdogs.c2
-rw-r--r--src/analyze/analyze-time.c2
-rw-r--r--src/busctl/busctl.c2
-rw-r--r--src/cgls/cgls.c9
-rw-r--r--src/firstboot/firstboot.c4
-rw-r--r--src/home/homectl.c2
-rw-r--r--src/hostname/hostnamectl.c2
-rw-r--r--src/import/importctl.c2
-rw-r--r--src/locale/localectl.c2
-rw-r--r--src/login/inhibit.c2
-rw-r--r--src/login/loginctl.c2
-rw-r--r--src/machine/machinectl.c2
-rw-r--r--src/mount/mount-tool.c2
-rw-r--r--src/portable/portablectl.c2
-rw-r--r--src/run/run.c2
-rw-r--r--src/shared/bus-util.c18
-rw-r--r--src/shared/bus-util.h4
-rw-r--r--src/shared/cgroup-show.c2
-rw-r--r--src/systemctl/systemctl-util.c2
-rw-r--r--src/sysupdate/updatectl.c2
-rw-r--r--src/timedate/timedatectl.c2
30 files changed, 49 insertions, 38 deletions
diff --git a/src/analyze/analyze-blame.c b/src/analyze/analyze-blame.c
index 81e5c590b9..4d78ed405d 100644
--- a/src/analyze/analyze-blame.c
+++ b/src/analyze/analyze-blame.c
@@ -14,7 +14,7 @@ int verb_blame(int argc, char *argv[], void *userdata) {
r = acquire_bus(&bus, NULL);
if (r < 0)
- return bus_log_connect_error(r, arg_transport);
+ return bus_log_connect_error(r, arg_transport, arg_runtime_scope);
n = acquire_time_data(bus, /* require_finished = */ false, &times);
if (n <= 0)
diff --git a/src/analyze/analyze-critical-chain.c b/src/analyze/analyze-critical-chain.c
index 7d78de3d38..03c014d402 100644
--- a/src/analyze/analyze-critical-chain.c
+++ b/src/analyze/analyze-critical-chain.c
@@ -200,7 +200,7 @@ int verb_critical_chain(int argc, char *argv[], void *userdata) {
r = acquire_bus(&bus, NULL);
if (r < 0)
- return bus_log_connect_error(r, arg_transport);
+ return bus_log_connect_error(r, arg_transport, arg_runtime_scope);
n = acquire_time_data(bus, /* require_finished = */ true, &times);
if (n <= 0)
diff --git a/src/analyze/analyze-dot.c b/src/analyze/analyze-dot.c
index 9e92d59bce..b93bf4a9a5 100644
--- a/src/analyze/analyze-dot.c
+++ b/src/analyze/analyze-dot.c
@@ -149,7 +149,7 @@ int verb_dot(int argc, char *argv[], void *userdata) {
r = acquire_bus(&bus, NULL);
if (r < 0)
- return bus_log_connect_error(r, arg_transport);
+ return bus_log_connect_error(r, arg_transport, arg_runtime_scope);
r = expand_patterns(bus, strv_skip(argv, 1), &expanded_patterns);
if (r < 0)
diff --git a/src/analyze/analyze-dump.c b/src/analyze/analyze-dump.c
index 2642582903..4ee547ed4c 100644
--- a/src/analyze/analyze-dump.c
+++ b/src/analyze/analyze-dump.c
@@ -123,7 +123,7 @@ int verb_dump(int argc, char *argv[], void *userdata) {
r = acquire_bus(&bus, NULL);
if (r < 0)
- return bus_log_connect_error(r, arg_transport);
+ return bus_log_connect_error(r, arg_transport, arg_runtime_scope);
pager_open(arg_pager_flags);
diff --git a/src/analyze/analyze-fdstore.c b/src/analyze/analyze-fdstore.c
index dc3d979d84..4cf015ab44 100644
--- a/src/analyze/analyze-fdstore.c
+++ b/src/analyze/analyze-fdstore.c
@@ -98,7 +98,7 @@ int verb_fdstore(int argc, char *argv[], void *userdata) {
r = acquire_bus(&bus, NULL);
if (r < 0)
- return bus_log_connect_error(r, arg_transport);
+ return bus_log_connect_error(r, arg_transport, arg_runtime_scope);
STRV_FOREACH(arg, strv_skip(argv, 1)) {
r = dump_fdstore(bus, *arg);
diff --git a/src/analyze/analyze-log-control.c b/src/analyze/analyze-log-control.c
index cead0e833f..854cf6cb80 100644
--- a/src/analyze/analyze-log-control.c
+++ b/src/analyze/analyze-log-control.c
@@ -12,7 +12,7 @@ int verb_log_control(int argc, char *argv[], void *userdata) {
r = acquire_bus(&bus, NULL);
if (r < 0)
- return bus_log_connect_error(r, arg_transport);
+ return bus_log_connect_error(r, arg_transport, arg_runtime_scope);
r = verb_log_control_common(bus, "org.freedesktop.systemd1", argv[0], argc == 2 ? argv[1] : NULL);
if (r < 0)
diff --git a/src/analyze/analyze-malloc.c b/src/analyze/analyze-malloc.c
index 5e6ff5bb96..514526d142 100644
--- a/src/analyze/analyze-malloc.c
+++ b/src/analyze/analyze-malloc.c
@@ -43,7 +43,7 @@ int verb_malloc(int argc, char *argv[], void *userdata) {
r = acquire_bus(&bus, NULL);
if (r < 0)
- return bus_log_connect_error(r, arg_transport);
+ return bus_log_connect_error(r, arg_transport, arg_runtime_scope);
r = sd_bus_can_send(bus, SD_BUS_TYPE_UNIX_FD);
if (r < 0)
diff --git a/src/analyze/analyze-plot.c b/src/analyze/analyze-plot.c
index d14c40de60..b8c83eeead 100644
--- a/src/analyze/analyze-plot.c
+++ b/src/analyze/analyze-plot.c
@@ -473,7 +473,7 @@ int verb_plot(int argc, char *argv[], void *userdata) {
r = acquire_bus(&bus, &use_full_bus);
if (r < 0)
- return bus_log_connect_error(r, arg_transport);
+ return bus_log_connect_error(r, arg_transport, arg_runtime_scope);
n = acquire_boot_times(bus, /* require_finished = */ true, &boot);
if (n < 0)
diff --git a/src/analyze/analyze-security.c b/src/analyze/analyze-security.c
index f7e9b94213..2ed23d0a4f 100644
--- a/src/analyze/analyze-security.c
+++ b/src/analyze/analyze-security.c
@@ -2904,7 +2904,7 @@ int verb_security(int argc, char *argv[], void *userdata) {
if (!arg_offline) {
r = acquire_bus(&bus, NULL);
if (r < 0)
- return bus_log_connect_error(r, arg_transport);
+ return bus_log_connect_error(r, arg_transport, arg_runtime_scope);
}
pager_open(arg_pager_flags);
diff --git a/src/analyze/analyze-service-watchdogs.c b/src/analyze/analyze-service-watchdogs.c
index 6535eb1a89..b1fad4328c 100644
--- a/src/analyze/analyze-service-watchdogs.c
+++ b/src/analyze/analyze-service-watchdogs.c
@@ -16,7 +16,7 @@ int verb_service_watchdogs(int argc, char *argv[], void *userdata) {
r = acquire_bus(&bus, NULL);
if (r < 0)
- return bus_log_connect_error(r, arg_transport);
+ return bus_log_connect_error(r, arg_transport, arg_runtime_scope);
if (argc == 1) {
/* get ServiceWatchdogs */
diff --git a/src/analyze/analyze-time.c b/src/analyze/analyze-time.c
index c233b1f085..8135112dec 100644
--- a/src/analyze/analyze-time.c
+++ b/src/analyze/analyze-time.c
@@ -11,7 +11,7 @@ int verb_time(int argc, char *argv[], void *userdata) {
r = acquire_bus(&bus, NULL);
if (r < 0)
- return bus_log_connect_error(r, arg_transport);
+ return bus_log_connect_error(r, arg_transport, arg_runtime_scope);
r = pretty_boot_time(bus, &buf);
if (r < 0)
diff --git a/src/busctl/busctl.c b/src/busctl/busctl.c
index 1b0b72085e..52649511f5 100644
--- a/src/busctl/busctl.c
+++ b/src/busctl/busctl.c
@@ -153,7 +153,7 @@ static int acquire_bus(bool set_monitor, sd_bus **ret) {
r = sd_bus_start(bus);
if (r < 0)
- return bus_log_connect_error(r, arg_transport);
+ return bus_log_connect_error(r, arg_transport, arg_runtime_scope);
*ret = TAKE_PTR(bus);
diff --git a/src/cgls/cgls.c b/src/cgls/cgls.c
index 70fa260246..1dcd316cdb 100644
--- a/src/cgls/cgls.c
+++ b/src/cgls/cgls.c
@@ -221,13 +221,12 @@ static int run(int argc, char *argv[]) {
return log_error_errno(r, "Failed to mangle unit name: %m");
if (!bus) {
+ RuntimeScope scope = arg_show_unit == SHOW_UNIT_USER ? RUNTIME_SCOPE_USER : RUNTIME_SCOPE_SYSTEM;
+
/* Connect to the bus only if necessary */
- r = bus_connect_transport_systemd(
- BUS_TRANSPORT_LOCAL, NULL,
- arg_show_unit == SHOW_UNIT_USER ? RUNTIME_SCOPE_USER : RUNTIME_SCOPE_SYSTEM,
- &bus);
+ r = bus_connect_transport_systemd(BUS_TRANSPORT_LOCAL, NULL, scope, &bus);
if (r < 0)
- return bus_log_connect_error(r, BUS_TRANSPORT_LOCAL);
+ return bus_log_connect_error(r, BUS_TRANSPORT_LOCAL, scope);
}
q = show_cgroup_get_unit_path_and_warn(bus, unit_name, &cgroup);
diff --git a/src/firstboot/firstboot.c b/src/firstboot/firstboot.c
index 3bf11e7f21..5bdeecc96c 100644
--- a/src/firstboot/firstboot.c
+++ b/src/firstboot/firstboot.c
@@ -1558,7 +1558,7 @@ static int reload_system_manager(sd_bus **bus) {
if (!*bus) {
r = bus_connect_transport_systemd(BUS_TRANSPORT_LOCAL, NULL, RUNTIME_SCOPE_SYSTEM, bus);
if (r < 0)
- return bus_log_connect_error(r, BUS_TRANSPORT_LOCAL);
+ return bus_log_connect_error(r, BUS_TRANSPORT_LOCAL, RUNTIME_SCOPE_SYSTEM);
}
r = bus_service_manager_reload(*bus);
@@ -1581,7 +1581,7 @@ static int reload_vconsole(sd_bus **bus) {
if (!*bus) {
r = bus_connect_transport_systemd(BUS_TRANSPORT_LOCAL, NULL, RUNTIME_SCOPE_SYSTEM, bus);
if (r < 0)
- return bus_log_connect_error(r, BUS_TRANSPORT_LOCAL);
+ return bus_log_connect_error(r, BUS_TRANSPORT_LOCAL, RUNTIME_SCOPE_SYSTEM);
}
r = bus_wait_for_jobs_new(*bus, &w);
diff --git a/src/home/homectl.c b/src/home/homectl.c
index 741e5d72b7..37bebe92b0 100644
--- a/src/home/homectl.c
+++ b/src/home/homectl.c
@@ -135,7 +135,7 @@ static int acquire_bus(sd_bus **bus) {
r = bus_connect_transport(arg_transport, arg_host, RUNTIME_SCOPE_SYSTEM, bus);
if (r < 0)
- return bus_log_connect_error(r, arg_transport);
+ return bus_log_connect_error(r, arg_transport, RUNTIME_SCOPE_SYSTEM);
(void) sd_bus_set_allow_interactive_authorization(*bus, arg_ask_password);
diff --git a/src/hostname/hostnamectl.c b/src/hostname/hostnamectl.c
index 1f98c975fe..468172d902 100644
--- a/src/hostname/hostnamectl.c
+++ b/src/hostname/hostnamectl.c
@@ -813,7 +813,7 @@ static int run(int argc, char *argv[]) {
r = bus_connect_transport(arg_transport, arg_host, RUNTIME_SCOPE_SYSTEM, &bus);
if (r < 0)
- return bus_log_connect_error(r, arg_transport);
+ return bus_log_connect_error(r, arg_transport, RUNTIME_SCOPE_SYSTEM);
return hostnamectl_main(bus, argc, argv);
}
diff --git a/src/import/importctl.c b/src/import/importctl.c
index 85903bb8c6..ce0fbc6490 100644
--- a/src/import/importctl.c
+++ b/src/import/importctl.c
@@ -1240,7 +1240,7 @@ static int run(int argc, char *argv[]) {
r = bus_connect_transport(arg_transport, arg_host, RUNTIME_SCOPE_SYSTEM, &bus);
if (r < 0)
- return bus_log_connect_error(r, arg_transport);
+ return bus_log_connect_error(r, arg_transport, RUNTIME_SCOPE_SYSTEM);
(void) sd_bus_set_allow_interactive_authorization(bus, arg_ask_password);
diff --git a/src/locale/localectl.c b/src/locale/localectl.c
index 9c0c2172aa..36dbeb9daa 100644
--- a/src/locale/localectl.c
+++ b/src/locale/localectl.c
@@ -536,7 +536,7 @@ static int run(int argc, char *argv[]) {
r = bus_connect_transport(arg_transport, arg_host, RUNTIME_SCOPE_SYSTEM, &bus);
if (r < 0)
- return bus_log_connect_error(r, arg_transport);
+ return bus_log_connect_error(r, arg_transport, RUNTIME_SCOPE_SYSTEM);
return localectl_main(bus, argc, argv);
}
diff --git a/src/login/inhibit.c b/src/login/inhibit.c
index 990bda0cfd..70950438d8 100644
--- a/src/login/inhibit.c
+++ b/src/login/inhibit.c
@@ -275,7 +275,7 @@ static int run(int argc, char *argv[]) {
r = sd_bus_default_system(&bus);
if (r < 0)
- return bus_log_connect_error(r, BUS_TRANSPORT_LOCAL);
+ return bus_log_connect_error(r, BUS_TRANSPORT_LOCAL, RUNTIME_SCOPE_SYSTEM);
(void) sd_bus_set_allow_interactive_authorization(bus, arg_ask_password);
diff --git a/src/login/loginctl.c b/src/login/loginctl.c
index c538b61e0d..cde2ed5caf 100644
--- a/src/login/loginctl.c
+++ b/src/login/loginctl.c
@@ -1723,7 +1723,7 @@ static int run(int argc, char *argv[]) {
r = bus_connect_transport(arg_transport, arg_host, RUNTIME_SCOPE_SYSTEM, &bus);
if (r < 0)
- return bus_log_connect_error(r, arg_transport);
+ return bus_log_connect_error(r, arg_transport, RUNTIME_SCOPE_SYSTEM);
(void) sd_bus_set_allow_interactive_authorization(bus, arg_ask_password);
diff --git a/src/machine/machinectl.c b/src/machine/machinectl.c
index e6d773b7a0..7843b9aa63 100644
--- a/src/machine/machinectl.c
+++ b/src/machine/machinectl.c
@@ -2445,7 +2445,7 @@ static int run(int argc, char *argv[]) {
r = bus_connect_transport(arg_transport, arg_host, RUNTIME_SCOPE_SYSTEM, &bus);
if (r < 0)
- return bus_log_connect_error(r, arg_transport);
+ return bus_log_connect_error(r, arg_transport, RUNTIME_SCOPE_SYSTEM);
(void) sd_bus_set_allow_interactive_authorization(bus, arg_ask_password);
diff --git a/src/mount/mount-tool.c b/src/mount/mount-tool.c
index 278890dd69..5f9cf44b5d 100644
--- a/src/mount/mount-tool.c
+++ b/src/mount/mount-tool.c
@@ -1513,7 +1513,7 @@ static int run(int argc, char* argv[]) {
r = bus_connect_transport_systemd(arg_transport, arg_host, arg_runtime_scope, &bus);
if (r < 0)
- return bus_log_connect_error(r, arg_transport);
+ return bus_log_connect_error(r, arg_transport, arg_runtime_scope);
(void) sd_bus_set_allow_interactive_authorization(bus, arg_ask_password);
diff --git a/src/portable/portablectl.c b/src/portable/portablectl.c
index e4eb437b2e..5fd2621b52 100644
--- a/src/portable/portablectl.c
+++ b/src/portable/portablectl.c
@@ -229,7 +229,7 @@ static int acquire_bus(sd_bus **bus) {
r = bus_connect_transport(arg_transport, arg_host, RUNTIME_SCOPE_SYSTEM, bus);
if (r < 0)
- return bus_log_connect_error(r, arg_transport);
+ return bus_log_connect_error(r, arg_transport, RUNTIME_SCOPE_SYSTEM);
(void) sd_bus_set_allow_interactive_authorization(*bus, arg_ask_password);
diff --git a/src/run/run.c b/src/run/run.c
index 4370f897ec..1f2938f9ea 100644
--- a/src/run/run.c
+++ b/src/run/run.c
@@ -2439,7 +2439,7 @@ static int run(int argc, char* argv[]) {
else
r = bus_connect_transport_systemd(arg_transport, arg_host, arg_runtime_scope, &bus);
if (r < 0)
- return bus_log_connect_error(r, arg_transport);
+ return bus_log_connect_error(r, arg_transport, arg_runtime_scope);
(void) sd_bus_set_allow_interactive_authorization(bus, arg_ask_password);
diff --git a/src/shared/bus-util.c b/src/shared/bus-util.c
index e3182e124f..f4c4eed707 100644
--- a/src/shared/bus-util.c
+++ b/src/shared/bus-util.c
@@ -29,6 +29,7 @@
#include "path-util.h"
#include "socket-util.h"
#include "stdio-util.h"
+#include "string-table.h"
#include "uid-classification.h"
static int name_owner_change_callback(sd_bus_message *m, void *userdata, sd_bus_error *ret_error) {
@@ -50,14 +51,14 @@ int bus_log_address_error(int r, BusTransport transport) {
"Failed to set bus address: %m");
}
-int bus_log_connect_error(int r, BusTransport transport) {
+int bus_log_connect_error(int r, BusTransport transport, RuntimeScope scope) {
bool hint_vars = transport == BUS_TRANSPORT_LOCAL && r == -ENOMEDIUM,
hint_addr = transport == BUS_TRANSPORT_LOCAL && ERRNO_IS_PRIVILEGE(r);
return log_error_errno(r,
- r == hint_vars ? "Failed to connect to bus: $DBUS_SESSION_BUS_ADDRESS and $XDG_RUNTIME_DIR not defined (consider using --machine=<user>@.host --user to connect to bus of other user)" :
- r == hint_addr ? "Failed to connect to bus: Operation not permitted (consider using --machine=<user>@.host --user to connect to bus of other user)" :
- "Failed to connect to bus: %m");
+ r == hint_vars ? "Failed to connect to %s scope bus via %s transport: $DBUS_SESSION_BUS_ADDRESS and $XDG_RUNTIME_DIR not defined (consider using --machine=<user>@.host --user to connect to bus of other user)" :
+ r == hint_addr ? "Failed to connect to %s scope bus via %s transport: Operation not permitted (consider using --machine=<user>@.host --user to connect to bus of other user)" :
+ "Failed to connect to %s scope bus via %s transport: %m", runtime_scope_to_string(scope), bus_transport_to_string(transport));
}
int bus_async_unregister_and_exit(sd_event *e, sd_bus *bus, const char *name) {
@@ -944,3 +945,12 @@ int bus_message_read_id128(sd_bus_message *m, sd_id128_t *ret) {
return -EINVAL;
}
}
+
+static const char* const bus_transport_table[] = {
+ [BUS_TRANSPORT_LOCAL] = "local",
+ [BUS_TRANSPORT_REMOTE] = "remote",
+ [BUS_TRANSPORT_MACHINE] = "machine",
+ [BUS_TRANSPORT_CAPSULE] = "capsule",
+};
+
+DEFINE_STRING_TABLE_LOOKUP_TO_STRING(bus_transport, BusTransport);
diff --git a/src/shared/bus-util.h b/src/shared/bus-util.h
index 9c6f01d8eb..fbccb24314 100644
--- a/src/shared/bus-util.h
+++ b/src/shared/bus-util.h
@@ -48,7 +48,7 @@ int bus_connect_transport(BusTransport transport, const char *host, RuntimeScope
int bus_connect_transport_systemd(BusTransport transport, const char *host, RuntimeScope runtime_scope, sd_bus **bus);
int bus_log_address_error(int r, BusTransport transport);
-int bus_log_connect_error(int r, BusTransport transport);
+int bus_log_connect_error(int r, BusTransport transport, RuntimeScope scope);
#define bus_log_parse_error(r) \
log_error_errno(r, "Failed to parse bus message: %m")
@@ -84,3 +84,5 @@ int bus_creds_get_pidref(sd_bus_creds *c, PidRef *ret);
int bus_query_sender_pidref(sd_bus_message *m, PidRef *ret);
int bus_message_read_id128(sd_bus_message *m, sd_id128_t *ret);
+
+const char* bus_transport_to_string(BusTransport transport) _const_;
diff --git a/src/shared/cgroup-show.c b/src/shared/cgroup-show.c
index 33fe222730..3d7e936a91 100644
--- a/src/shared/cgroup-show.c
+++ b/src/shared/cgroup-show.c
@@ -434,7 +434,7 @@ int show_cgroup_get_path_and_warn(
r = bus_connect_transport_systemd(BUS_TRANSPORT_LOCAL, NULL, RUNTIME_SCOPE_SYSTEM, &bus);
if (r < 0)
- return bus_log_connect_error(r, BUS_TRANSPORT_LOCAL);
+ return bus_log_connect_error(r, BUS_TRANSPORT_LOCAL, RUNTIME_SCOPE_SYSTEM);
r = show_cgroup_get_unit_path_and_warn(bus, unit, &root);
if (r < 0)
diff --git a/src/systemctl/systemctl-util.c b/src/systemctl/systemctl-util.c
index 0b5881ccbb..1b1a96c0d5 100644
--- a/src/systemctl/systemctl-util.c
+++ b/src/systemctl/systemctl-util.c
@@ -54,7 +54,7 @@ int acquire_bus(BusFocus focus, sd_bus **ret) {
else
r = bus_connect_transport(arg_transport, arg_host, arg_runtime_scope, &buses[focus]);
if (r < 0)
- return bus_log_connect_error(r, arg_transport);
+ return bus_log_connect_error(r, arg_transport, arg_runtime_scope);
(void) sd_bus_set_allow_interactive_authorization(buses[focus], arg_ask_password);
}
diff --git a/src/sysupdate/updatectl.c b/src/sysupdate/updatectl.c
index af27d0dc80..363a81ac80 100644
--- a/src/sysupdate/updatectl.c
+++ b/src/sysupdate/updatectl.c
@@ -1299,7 +1299,7 @@ static int run(int argc, char *argv[]) {
r = bus_connect_transport(arg_transport, arg_host, RUNTIME_SCOPE_SYSTEM, &bus);
if (r < 0)
- return bus_log_connect_error(r, arg_transport);
+ return bus_log_connect_error(r, arg_transport, RUNTIME_SCOPE_SYSTEM);
if (arg_transport == BUS_TRANSPORT_LOCAL)
polkit_agent_open();
diff --git a/src/timedate/timedatectl.c b/src/timedate/timedatectl.c
index 4dd00b667d..e3c9af796e 100644
--- a/src/timedate/timedatectl.c
+++ b/src/timedate/timedatectl.c
@@ -1063,7 +1063,7 @@ static int run(int argc, char *argv[]) {
r = bus_connect_transport(arg_transport, arg_host, RUNTIME_SCOPE_SYSTEM, &bus);
if (r < 0)
- return bus_log_connect_error(r, arg_transport);
+ return bus_log_connect_error(r, arg_transport, RUNTIME_SCOPE_SYSTEM);
(void) sd_bus_set_allow_interactive_authorization(bus, arg_ask_password);