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

COMMANDS

15       The following commands are understood:
16
17       list
18           Show all peers on the bus, by their service names. By default,
19           shows both unique and well-known names, but this may be changed
20           with the --unique and --acquired switches. This is the default
21           operation if no command is specified.
22
23       status [SERVICE]
24           Show process information and credentials of a bus service (if one
25           is specified by its unique or well-known name), a process (if one
26           is specified by its numeric PID), or the owner of the bus (if no
27           parameter is specified).
28
29       monitor [SERVICE...]
30           Dump messages being exchanged. If SERVICE is specified, show
31           messages to or from this peer, identified by its well-known or
32           unique name. Otherwise, show all messages on the bus. Use Ctrl+C to
33           terminate the dump.
34
35       capture [SERVICE...]
36           Similar to monitor but writes the output in pcap format (for
37           details, see the Libpcap File Format[1] description). Make sure to
38           redirect standard output to a file. Tools like wireshark(1) may be
39           used to dissect and view the resulting files.
40
41       tree [SERVICE...]
42           Shows an object tree of one or more services. If SERVICE is
43           specified, show object tree of the specified services only.
44           Otherwise, show all object trees of all services on the bus that
45           acquired at least one well-known name.
46
47       introspect SERVICE OBJECT [INTERFACE]
48           Show interfaces, methods, properties and signals of the specified
49           object (identified by its path) on the specified service. If the
50           interface argument is passed, the output is limited to members of
51           the specified interface.
52
53       call SERVICE OBJECT INTERFACE METHOD [SIGNATURE [ARGUMENT...]]
54           Invoke a method and show the response. Takes a service name, object
55           path, interface name and method name. If parameters shall be passed
56           to the method call, a signature string is required, followed by the
57           arguments, individually formatted as strings. For details on the
58           formatting used, see below. To suppress output of the returned
59           data, use the --quiet option.
60
61       emit OBJECT INTERFACE SIGNAL [SIGNATURE [ARGUMENT...]]
62           Emit a signal. Takes a object path, interface name and method name.
63           If parameters shall be passed, a signature string is required,
64           followed by the arguments, individually formatted as strings. For
65           details on the formatting used, see below. To specify the
66           destination of the signal, use the --destination= option.
67
68       get-property SERVICE OBJECT INTERFACE PROPERTY...
69           Retrieve the current value of one or more object properties. Takes
70           a service name, object path, interface name and property name.
71           Multiple properties may be specified at once, in which case their
72           values will be shown one after the other, separated by newlines.
73           The output is, by default, in terse format. Use --verbose for a
74           more elaborate output format.
75
76       set-property SERVICE OBJECT INTERFACE PROPERTY SIGNATURE ARGUMENT...
77           Set the current value of an object property. Takes a service name,
78           object path, interface name, property name, property signature,
79           followed by a list of parameters formatted as strings.
80
81       help
82           Show command syntax help.
83

OPTIONS

85       The following options are understood:
86
87       --address=ADDRESS
88           Connect to the bus specified by ADDRESS instead of using suitable
89           defaults for either the system or user bus (see --system and --user
90           options).
91
92       --show-machine
93           When showing the list of peers, show a column containing the names
94           of containers they belong to. See systemd-machined.service(8).
95
96       --unique
97           When showing the list of peers, show only "unique" names (of the
98           form ":number.number").
99
100       --acquired
101           The opposite of --unique — only "well-known" names will be shown.
102
103       --activatable
104           When showing the list of peers, show only peers which have actually
105           not been activated yet, but may be started automatically if
106           accessed.
107
108       --match=MATCH
109           When showing messages being exchanged, show only the subset
110           matching MATCH. See sd_bus_add_match(3).
111
112       --size=
113           When used with the capture command, specifies the maximum bus
114           message size to capture ("snaplen"). Defaults to 4096 bytes.
115
116       --list
117           When used with the tree command, shows a flat list of object paths
118           instead of a tree.
119
120       -q, --quiet
121           When used with the call command, suppresses display of the response
122           message payload. Note that even if this option is specified, errors
123           returned will still be printed and the tool will indicate success
124           or failure with the process exit code.
125
126       --verbose
127           When used with the call or get-property command, shows output in a
128           more verbose format.
129
130       --xml-interface
131           When used with the introspect call, dump the XML description
132           received from the D-Bus
133           org.freedesktop.DBus.Introspectable.Introspect call instead of the
134           normal output.
135
136       --json=MODE
137           When used with the call or get-property command, shows output
138           formatted as JSON. Expects one of "short" (for the shortest
139           possible output without any redundant whitespace or line breaks) or
140           "pretty" (for a pretty version of the same, with indentation and
141           line breaks). Note that transformation from D-Bus marshalling to
142           JSON is done in a loss-less way, which means type information is
143           embedded into the JSON object tree.
144
145       -j
146           Equivalent to --json=pretty when invoked interactively from a
147           terminal. Otherwise equivalent to --json=short, in particular when
148           the output is piped to some other program.
149
150       --expect-reply=BOOL
151           When used with the call command, specifies whether busctl shall
152           wait for completion of the method call, output the returned method
153           response data, and return success or failure via the process exit
154           code. If this is set to "no", the method call will be issued but no
155           response is expected, the tool terminates immediately, and thus no
156           response can be shown, and no success or failure is returned via
157           the exit code. To only suppress output of the reply message
158           payload, use --quiet above. Defaults to "yes".
159
160       --auto-start=BOOL
161           When used with the call or emit command, specifies whether the
162           method call should implicitly activate the called service, should
163           it not be running yet but is configured to be auto-started.
164           Defaults to "yes".
165
166       --allow-interactive-authorization=BOOL
167           When used with the call command, specifies whether the services may
168           enforce interactive authorization while executing the operation, if
169           the security policy is configured for this. Defaults to "yes".
170
171       --timeout=SECS
172           When used with the call command, specifies the maximum time to wait
173           for method call completion. If no time unit is specified, assumes
174           seconds. The usual other units are understood, too (ms, us, s, min,
175           h, d, w, month, y). Note that this timeout does not apply if
176           --expect-reply=no is used, as the tool does not wait for any reply
177           message then. When not specified or when set to 0, the default of
178           "25s" is assumed.
179
180       --augment-creds=BOOL
181           Controls whether credential data reported by list or status shall
182           be augmented with data from /proc. When this is turned on, the data
183           shown is possibly inconsistent, as the data read from /proc might
184           be more recent than the rest of the credential information.
185           Defaults to "yes".
186
187       --watch-bind=BOOL
188           Controls whether to wait for the specified AF_UNIX bus socket to
189           appear in the file system before connecting to it. Defaults to off.
190           When enabled, the tool will watch the file system until the socket
191           is created and then connect to it.
192
193       --destination=SERVICE
194           Takes a service name. When used with the emit command, a signal is
195           emitted to the specified service.
196
197       --user
198           Talk to the service manager of the calling user, rather than the
199           service manager of the system.
200
201       --system
202           Talk to the service manager of the system. This is the implied
203           default.
204
205       -H, --host=
206           Execute the operation remotely. Specify a hostname, or a username
207           and hostname separated by "@", to connect to. The hostname may
208           optionally be suffixed by a port ssh is listening on, separated by
209           ":", and then a container name, separated by "/", which connects
210           directly to a specific container on the specified host. This will
211           use SSH to talk to the remote machine manager instance. Container
212           names may be enumerated with machinectl -H HOST. Put IPv6 addresses
213           in brackets.
214
215       -M, --machine=
216           Execute operation on a local container. Specify a container name to
217           connect to.
218
219       -l, --full
220           Do not ellipsize the output in list command.
221
222       --no-pager
223           Do not pipe output into a pager.
224
225       --no-legend
226           Do not print the legend, i.e. column headers and the footer with
227           hints.
228
229       -h, --help
230           Print a short help text and exit.
231
232       --version
233           Print a short version string and exit.
234

PARAMETER FORMATTING

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

EXAMPLES

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

SEE ALSO

312       dbus-daemon(1), D-Bus[3], sd-bus(3), systemd(1), machinectl(1),
313       wireshark(1)
314

NOTES

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