1BUSCTL(1)                           busctl                           BUSCTL(1)
2
3
4

NAME

6       busctl - Introspect the bus
7

SYNOPSIS

9       busctl [OPTIONS...] [COMMAND] [NAME...]
10

DESCRIPTION

12       busctl may be used to introspect and monitor the D-Bus bus.
13

OPTIONS

15       The following options are understood:
16
17       --address=ADDRESS
18           Connect to the bus specified by ADDRESS instead of using suitable
19           defaults for either the system or user bus (see --system and --user
20           options).
21
22       --show-machine
23           When showing the list of peers, show a column containing the names
24           of containers they belong to. See systemd-machined.service(8).
25
26       --unique
27           When showing the list of peers, show only "unique" names (of the
28           form ":number.number").
29
30       --acquired
31           The opposite of --unique — only "well-known" names will be shown.
32
33       --activatable
34           When showing the list of peers, show only peers which have actually
35           not been activated yet, but may be started automatically if
36           accessed.
37
38       --match=MATCH
39           When showing messages being exchanged, show only the subset
40           matching MATCH. See sd_bus_add_match(3).
41
42       --size=
43           When used with the capture command, specifies the maximum bus
44           message size to capture ("snaplen"). Defaults to 4096 bytes.
45
46       --list
47           When used with the tree command, shows a flat list of object paths
48           instead of a tree.
49
50       -q, --quiet
51           When used with the call command, suppresses display of the response
52           message payload. Note that even if this option is specified, errors
53           returned will still be printed and the tool will indicate success
54           or failure with the process exit code.
55
56       --verbose
57           When used with the call or get-property command, shows output in a
58           more verbose format.
59
60       --xml-interface
61           When used with the introspect call, dump the XML description
62           received from the D-Bus
63           org.freedesktop.DBus.Introspectable.Introspect call instead of the
64           normal output.
65
66       --json=MODE
67           When used with the call or get-property command, shows output
68           formatted as JSON. Expects one of "short" (for the shortest
69           possible output without any redundant whitespace or line breaks) or
70           "pretty" (for a pretty version of the same, with indentation and
71           line breaks). Note that transformation from D-Bus marshalling to
72           JSON is done in a loss-less way, which means type information is
73           embedded into the JSON object tree.
74
75       -j
76           Equivalent to --json=pretty when invoked interactively from a
77           terminal. Otherwise equivalent to --json=short, in particular when
78           the output is piped to some other program.
79
80       --expect-reply=BOOL
81           When used with the call command, specifies whether busctl shall
82           wait for completion of the method call, output the returned method
83           response data, and return success or failure via the process exit
84           code. If this is set to "no", the method call will be issued but no
85           response is expected, the tool terminates immediately, and thus no
86           response can be shown, and no success or failure is returned via
87           the exit code. To only suppress output of the reply message
88           payload, use --quiet above. Defaults to "yes".
89
90       --auto-start=BOOL
91           When used with the call or emit command, specifies whether the
92           method call should implicitly activate the called service, should
93           it not be running yet but is configured to be auto-started.
94           Defaults to "yes".
95
96       --allow-interactive-authorization=BOOL
97           When used with the call command, specifies whether the services may
98           enforce interactive authorization while executing the operation, if
99           the security policy is configured for this. Defaults to "yes".
100
101       --timeout=SECS
102           When used with the call command, specifies the maximum time to wait
103           for method call completion. If no time unit is specified, assumes
104           seconds. The usual other units are understood, too (ms, us, s, min,
105           h, d, w, month, y). Note that this timeout does not apply if
106           --expect-reply=no is used, as the tool does not wait for any reply
107           message then. When not specified or when set to 0, the default of
108           "25s" is assumed.
109
110       --augment-creds=BOOL
111           Controls whether credential data reported by list or status shall
112           be augmented with data from /proc. When this is turned on, the data
113           shown is possibly inconsistent, as the data read from /proc might
114           be more recent than the rest of the credential information.
115           Defaults to "yes".
116
117       --watch-bind=BOOL
118           Controls whether to wait for the specified AF_UNIX bus socket to
119           appear in the file system before connecting to it. Defaults to off.
120           When enabled, the tool will watch the file system until the socket
121           is created and then connect to it.
122
123       --destination=SERVICE
124           Takes a service name. When used with the emit command, a signal is
125           emitted to the specified service.
126
127       --user
128           Talk to the service manager of the calling user, rather than the
129           service manager of the system.
130
131       --system
132           Talk to the service manager of the system. This is the implied
133           default.
134
135       -H, --host=
136           Execute the operation remotely. Specify a hostname, or a username
137           and hostname separated by "@", to connect to. The hostname may
138           optionally be suffixed by a port ssh is listening on, separated by
139           ":", and then a container name, separated by "/", which connects
140           directly to a specific container on the specified host. This will
141           use SSH to talk to the remote machine manager instance. Container
142           names may be enumerated with machinectl -H HOST. Put IPv6 addresses
143           in brackets.
144
145       -M, --machine=
146           Execute operation on a local container. Specify a container name to
147           connect to.
148
149       --no-pager
150           Do not pipe output into a pager.
151
152       --no-legend
153           Do not print the legend, i.e. column headers and the footer with
154           hints.
155
156       -h, --help
157           Print a short help text and exit.
158
159       --version
160           Print a short version string and exit.
161

COMMANDS

163       The following commands are understood:
164
165       list
166           Show all peers on the bus, by their service names. By default,
167           shows both unique and well-known names, but this may be changed
168           with the --unique and --acquired switches. This is the default
169           operation if no command is specified.
170
171       status [SERVICE]
172           Show process information and credentials of a bus service (if one
173           is specified by its unique or well-known name), a process (if one
174           is specified by its numeric PID), or the owner of the bus (if no
175           parameter is specified).
176
177       monitor [SERVICE...]
178           Dump messages being exchanged. If SERVICE is specified, show
179           messages to or from this peer, identified by its well-known or
180           unique name. Otherwise, show all messages on the bus. Use Ctrl+C to
181           terminate the dump.
182
183       capture [SERVICE...]
184           Similar to monitor but writes the output in pcap format (for
185           details, see the Libpcap File Format[1] description). Make sure to
186           redirect standard output to a file. Tools like wireshark(1) may be
187           used to dissect and view the resulting files.
188
189       tree [SERVICE...]
190           Shows an object tree of one or more services. If SERVICE is
191           specified, show object tree of the specified services only.
192           Otherwise, show all object trees of all services on the bus that
193           acquired at least one well-known name.
194
195       introspect SERVICE OBJECT [INTERFACE]
196           Show interfaces, methods, properties and signals of the specified
197           object (identified by its path) on the specified service. If the
198           interface argument is passed, the output is limited to members of
199           the specified interface.
200
201       call SERVICE OBJECT INTERFACE METHOD [SIGNATURE [ARGUMENT...]]
202           Invoke a method and show the response. Takes a service name, object
203           path, interface name and method name. If parameters shall be passed
204           to the method call, a signature string is required, followed by the
205           arguments, individually formatted as strings. For details on the
206           formatting used, see below. To suppress output of the returned
207           data, use the --quiet option.
208
209       emit OBJECT INTERFACE SIGNAL [SIGNATURE [ARGUMENT...]]
210           Emit a signal. Takes a object path, interface name and method name.
211           If parameters shall be passed, a signature string is required,
212           followed by the arguments, individually formatted as strings. For
213           details on the formatting used, see below. To specify the
214           destination of the signal, use the --destination= option.
215
216       get-property SERVICE OBJECT INTERFACE PROPERTY...
217           Retrieve the current value of one or more object properties. Takes
218           a service name, object path, interface name and property name.
219           Multiple properties may be specified at once, in which case their
220           values will be shown one after the other, separated by newlines.
221           The output is, by default, in terse format. Use --verbose for a
222           more elaborate output format.
223
224       set-property SERVICE OBJECT INTERFACE PROPERTY SIGNATURE ARGUMENT...
225           Set the current value of an object property. Takes a service name,
226           object path, interface name, property name, property signature,
227           followed by a list of parameters formatted as strings.
228
229       help
230           Show command syntax help.
231

PARAMETER FORMATTING

233       The call and set-property commands take a signature string followed by
234       a list of parameters formatted as string (for details on D-Bus
235       signature strings, see the Type system chapter of the D-Bus
236       specification[2]). For simple types, each parameter following the
237       signature should simply be the parameter's value formatted as string.
238       Positive boolean values may be formatted as "true", "yes", "on", or
239       "1"; negative boolean values may be specified as "false", "no", "off",
240       or "0". For arrays, a numeric argument for the number of entries
241       followed by the entries shall be specified. For variants, the signature
242       of the contents shall be specified, followed by the contents. For
243       dictionaries and structs, the contents of them shall be directly
244       specified.
245
246       For example,
247
248           s jawoll
249
250       is the formatting of a single string "jawoll".
251
252           as 3 hello world foobar
253
254       is the formatting of a string array with three entries, "hello",
255       "world" and "foobar".
256
257           a{sv} 3 One s Eins Two u 2 Yes b true
258
259       is the formatting of a dictionary array that maps strings to variants,
260       consisting of three entries. The string "One" is assigned the string
261       "Eins". The string "Two" is assigned the 32-bit unsigned integer 2. The
262       string "Yes" is assigned a positive boolean.
263
264       Note that the call, get-property, introspect commands will also
265       generate output in this format for the returned data. Since this format
266       is sometimes too terse to be easily understood, the call and
267       get-property commands may generate a more verbose, multi-line output
268       when passed the --verbose option.
269

EXAMPLES

271       Example 1. Write and Read a Property
272
273       The following two commands first write a property and then read it
274       back. The property is found on the "/org/freedesktop/systemd1" object
275       of the "org.freedesktop.systemd1" service. The name of the property is
276       "LogLevel" on the "org.freedesktop.systemd1.Manager" interface. The
277       property contains a single string:
278
279           # busctl set-property org.freedesktop.systemd1 /org/freedesktop/systemd1 org.freedesktop.systemd1.Manager LogLevel s debug
280           # busctl get-property org.freedesktop.systemd1 /org/freedesktop/systemd1 org.freedesktop.systemd1.Manager LogLevel
281           s "debug"
282
283       Example 2. Terse and Verbose Output
284
285       The following two commands read a property that contains an array of
286       strings, and first show it in terse format, followed by verbose format:
287
288           $ busctl get-property org.freedesktop.systemd1 /org/freedesktop/systemd1 org.freedesktop.systemd1.Manager Environment
289           as 2 "LANG=en_US.UTF-8" "PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin"
290           $ busctl get-property --verbose org.freedesktop.systemd1 /org/freedesktop/systemd1 org.freedesktop.systemd1.Manager Environment
291           ARRAY "s" {
292                   STRING "LANG=en_US.UTF-8";
293                   STRING "PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin";
294           };
295
296       Example 3. Invoking a Method
297
298       The following command invokes the "StartUnit" method on the
299       "org.freedesktop.systemd1.Manager" interface of the
300       "/org/freedesktop/systemd1" object of the "org.freedesktop.systemd1"
301       service, and passes it two strings "cups.service" and "replace". As a
302       result of the method call, a single object path parameter is received
303       and shown:
304
305           # busctl call org.freedesktop.systemd1 /org/freedesktop/systemd1 org.freedesktop.systemd1.Manager StartUnit ss "cups.service" "replace"
306           o "/org/freedesktop/systemd1/job/42684"
307

SEE ALSO

309       dbus-daemon(1), D-Bus[3], sd-bus(3), systemd(1), machinectl(1),
310       wireshark(1)
311

NOTES

313        1. Libpcap File Format
314           https://wiki.wireshark.org/Development/LibpcapFileFormat
315
316        2. Type system chapter of the D-Bus specification
317           http://dbus.freedesktop.org/doc/dbus-specification.html#type-system
318
319        3. D-Bus
320           https://www.freedesktop.org/wiki/Software/dbus
321
322
323
324systemd 243                                                          BUSCTL(1)
Impressum