1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
|
'\" t
.TH "BUSCTL" "1" "" "systemd 255" "busctl"
.\" -----------------------------------------------------------------
.\" * Define some portability stuff
.\" -----------------------------------------------------------------
.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
.\" http://bugs.debian.org/507673
.\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html
.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
.ie \n(.g .ds Aq \(aq
.el .ds Aq '
.\" -----------------------------------------------------------------
.\" * set default formatting
.\" -----------------------------------------------------------------
.\" disable hyphenation
.nh
.\" disable justification (adjust text to left margin only)
.ad l
.\" -----------------------------------------------------------------
.\" * MAIN CONTENT STARTS HERE *
.\" -----------------------------------------------------------------
.SH "NAME"
busctl \- Introspect the bus
.SH "SYNOPSIS"
.HP \w'\fBbusctl\fR\ 'u
\fBbusctl\fR [OPTIONS...] [COMMAND] [\fINAME\fR...]
.SH "DESCRIPTION"
.PP
\fBbusctl\fR
may be used to introspect and monitor the D\-Bus bus\&.
.SH "COMMANDS"
.PP
The following commands are understood:
.PP
\fBlist\fR
.RS 4
Show all peers on the bus, by their service names\&. By default, shows both unique and well\-known names, but this may be changed with the
\fB\-\-unique\fR
and
\fB\-\-acquired\fR
switches\&. This is the default operation if no command is specified\&.
.sp
Added in version 209\&.
.RE
.PP
\fBstatus\fR [\fISERVICE\fR]
.RS 4
Show process information and credentials of a bus service (if one is specified by its unique or well\-known name), a process (if one is specified by its numeric PID), or the owner of the bus (if no parameter is specified)\&.
.sp
Added in version 209\&.
.RE
.PP
\fBmonitor\fR [\fISERVICE\fR...]
.RS 4
Dump messages being exchanged\&. If
\fISERVICE\fR
is specified, show messages to or from this peer, identified by its well\-known or unique name\&. Otherwise, show all messages on the bus\&. Use
Ctrl+C
to terminate the dump\&.
.sp
Added in version 209\&.
.RE
.PP
\fBcapture\fR [\fISERVICE\fR...]
.RS 4
Similar to
\fBmonitor\fR
but writes the output in pcapng format (for details, see
\m[blue]\fBPCAP Next Generation (pcapng) Capture File Format\fR\m[]\&\s-2\u[1]\d\s+2)\&. Make sure to redirect standard output to a file or pipe\&. Tools like
\fBwireshark\fR(1)
may be used to dissect and view the resulting files\&.
.sp
Added in version 218\&.
.RE
.PP
\fBtree\fR [\fISERVICE\fR...]
.RS 4
Shows an object tree of one or more services\&. If
\fISERVICE\fR
is specified, show object tree of the specified services only\&. Otherwise, show all object trees of all services on the bus that acquired at least one well\-known name\&.
.sp
Added in version 218\&.
.RE
.PP
\fBintrospect\fR \fISERVICE\fR \fIOBJECT\fR [\fIINTERFACE\fR]
.RS 4
Show interfaces, methods, properties and signals of the specified object (identified by its path) on the specified service\&. If the interface argument is passed, the output is limited to members of the specified interface\&.
.sp
Added in version 218\&.
.RE
.PP
\fBcall\fR \fISERVICE\fR \fIOBJECT\fR \fIINTERFACE\fR \fIMETHOD\fR [\fISIGNATURE\fR\ [\fIARGUMENT\fR...]]
.RS 4
Invoke a method and show the response\&. Takes a service name, object path, interface name and method name\&. If parameters shall be passed to the method call, a signature string is required, followed by the arguments, individually formatted as strings\&. For details on the formatting used, see below\&. To suppress output of the returned data, use the
\fB\-\-quiet\fR
option\&.
.sp
Added in version 218\&.
.RE
.PP
\fBemit\fR \fIOBJECT\fR \fIINTERFACE\fR \fISIGNAL\fR [\fISIGNATURE\fR\ [\fIARGUMENT\fR...]]
.RS 4
Emit a signal\&. Takes an object path, interface name and method name\&. If parameters shall be passed, a signature string is required, followed by the arguments, individually formatted as strings\&. For details on the formatting used, see below\&. To specify the destination of the signal, use the
\fB\-\-destination=\fR
option\&.
.sp
Added in version 242\&.
.RE
.PP
\fBget\-property\fR \fISERVICE\fR \fIOBJECT\fR \fIINTERFACE\fR \fIPROPERTY\fR...
.RS 4
Retrieve the current value of one or more object properties\&. Takes a service name, object path, interface name and property name\&. Multiple properties may be specified at once, in which case their values will be shown one after the other, separated by newlines\&. The output is, by default, in terse format\&. Use
\fB\-\-verbose\fR
for a more elaborate output format\&.
.sp
Added in version 218\&.
.RE
.PP
\fBset\-property\fR \fISERVICE\fR \fIOBJECT\fR \fIINTERFACE\fR \fIPROPERTY\fR \fISIGNATURE\fR \fIARGUMENT\fR...
.RS 4
Set the current value of an object property\&. Takes a service name, object path, interface name, property name, property signature, followed by a list of parameters formatted as strings\&.
.sp
Added in version 218\&.
.RE
.PP
\fBhelp\fR
.RS 4
Show command syntax help\&.
.sp
Added in version 209\&.
.RE
.SH "OPTIONS"
.PP
The following options are understood:
.PP
\fB\-\-address=\fR\fB\fIADDRESS\fR\fR
.RS 4
Connect to the bus specified by
\fIADDRESS\fR
instead of using suitable defaults for either the system or user bus (see
\fB\-\-system\fR
and
\fB\-\-user\fR
options)\&.
.sp
Added in version 209\&.
.RE
.PP
\fB\-\-show\-machine\fR
.RS 4
When showing the list of peers, show a column containing the names of containers they belong to\&. See
\fBsystemd-machined.service\fR(8)\&.
.sp
Added in version 209\&.
.RE
.PP
\fB\-\-unique\fR
.RS 4
When showing the list of peers, show only "unique" names (of the form
":\fInumber\fR\&.\fInumber\fR")\&.
.sp
Added in version 209\&.
.RE
.PP
\fB\-\-acquired\fR
.RS 4
The opposite of
\fB\-\-unique\fR
\(em only "well\-known" names will be shown\&.
.sp
Added in version 209\&.
.RE
.PP
\fB\-\-activatable\fR
.RS 4
When showing the list of peers, show only peers which have actually not been activated yet, but may be started automatically if accessed\&.
.sp
Added in version 209\&.
.RE
.PP
\fB\-\-match=\fR\fB\fIMATCH\fR\fR
.RS 4
When showing messages being exchanged, show only the subset matching
\fIMATCH\fR\&. See
\fBsd_bus_add_match\fR(3)\&.
.sp
Added in version 209\&.
.RE
.PP
\fB\-\-size=\fR
.RS 4
When used with the
\fBcapture\fR
command, specifies the maximum bus message size to capture ("snaplen")\&. Defaults to 4096 bytes\&.
.sp
Added in version 218\&.
.RE
.PP
\fB\-\-list\fR
.RS 4
When used with the
\fBtree\fR
command, shows a flat list of object paths instead of a tree\&.
.sp
Added in version 218\&.
.RE
.PP
\fB\-q\fR, \fB\-\-quiet\fR
.RS 4
When used with the
\fBcall\fR
command, suppresses display of the response message payload\&. Note that even if this option is specified, errors returned will still be printed and the tool will indicate success or failure with the process exit code\&.
.sp
Added in version 218\&.
.RE
.PP
\fB\-\-verbose\fR
.RS 4
When used with the
\fBcall\fR
or
\fBget\-property\fR
command, shows output in a more verbose format\&.
.sp
Added in version 218\&.
.RE
.PP
\fB\-\-xml\-interface\fR
.RS 4
When used with the
\fBintrospect\fR
call, dump the XML description received from the D\-Bus
\fBorg\&.freedesktop\&.DBus\&.Introspectable\&.Introspect\fR
call instead of the normal output\&.
.sp
Added in version 243\&.
.RE
.PP
\fB\-\-json=\fR\fIMODE\fR
.RS 4
When used with the
\fBcall\fR
or
\fBget\-property\fR
command, shows output formatted as JSON\&. Expects one of
"short"
(for the shortest possible output without any redundant whitespace or line breaks) or
"pretty"
(for a pretty version of the same, with indentation and line breaks)\&. Note that transformation from D\-Bus marshalling to JSON is done in a loss\-less way, which means type information is embedded into the JSON object tree\&.
.sp
Added in version 240\&.
.RE
.PP
\fB\-j\fR
.RS 4
Equivalent to
\fB\-\-json=pretty\fR
when invoked interactively from a terminal\&. Otherwise equivalent to
\fB\-\-json=short\fR, in particular when the output is piped to some other program\&.
.sp
Added in version 240\&.
.RE
.PP
\fB\-\-expect\-reply=\fR\fIBOOL\fR
.RS 4
When used with the
\fBcall\fR
command, specifies whether
\fBbusctl\fR
shall wait for completion of the method call, output the returned method response data, and return success or failure via the process exit code\&. If this is set to
"no", the method call will be issued but no response is expected, the tool terminates immediately, and thus no response can be shown, and no success or failure is returned via the exit code\&. To only suppress output of the reply message payload, use
\fB\-\-quiet\fR
above\&. Defaults to
"yes"\&.
.sp
Added in version 218\&.
.RE
.PP
\fB\-\-auto\-start=\fR\fIBOOL\fR
.RS 4
When used with the
\fBcall\fR
or
\fBemit\fR
command, specifies whether the method call should implicitly activate the called service, should it not be running yet but is configured to be auto\-started\&. Defaults to
"yes"\&.
.sp
Added in version 218\&.
.RE
.PP
\fB\-\-allow\-interactive\-authorization=\fR\fIBOOL\fR
.RS 4
When used with the
\fBcall\fR
command, specifies whether the services may enforce interactive authorization while executing the operation, if the security policy is configured for this\&. Defaults to
"yes"\&.
.sp
Added in version 218\&.
.RE
.PP
\fB\-\-timeout=\fR\fISECS\fR
.RS 4
When used with the
\fBcall\fR
command, specifies the maximum time to wait for method call completion\&. If no time unit is specified, assumes seconds\&. The usual other units are understood, too (ms, us, s, min, h, d, w, month, y)\&. Note that this timeout does not apply if
\fB\-\-expect\-reply=no\fR
is used, as the tool does not wait for any reply message then\&. When not specified or when set to 0, the default of
"25s"
is assumed\&.
.sp
Added in version 218\&.
.RE
.PP
\fB\-\-augment\-creds=\fR\fIBOOL\fR
.RS 4
Controls whether credential data reported by
\fBlist\fR
or
\fBstatus\fR
shall be augmented with data from
/proc/\&. When this is turned on, the data shown is possibly inconsistent, as the data read from
/proc/
might be more recent than the rest of the credential information\&. Defaults to
"yes"\&.
.sp
Added in version 218\&.
.RE
.PP
\fB\-\-watch\-bind=\fR\fIBOOL\fR
.RS 4
Controls whether to wait for the specified
\fBAF_UNIX\fR
bus socket to appear in the file system before connecting to it\&. Defaults to off\&. When enabled, the tool will watch the file system until the socket is created and then connect to it\&.
.sp
Added in version 237\&.
.RE
.PP
\fB\-\-destination=\fR\fISERVICE\fR
.RS 4
Takes a service name\&. When used with the
\fBemit\fR
command, a signal is emitted to the specified service\&.
.sp
Added in version 242\&.
.RE
.PP
\fB\-\-user\fR
.RS 4
Talk to the service manager of the calling user, rather than the service manager of the system\&.
.RE
.PP
\fB\-\-system\fR
.RS 4
Talk to the service manager of the system\&. This is the implied default\&.
.RE
.PP
\fB\-H\fR, \fB\-\-host=\fR
.RS 4
Execute the operation remotely\&. Specify a hostname, or a username and hostname separated by
"@", to connect to\&. The hostname may optionally be suffixed by a port ssh is listening on, separated by
":", and then a container name, separated by
"/", which connects directly to a specific container on the specified host\&. This will use SSH to talk to the remote machine manager instance\&. Container names may be enumerated with
\fBmachinectl \-H \fR\fB\fIHOST\fR\fR\&. Put IPv6 addresses in brackets\&.
.RE
.PP
\fB\-M\fR, \fB\-\-machine=\fR
.RS 4
Execute operation on a local container\&. Specify a container name to connect to, optionally prefixed by a user name to connect as and a separating
"@"
character\&. If the special string
"\&.host"
is used in place of the container name, a connection to the local system is made (which is useful to connect to a specific user\*(Aqs user bus:
"\-\-user \-\-machine=lennart@\&.host")\&. If the
"@"
syntax is not used, the connection is made as root user\&. If the
"@"
syntax is used either the left hand side or the right hand side may be omitted (but not both) in which case the local user name and
"\&.host"
are implied\&.
.RE
.PP
\fB\-l\fR, \fB\-\-full\fR
.RS 4
Do not ellipsize the output in
\fBlist\fR
command\&.
.sp
Added in version 245\&.
.RE
.PP
\fB\-\-no\-pager\fR
.RS 4
Do not pipe output into a pager\&.
.RE
.PP
\fB\-\-no\-legend\fR
.RS 4
Do not print the legend, i\&.e\&. column headers and the footer with hints\&.
.RE
.PP
\fB\-h\fR, \fB\-\-help\fR
.RS 4
Print a short help text and exit\&.
.RE
.PP
\fB\-\-version\fR
.RS 4
Print a short version string and exit\&.
.RE
.SH "PARAMETER FORMATTING"
.PP
The
\fBcall\fR
and
\fBset\-property\fR
commands take a signature string followed by a list of parameters formatted as string (for details on D\-Bus signature strings, see the
\m[blue]\fBType system chapter of the D\-Bus specification\fR\m[]\&\s-2\u[2]\d\s+2)\&. For simple types, each parameter following the signature should simply be the parameter\*(Aqs value formatted as string\&. Positive boolean values may be formatted as
"true",
"yes",
"on", or
"1"; negative boolean values may be specified as
"false",
"no",
"off", or
"0"\&. For arrays, a numeric argument for the number of entries followed by the entries shall be specified\&. For variants, the signature of the contents shall be specified, followed by the contents\&. For dictionaries and structs, the contents of them shall be directly specified\&.
.PP
For example,
.sp
.if n \{\
.RS 4
.\}
.nf
s jawoll
.fi
.if n \{\
.RE
.\}
.sp
is the formatting of a single string
"jawoll"\&.
.PP
.if n \{\
.RS 4
.\}
.nf
as 3 hello world foobar
.fi
.if n \{\
.RE
.\}
.sp
is the formatting of a string array with three entries,
"hello",
"world"
and
"foobar"\&.
.PP
.if n \{\
.RS 4
.\}
.nf
a{sv} 3 One s Eins Two u 2 Yes b true
.fi
.if n \{\
.RE
.\}
.sp
is the formatting of a dictionary array that maps strings to variants, consisting of three entries\&. The string
"One"
is assigned the string
"Eins"\&. The string
"Two"
is assigned the 32\-bit unsigned integer 2\&. The string
"Yes"
is assigned a positive boolean\&.
.PP
Note that the
\fBcall\fR,
\fBget\-property\fR,
\fBintrospect\fR
commands will also generate output in this format for the returned data\&. Since this format is sometimes too terse to be easily understood, the
\fBcall\fR
and
\fBget\-property\fR
commands may generate a more verbose, multi\-line output when passed the
\fB\-\-verbose\fR
option\&.
.SH "EXAMPLES"
.PP
\fBExample\ \&1.\ \&Write and Read a Property\fR
.PP
The following two commands first write a property and then read it back\&. The property is found on the
"/org/freedesktop/systemd1"
object of the
"org\&.freedesktop\&.systemd1"
service\&. The name of the property is
"LogLevel"
on the
"org\&.freedesktop\&.systemd1\&.Manager"
interface\&. The property contains a single string:
.sp
.if n \{\
.RS 4
.\}
.nf
# busctl set\-property org\&.freedesktop\&.systemd1 /org/freedesktop/systemd1 org\&.freedesktop\&.systemd1\&.Manager LogLevel s debug
# busctl get\-property org\&.freedesktop\&.systemd1 /org/freedesktop/systemd1 org\&.freedesktop\&.systemd1\&.Manager LogLevel
s "debug"
.fi
.if n \{\
.RE
.\}
.PP
\fBExample\ \&2.\ \&Terse and Verbose Output\fR
.PP
The following two commands read a property that contains an array of strings, and first show it in terse format, followed by verbose format:
.sp
.if n \{\
.RS 4
.\}
.nf
$ busctl get\-property org\&.freedesktop\&.systemd1 /org/freedesktop/systemd1 org\&.freedesktop\&.systemd1\&.Manager Environment
as 2 "LANG=en_US\&.UTF\-8" "PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin"
$ busctl get\-property \-\-verbose org\&.freedesktop\&.systemd1 /org/freedesktop/systemd1 org\&.freedesktop\&.systemd1\&.Manager Environment
ARRAY "s" {
STRING "LANG=en_US\&.UTF\-8";
STRING "PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin";
};
.fi
.if n \{\
.RE
.\}
.PP
\fBExample\ \&3.\ \&Invoking a Method\fR
.PP
The following command invokes the
"StartUnit"
method on the
"org\&.freedesktop\&.systemd1\&.Manager"
interface of the
"/org/freedesktop/systemd1"
object of the
"org\&.freedesktop\&.systemd1"
service, and passes it two strings
"cups\&.service"
and
"replace"\&. As a result of the method call, a single object path parameter is received and shown:
.sp
.if n \{\
.RS 4
.\}
.nf
# busctl call org\&.freedesktop\&.systemd1 /org/freedesktop/systemd1 org\&.freedesktop\&.systemd1\&.Manager StartUnit ss "cups\&.service" "replace"
o "/org/freedesktop/systemd1/job/42684"
.fi
.if n \{\
.RE
.\}
.SH "SEE ALSO"
.PP
\fBdbus-daemon\fR(1),
\m[blue]\fBD\-Bus\fR\m[]\&\s-2\u[3]\d\s+2,
\fBsd-bus\fR(3),
\fBvarlinkctl\fR(1),
\fBsystemd\fR(1),
\fBmachinectl\fR(1),
\fBwireshark\fR(1)
.SH "NOTES"
.IP " 1." 4
PCAP Next Generation (pcapng) Capture File Format
.RS 4
\%https://github.com/pcapng/pcapng/
.RE
.IP " 2." 4
Type system chapter of the D-Bus specification
.RS 4
\%https://dbus.freedesktop.org/doc/dbus-specification.html#type-system
.RE
.IP " 3." 4
D-Bus
.RS 4
\%https://www.freedesktop.org/wiki/Software/dbus
.RE
|