1BUSCTL(1) busctl BUSCTL(1)
2
3
4
6 busctl - Introspect the bus
7
9 busctl [OPTIONS...] [COMMAND] [NAME...]
10
12 busctl may be used to introspect and monitor the D-Bus bus.
13
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 --json=MODE
61 When used with the call or get-property command, shows output
62 formatted as JSON. Expects one of "short" (for the shortest
63 possible output without any redundant whitespace or line breaks) or
64 "pretty" (for a pretty version of the same, with indentation and
65 line breaks). Note that transformation from D-Bus marshalling to
66 JSON is done in a loss-less way, which means type information is
67 embedded into the JSON object tree.
68
69 -j
70 Equivalent to --json=pretty when invoked interactively from a
71 terminal. Otherwise equivalent to --json=short, in particular when
72 the output is piped to some other program.
73
74 --expect-reply=BOOL
75 When used with the call command, specifies whether busctl shall
76 wait for completion of the method call, output the returned method
77 response data, and return success or failure via the process exit
78 code. If this is set to "no", the method call will be issued but no
79 response is expected, the tool terminates immediately, and thus no
80 response can be shown, and no success or failure is returned via
81 the exit code. To only suppress output of the reply message
82 payload, use --quiet above. Defaults to "yes".
83
84 --auto-start=BOOL
85 When used with the call command, specifies whether the method call
86 should implicitly activate the called service, should it not be
87 running yet but is configured to be auto-started. Defaults to
88 "yes".
89
90 --allow-interactive-authorization=BOOL
91 When used with the call command, specifies whether the services may
92 enforce interactive authorization while executing the operation, if
93 the security policy is configured for this. Defaults to "yes".
94
95 --timeout=SECS
96 When used with the call command, specifies the maximum time to wait
97 for method call completion. If no time unit is specified, assumes
98 seconds. The usual other units are understood, too (ms, us, s, min,
99 h, d, w, month, y). Note that this timeout does not apply if
100 --expect-reply=no is used, as the tool does not wait for any reply
101 message then. When not specified or when set to 0, the default of
102 "25s" is assumed.
103
104 --augment-creds=BOOL
105 Controls whether credential data reported by list or status shall
106 be augmented with data from /proc. When this is turned on, the data
107 shown is possibly inconsistent, as the data read from /proc might
108 be more recent than the rest of the credential information.
109 Defaults to "yes".
110
111 --watch-bind=BOOL
112 Controls whether to wait for the specified AF_UNIX bus socket to
113 appear in the file system before connecting to it. Defaults to off.
114 When enabled, the tool will watch the file system until the socket
115 is created and then connect to it.
116
117 --user
118 Talk to the service manager of the calling user, rather than the
119 service manager of the system.
120
121 --system
122 Talk to the service manager of the system. This is the implied
123 default.
124
125 -H, --host=
126 Execute the operation remotely. Specify a hostname, or a username
127 and hostname separated by "@", to connect to. The hostname may
128 optionally be suffixed by a port ssh is listening on, seperated by
129 ":", and then a container name, separated by "/", which connects
130 directly to a specific container on the specified host. This will
131 use SSH to talk to the remote machine manager instance. Container
132 names may be enumerated with machinectl -H HOST. Put IPv6 addresses
133 in brackets.
134
135 -M, --machine=
136 Execute operation on a local container. Specify a container name to
137 connect to.
138
139 --no-pager
140 Do not pipe output into a pager.
141
142 --no-legend
143 Do not print the legend, i.e. column headers and the footer with
144 hints.
145
146 -h, --help
147 Print a short help text and exit.
148
149 --version
150 Print a short version string and exit.
151
153 The following commands are understood:
154
155 list
156 Show all peers on the bus, by their service names. By default,
157 shows both unique and well-known names, but this may be changed
158 with the --unique and --acquired switches. This is the default
159 operation if no command is specified.
160
161 status [SERVICE]
162 Show process information and credentials of a bus service (if one
163 is specified by its unique or well-known name), a process (if one
164 is specified by its numeric PID), or the owner of the bus (if no
165 parameter is specified).
166
167 monitor [SERVICE...]
168 Dump messages being exchanged. If SERVICE is specified, show
169 messages to or from this peer, identified by its well-known or
170 unique name. Otherwise, show all messages on the bus. Use Ctrl+C to
171 terminate the dump.
172
173 capture [SERVICE...]
174 Similar to monitor but writes the output in pcap format (for
175 details, see the Libpcap File Format[1] description). Make sure to
176 redirect standard output to a file. Tools like wireshark(1) may be
177 used to dissect and view the resulting files.
178
179 tree [SERVICE...]
180 Shows an object tree of one or more services. If SERVICE is
181 specified, show object tree of the specified services only.
182 Otherwise, show all object trees of all services on the bus that
183 acquired at least one well-known name.
184
185 introspect SERVICE OBJECT [INTERFACE]
186 Show interfaces, methods, properties and signals of the specified
187 object (identified by its path) on the specified service. If the
188 interface argument is passed, the output is limited to members of
189 the specified interface.
190
191 call SERVICE OBJECT INTERFACE METHOD [SIGNATURE [ARGUMENT...]]
192 Invoke a method and show the response. Takes a service name, object
193 path, interface name and method name. If parameters shall be passed
194 to the method call, a signature string is required, followed by the
195 arguments, individually formatted as strings. For details on the
196 formatting used, see below. To suppress output of the returned
197 data, use the --quiet option.
198
199 get-property SERVICE OBJECT INTERFACE PROPERTY...
200 Retrieve the current value of one or more object properties. Takes
201 a service name, object path, interface name and property name.
202 Multiple properties may be specified at once, in which case their
203 values will be shown one after the other, separated by newlines.
204 The output is, by default, in terse format. Use --verbose for a
205 more elaborate output format.
206
207 set-property SERVICE OBJECT INTERFACE PROPERTY SIGNATURE ARGUMENT...
208 Set the current value of an object property. Takes a service name,
209 object path, interface name, property name, property signature,
210 followed by a list of parameters formatted as strings.
211
212 help
213 Show command syntax help.
214
216 The call and set-property commands take a signature string followed by
217 a list of parameters formatted as string (for details on D-Bus
218 signature strings, see the Type system chapter of the D-Bus
219 specification[2]). For simple types, each parameter following the
220 signature should simply be the parameter's value formatted as string.
221 Positive boolean values may be formatted as "true", "yes", "on", or
222 "1"; negative boolean values may be specified as "false", "no", "off",
223 or "0". For arrays, a numeric argument for the number of entries
224 followed by the entries shall be specified. For variants, the signature
225 of the contents shall be specified, followed by the contents. For
226 dictionaries and structs, the contents of them shall be directly
227 specified.
228
229 For example,
230
231 s jawoll
232
233 is the formatting of a single string "jawoll".
234
235 as 3 hello world foobar
236
237 is the formatting of a string array with three entries, "hello",
238 "world" and "foobar".
239
240 a{sv} 3 One s Eins Two u 2 Yes b true
241
242 is the formatting of a dictionary array that maps strings to variants,
243 consisting of three entries. The string "One" is assigned the string
244 "Eins". The string "Two" is assigned the 32-bit unsigned integer 2. The
245 string "Yes" is assigned a positive boolean.
246
247 Note that the call, get-property, introspect commands will also
248 generate output in this format for the returned data. Since this format
249 is sometimes too terse to be easily understood, the call and
250 get-property commands may generate a more verbose, multi-line output
251 when passed the --verbose option.
252
254 Example 1. Write and Read a Property
255
256 The following two commands first write a property and then read it
257 back. The property is found on the "/org/freedesktop/systemd1" object
258 of the "org.freedesktop.systemd1" service. The name of the property is
259 "LogLevel" on the "org.freedesktop.systemd1.Manager" interface. The
260 property contains a single string:
261
262 # busctl set-property org.freedesktop.systemd1 /org/freedesktop/systemd1 org.freedesktop.systemd1.Manager LogLevel s debug
263 # busctl get-property org.freedesktop.systemd1 /org/freedesktop/systemd1 org.freedesktop.systemd1.Manager LogLevel
264 s "debug"
265
266 Example 2. Terse and Verbose Output
267
268 The following two commands read a property that contains an array of
269 strings, and first show it in terse format, followed by verbose format:
270
271 $ busctl get-property org.freedesktop.systemd1 /org/freedesktop/systemd1 org.freedesktop.systemd1.Manager Environment
272 as 2 "LANG=en_US.UTF-8" "PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin"
273 $ busctl get-property --verbose org.freedesktop.systemd1 /org/freedesktop/systemd1 org.freedesktop.systemd1.Manager Environment
274 ARRAY "s" {
275 STRING "LANG=en_US.UTF-8";
276 STRING "PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin";
277 };
278
279 Example 3. Invoking a Method
280
281 The following command invokes the "StartUnit" method on the
282 "org.freedesktop.systemd1.Manager" interface of the
283 "/org/freedesktop/systemd1" object of the "org.freedesktop.systemd1"
284 service, and passes it two strings "cups.service" and "replace". As a
285 result of the method call, a single object path parameter is received
286 and shown:
287
288 # busctl call org.freedesktop.systemd1 /org/freedesktop/systemd1 org.freedesktop.systemd1.Manager StartUnit ss "cups.service" "replace"
289 o "/org/freedesktop/systemd1/job/42684"
290
292 dbus-daemon(1), D-Bus[3], sd-bus(3), systemd(1), machinectl(1),
293 wireshark(1)
294
296 1. Libpcap File Format
297 https://wiki.wireshark.org/Development/LibpcapFileFormat
298
299 2. Type system chapter of the D-Bus specification
300 http://dbus.freedesktop.org/doc/dbus-specification.html#type-system
301
302 3. D-Bus
303 https://www.freedesktop.org/wiki/Software/dbus
304
305
306
307systemd 241 BUSCTL(1)