source: general/sysutils/dbus.xml@ 4aed078

elogind
Last change on this file since 4aed078 was 4aed078, checked in by DJ Lucas <dj@…>, 5 years ago

Merge to HEAD 21283.
Add systemd compatibility symlinks.

git-svn-id: svn://svn.linuxfromscratch.org/BLFS/branches/BOOK-elogind@21284 af4574ff-66df-0310-9fd7-8a98e5e911e0

  • Property mode set to 100644
File size: 24.0 KB
Line 
1<?xml version="1.0" encoding="ISO-8859-1"?>
2<!DOCTYPE sect1 PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
3 "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
4 <!ENTITY % general-entities SYSTEM "../../general.ent">
5 %general-entities;
6
7 <!ENTITY dbus-download-http "https://dbus.freedesktop.org/releases/dbus/dbus-&dbus-version;.tar.gz">
8 <!ENTITY dbus-download-ftp " ">
9 <!ENTITY dbus-md5sum "ea11069521beeee4e47f0086596a43c8">
10 <!ENTITY dbus-size "2.0 MB">
11 <!ENTITY dbus-buildsize "21 MB (add 8 MB for the tests)">
12 <!ENTITY dbus-time "0.3 SBU (add 0.8 SBU for the tests)">
13]>
14
15<sect1 id="dbus" xreflabel="dbus-&dbus-version;">
16 <?dbhtml filename="dbus.html"?>
17
18 <sect1info>
19 <othername>$LastChangedBy$</othername>
20 <date>$Date$</date>
21 </sect1info>
22
23 <title>dbus-&dbus-version;</title>
24
25 <indexterm zone="dbus">
26 <primary sortas="a-D-Bus">D-Bus</primary>
27 </indexterm>
28
29 <sect2 role="package">
30 <title>Introduction to D-Bus</title>
31
32 <para revision="sysv">
33 <application>D-Bus</application> is a message bus system, a simple way
34 for applications to talk to one another.
35 <application>D-Bus</application> supplies both a system daemon (for
36 events such as <quote>new hardware device added</quote> or <quote>printer
37 queue changed</quote>) and a per-user-login-session daemon (for general
38 IPC needs among user applications). Also, the message bus is built on top
39 of a general one-to-one message passing framework, which can be used by
40 any two applications to communicate directly (without going through the
41 message bus daemon).
42 </para>
43
44 <para revision="systemd">
45 Even though <application>D-Bus</application> was built in LFS, there are
46 some features provided by the package that other BLFS packages need, but
47 their dependencies didn't fit into LFS.
48 </para>
49
50 &lfs84_checked;
51
52 <bridgehead renderas="sect3">Package Information</bridgehead>
53 <itemizedlist spacing="compact">
54 <listitem>
55 <para>
56 Download (HTTP): <ulink url="&dbus-download-http;"/>
57 </para>
58 </listitem>
59 <listitem>
60 <para>
61 Download (FTP): <ulink url="&dbus-download-ftp;"/>
62 </para>
63 </listitem>
64 <listitem>
65 <para>
66 Download MD5 sum: &dbus-md5sum;
67 </para>
68 </listitem>
69 <listitem>
70 <para>
71 Download size: &dbus-size;
72 </para>
73 </listitem>
74 <listitem>
75 <para>
76 Estimated disk space required: &dbus-buildsize;
77 </para>
78 </listitem>
79 <listitem>
80 <para>
81 Estimated build time: &dbus-time;
82 </para>
83 </listitem>
84 </itemizedlist>
85
86 <bridgehead renderas="sect3">D-Bus Dependencies</bridgehead>
87
88 <bridgehead renderas="sect4" revision="systemd">Required</bridgehead>
89 <para role="required" revision="systemd">
90 <xref linkend="systemd"/>
91 </para>
92
93
94 <bridgehead renderas="sect4">Recommended</bridgehead>
95 <para role="recommended">
96 <xref linkend="xorg7-lib"/> (for <command>dbus-launch</command> program)
97 <phrase revision="sysv"><xref linkend="elogind"/> (first build
98 without, and then again after elogind is installed)</phrase>
99 </para>
100
101 <bridgehead renderas="sect4">Optional</bridgehead>
102 <para role="optional">
103 For the tests:
104 <xref linkend="dbus-glib"/>,
105 <xref linkend="dbus-python"/>,
106 <xref linkend="pygobject3"/>,
107 and <xref linkend="valgrind"/>;
108
109 for documentation:
110 <xref linkend="doxygen"/>,
111 <xref linkend="xmlto"/>,
112 <ulink url="https://pypi.python.org/pypi/mallard-ducktype">Ducktype</ulink>,
113 and
114 <ulink url="http://ftp.gnome.org/pub/gnome/sources/yelp-tools/">Yelp Tools</ulink>
115 </para>
116
117 <para condition="html" role="usernotes">User Notes:
118 <ulink url="&blfs-wiki;/dbus"/>
119 </para>
120 </sect2>
121
122 <sect2 role="installation">
123 <title>Installation of D-Bus</title>
124
125 <para revision="sysv">
126 If they do not already exist,
127 as the <systemitem class="username">root</systemitem> user, create a
128 system user and group to handle the system message bus activity:
129 </para>
130
131<screen role="root" revision="sysv"><userinput>groupadd -g 18 messagebus &amp;&amp;
132useradd -c "D-Bus Message Daemon User" -d /var/run/dbus \
133 -u 18 -g messagebus -s /bin/false messagebus</userinput></screen>
134
135 <para revision="sysv">
136 Apply a patch to fix detection of <application>elogind</application>:
137 </para>
138
139 <para>
140 Install <application>D-Bus</application> by running the following
141 commands (you may wish to review the output from <command>./configure
142 --help</command> first and add any desired parameters to the
143 <command>configure</command> command shown below):
144 </para>
145
146<screen><userinput>./configure --prefix=/usr \
147 --sysconfdir=/etc \
148 --localstatedir=/var \
149 --enable-user-session \
150 --disable-doxygen-docs \
151 --disable-xml-docs \
152 --disable-static \
153 --docdir=/usr/share/doc/dbus-&dbus-version; \
154 --with-console-auth-dir=/run/console \
155 --with-system-pid-file=/run/dbus/pid \
156 --with-system-socket=/run/dbus/system_bus_socket &amp;&amp;
157make</userinput></screen>
158
159 <para>
160 See below for test instructions.
161 </para>
162
163 <warning revision="systemd">
164 <para>
165 Installing the package will override all files installed by
166 <application>D-Bus</application> in LFS. It is critical that
167 nothing uses <application>D-Bus</application> libraries or
168 programs during the installation. The best way to ensure that these
169 libraries are not being used is to run the installation in rescue mode.
170 To switch to rescue mode, run the following command as the
171 <systemitem class="username">root</systemitem> user (from a TTY):
172 </para>
173
174<screen role="root"><userinput>systemctl start rescue.target</userinput></screen>
175
176 </warning>
177
178 <para>
179 Now, as the <systemitem class="username">root</systemitem> user:
180 </para>
181
182<screen role="root"><userinput>make install</userinput></screen>
183
184 <para>
185 The shared library needs to be moved to
186 <filename class="directory">/lib</filename>, and as a result the
187 <filename class="extension">.so</filename> file in
188 <filename class="directory">/usr/lib</filename> will need to be
189 recreated. Run the following command as the
190 <systemitem class="username">root</systemitem> user:
191 </para>
192
193<screen role="root"><userinput>mv -v /usr/lib/libdbus-1.so.* /lib &amp;&amp;
194ln -sfv ../../lib/$(readlink /usr/lib/libdbus-1.so) /usr/lib/libdbus-1.so</userinput></screen>
195
196 <para>
197 If you are using a DESTDIR install,
198 <command>dbus-daemon-launch-helper</command> needs to be fixed
199 afterwards. Issue, as <systemitem class="username">root</systemitem>
200 user:
201 </para>
202
203<screen role="root"><userinput>chown -v root:messagebus /usr/libexec/dbus-daemon-launch-helper &amp;&amp;
204chmod -v 4750 /usr/libexec/dbus-daemon-launch-helper</userinput></screen>
205
206 <para revision="sysv">
207 If you are still building your system in chroot or you did not start the
208 daemon yet, but you want to compile some packages that require
209 <application>D-Bus</application>, generate
210 <application>D-Bus</application> UUID to avoid warnings when compiling
211 some packages with the following command as the
212 <systemitem class="username">root</systemitem> user:
213 </para>
214
215<screen role="root" revision="sysv"><userinput>dbus-uuidgen --ensure</userinput></screen>
216
217 <para revision="sysv">
218 If using <xref linkend="elogind"/>, create a symlink to the
219 <filename>/var/lib/dbus/machine-id</filename> file:
220 </para>
221
222<screen role="root" revision="sysv"><userinput>ln -sv /var/lib/dbus/machine-id /etc</userinput></screen>
223
224 <para revision="systemd">
225 If not in chroot, at this point, you should reload the systemd daemon,
226 and reenter multi-user mode with the following commands (as the
227 <systemitem class="username">root</systemitem> user):
228 </para>
229
230<screen role="root" revision="systemd"><userinput>systemctl daemon-reload
231systemctl start multi-user.target</userinput></screen>
232
233 <para>
234 The dbus tests cannot be run until after <xref linkend="dbus-glib"/> has
235 been installed. They must be run as an unprivileged user from a local
236 session with bus address. To run the standard tests issue
237 <command>make check</command>.
238 </para>
239
240 <para>
241 If you want to run the unit regression tests, configure requires
242 additional parameters which expose additional functionality in the
243 binaries that are not intended to be used in a production build of
244 <application>D-Bus</application>. If you would like to run the tests,
245 issue the following commands (for the tests, you don't need to build the
246 docs):
247 </para>
248
249<screen><userinput>make distclean &amp;&amp;
250./configure --enable-tests \
251 --enable-asserts \
252 --disable-doxygen-docs \
253 --disable-xml-docs &amp;&amp;
254make &amp;&amp;
255make check</userinput></screen>
256
257 <para>
258 The test <command>test-bus.sh</command> is known to fail. There has also
259 been reports that the tests may fail if running inside a Midnight
260 Commander shell. You may get out-of-memory error messages when running
261 the tests. These are normal and can be safely ignored.
262 </para>
263
264 </sect2>
265
266 <sect2 role="commands">
267 <title>Command Explanations</title>
268
269 <para>
270 <parameter>--disable-doxygen-docs</parameter>: This switch disables
271 doxygen documentation build and install, if you have
272 <application>doxygen</application> installed. If
273 <application>doxygen</application> is installed, and you wish to build
274 them, remove this parameter.
275 </para>
276
277 <para>
278 <parameter>--disable-xml-docs</parameter>: This switch disables html
279 documentation build and install, if you have
280 <application>xmlto</application> installed. If
281 <application>xmlto</application> is installed, and you wish to build
282 them, remove this parameter.
283 </para>
284
285 <xi:include xmlns:xi="http://www.w3.org/2001/XInclude"
286 href="../../xincludes/static-libraries.xml"/>
287
288 <para>
289 <parameter>--enable-user-session</parameter>: This parameter enables
290 per-user DBus sessions with
291 <phrase revision="sysv"><application>elogind</application>.</phrase>
292 <phrase revision="systemd"><application>systemd</application>.</phrase>
293 </para>
294
295 <para>
296 <parameter>--with-console-auth-dir=/run/console/</parameter>: This
297 parameter specifies the location of the
298 <application>ConsoleKit</application> auth dir.
299 </para>
300
301 <para>
302 <parameter>--with-system-pid-file=/run/dbus/pid</parameter>: This
303 parameter specifies the location of the PID file.
304 </para>
305
306 <para>
307 <parameter>--with-system-socket=/run/dbus/system_bus_socket</parameter>:
308 This parameter specifies the location of the system bus socket.
309 </para>
310
311 <para>
312 <parameter>--enable-tests</parameter>: Build extra parts of the code to
313 support all tests. Do not use on a production build.
314 </para>
315
316 <para>
317 <option>--enable-embedded-tests</option>: Build extra parts of the
318 code to support only unit tests. Do not use on a production build.
319 </para>
320
321 <para>
322 <parameter>--enable-asserts</parameter>: Enable debugging code to run
323 assertions for statements normally assumed to be true. This prevents a
324 warning that '<parameter>--enable-tests</parameter>' on its own is only
325 useful for profiling and might not give true results for all tests, but
326 adds its own NOTE that this should not be used in a production build.
327 </para>
328
329 </sect2>
330
331 <sect2 role="configuration">
332 <title>Configuring D-Bus</title>
333
334 <sect3 id="dbus-config">
335 <title>Config Files</title>
336
337 <para>
338 <filename>/etc/dbus-1/session.conf</filename>,
339 <filename>/etc/dbus-1/system.conf</filename> and
340 <filename>/etc/dbus-1/system.d/*</filename>
341 </para>
342
343 <indexterm zone="dbus dbus-config">
344 <primary sortas="e-etc-dbus-1-session.conf">/etc/dbus-1/session.conf</primary>
345 </indexterm>
346
347 <indexterm zone="dbus dbus-config">
348 <primary sortas="e-etc-dbus-1/system.conf">/etc/dbus-1/system.conf</primary>
349 </indexterm>
350
351 <indexterm zone="dbus dbus-config">
352 <primary sortas="e-etc-dbus-1-system.d-star">/etc/dbus-1/system.d/*</primary>
353 </indexterm>
354
355 </sect3>
356
357 <sect3 id="dbus-session-config" xreflabel="D-Bus custom services directory">
358 <title>Configuration Information</title>
359
360 <para>
361 The configuration files listed above should probably not be
362 modified. If changes are required, you should create
363 <filename>/etc/dbus-1/session-local.conf</filename> and/or
364 <filename>/etc/dbus-1/system-local.conf</filename> and make any
365 desired changes to these files.
366 </para>
367
368 <para>
369 If any packages install a
370 <application>D-Bus</application> <filename>.service</filename>
371 file outside of the standard <filename
372 class="directory">/usr/share/dbus-1/services</filename> directory,
373 that directory should be added to the local session configuration.
374 For instance, <filename
375 class="directory">/usr/local/share/dbus-1/services</filename> can
376 be added by performing the following commands as the
377 <systemitem class="username">root</systemitem> user:
378 </para>
379
380<screen role="root"><userinput>cat &gt; /etc/dbus-1/session-local.conf &lt;&lt; "EOF"
381<literal>&lt;!DOCTYPE busconfig PUBLIC
382 "-//freedesktop//DTD D-BUS Bus Configuration 1.0//EN"
383 "http://www.freedesktop.org/standards/dbus/1.0/busconfig.dtd"&gt;
384&lt;busconfig&gt;
385
386 &lt;!-- Search for .service files in /usr/local --&gt;
387 &lt;servicedir&gt;/usr/local/share/dbus-1/services&lt;/servicedir&gt;
388
389&lt;/busconfig&gt;</literal>
390EOF</userinput></screen>
391
392 </sect3>
393
394 <sect3 id="dbus-session">
395 <title>D-Bus Session Daemon</title>
396
397 <para revision="sysv">
398 To automatically start <command>dbus-daemon</command> when the
399 system is rebooted, install the
400 <filename>/etc/rc.d/init.d/dbus</filename> bootscript from the
401 <xref linkend="bootscripts"/> package.
402 </para>
403
404 <indexterm zone="dbus dbus-session" revision="sysv">
405 <primary sortas="f-dbus">dbus</primary>
406 </indexterm>
407
408<screen role="root" revision="sysv"><userinput>make install-dbus</userinput></screen>
409
410 <para revision="sysv">
411 Note that this boot script only starts the system-wide
412 <application>D-Bus</application> daemon. Each user requiring access to
413 <application>D-Bus</application> services will also need to run a
414 session daemon as well. There are many methods you can use to start a
415 session daemon using the <command>dbus-launch</command> command. Review
416 the <command>dbus-launch</command> man page for details about the
417 available parameters and options. Here are some suggestions and
418 examples:
419 </para>
420
421 <para revision="systemd">
422 There are many methods you can use to start a session daemon
423 using the <command>dbus-launch</command> command. Review the
424 <command>dbus-launch</command> man page for details about the
425 available parameters and options. Here are some suggestions and
426 examples:
427 </para>
428
429
430 <itemizedlist spacing="compact">
431 <listitem>
432 <para>
433 Add <command>dbus-launch</command> to the line in the
434 <filename>~/.xinitrc</filename> file that starts your graphical
435 desktop environment.
436 </para>
437 </listitem>
438 <listitem>
439 <para>
440 If you use <command>xdm</command> or some other display manager
441 that calls the <filename>~/.xsession</filename> file, you can add
442 <command>dbus-launch</command> to the line in your
443 <filename>~/.xsession</filename> file that starts your graphical
444 desktop environment. The syntax would be similar to the example in
445 the <filename>~/.xinitrc</filename> file.
446 </para>
447 </listitem>
448 <listitem>
449 <para>
450 The examples shown previously use
451 <command>dbus-launch</command> to specify a program to be run. This
452 has the benefit (when also using the
453 <parameter>--exit-with-session</parameter> parameter) of stopping the
454 session daemon when the specified program is stopped. You can also
455 start the session daemon in your system or personal startup scripts
456 by adding the following lines:
457 </para>
458
459<screen role="nodump"><userinput><literal># Start the D-Bus session daemon
460eval `dbus-launch`
461export DBUS_SESSION_BUS_ADDRESS</literal></userinput></screen>
462
463 <para>
464 This method will not stop the session daemon when you exit
465 your shell, therefore you should add the following line to your
466 <filename>~/.bash_logout</filename> file:
467 </para>
468
469<screen role="nodump"><userinput><literal># Kill the D-Bus session daemon
470kill $DBUS_SESSION_BUS_PID</literal></userinput></screen>
471 </listitem>
472
473 <listitem>
474 <para>
475 A hint has been written that provides ways to start scripts
476 using the KDM session manager of KDE. The concepts in this hint could
477 possibly be used with other session managers as well. The hint is
478 located at <ulink
479 url="&hints-root;/downloads/files/execute-session-scripts-using-kdm.txt"/>.
480 </para>
481 </listitem>
482
483 </itemizedlist>
484
485 </sect3>
486
487 </sect2>
488
489 <sect2 role="content" revision="sysv">
490 <title>Contents</title>
491
492 <segmentedlist>
493 <segtitle>Installed Programs</segtitle>
494 <segtitle>Installed Library</segtitle>
495 <segtitle>Installed Directories</segtitle>
496
497 <seglistitem>
498 <seg>
499 dbus-cleanup-sockets, dbus-daemon, dbus-launch, dbus-monitor,
500 dbus-run-session, dbus-send, dbus-test-tool,
501 dbus-update-activation-environment, and dbus-uuidgen
502 </seg>
503 <seg>
504 libdbus-1.so
505 </seg>
506 <seg>
507 /etc/dbus-1,
508 /usr/{include,lib}/dbus-1.0,
509 /usr/share/dbus-1,
510 /usr/share/doc/dbus-&dbus-version;, and
511 /var/{lib,run}/dbus
512 </seg>
513 </seglistitem>
514 </segmentedlist>
515
516 <variablelist>
517 <bridgehead renderas="sect3">Short Descriptions</bridgehead>
518 <?dbfo list-presentation="list"?>
519 <?dbhtml list-presentation="table"?>
520
521 <varlistentry id="dbus-cleanup-sockets">
522 <term><command>dbus-cleanup-sockets</command></term>
523 <listitem>
524 <para>
525 is used to clean up leftover sockets in a directory.
526 </para>
527 <indexterm zone="dbus dbus-cleanup-sockets">
528 <primary sortas="b-dbus-cleanup-sockets">dbus-cleanup-sockets</primary>
529 </indexterm>
530 </listitem>
531 </varlistentry>
532
533 <varlistentry id="dbus-daemon">
534 <term><command>dbus-daemon</command></term>
535 <listitem>
536 <para>
537 is the <application>D-Bus</application> message bus daemon.
538 </para>
539 <indexterm zone="dbus dbus-daemon">
540 <primary sortas="b-dbus-daemon">dbus-daemon</primary>
541 </indexterm>
542 </listitem>
543 </varlistentry>
544
545 <varlistentry id="dbus-launch">
546 <term><command>dbus-launch</command></term>
547 <listitem>
548 <para>
549 is used to start <command>dbus-daemon</command> from a shell
550 script. It would normally be called from a user's login
551 scripts.
552 </para>
553 <indexterm zone="dbus dbus-launch">
554 <primary sortas="b-dbus-launch">dbus-launch</primary>
555 </indexterm>
556 </listitem>
557 </varlistentry>
558
559 <varlistentry id="dbus-monitor">
560 <term><command>dbus-monitor</command></term>
561 <listitem>
562 <para>
563 is used to monitor messages going through a
564 <application>D-Bus</application> message bus.
565 </para>
566 <indexterm zone="dbus dbus-monitor">
567 <primary sortas="b-dbus-monitor">dbus-monitor</primary>
568 </indexterm>
569 </listitem>
570 </varlistentry>
571
572 <varlistentry id="dbus-run-session">
573 <term><command>dbus-run-session</command></term>
574 <listitem>
575 <para>
576 start a process as a new <application>D-Bus</application> session.
577 </para>
578 <indexterm zone="dbus dbus-run-session">
579 <primary sortas="b-dbus-run-session">dbus-run-session</primary>
580 </indexterm>
581 </listitem>
582 </varlistentry>
583
584 <varlistentry id="dbus-send">
585 <term><command>dbus-send</command></term>
586 <listitem>
587 <para>
588 is used to send a message to a <application>D-Bus</application>
589 message bus.
590 </para>
591 <indexterm zone="dbus dbus-send">
592 <primary sortas="b-dbus-send">dbus-send</primary>
593 </indexterm>
594 </listitem>
595 </varlistentry>
596
597 <varlistentry id="dbus-test-tool">
598 <term><command>dbus-test-tool</command></term>
599 <listitem>
600 <para>
601 is a <application>D-Bus</application> traffic generator and test
602 tool; it is a multi-purpose tool for debugging and profiling
603 <application>D-Bus</application>.
604 </para>
605 <indexterm zone="dbus dbus-test-tool">
606 <primary sortas="b-dbus-test-tool">dbus-test-tool</primary>
607 </indexterm>
608 </listitem>
609 </varlistentry>
610
611 <varlistentry id="dbus-update-activation-environment">
612 <term><command>dbus-update-activation-environment</command></term>
613 <listitem>
614 <para>
615 is used to update the environment used for
616 <application>D-Bus</application> session services;
617 it updates the list of environment variables used by
618 <command>dbus-daemon --session</command> when it activates session
619 services without using systemd.
620 </para>
621 <indexterm zone="dbus dbus-update-activation-environment">
622 <primary sortas="b-dbus-update-activation-environment">
623 dbus-update-activation-environment</primary>
624 </indexterm>
625 </listitem>
626 </varlistentry>
627
628 <varlistentry id="dbus-uuidgen">
629 <term><command>dbus-uuidgen</command></term>
630 <listitem>
631 <para>
632 is used to generate a universally unique ID.
633 </para>
634 <indexterm zone="dbus dbus-uuidgen">
635 <primary sortas="b-dbus-uuidgen">dbus-uuidgen</primary>
636 </indexterm>
637 </listitem>
638 </varlistentry>
639
640 <varlistentry id="libdbus-1">
641 <term><filename class="libraryfile">libdbus-1.so</filename></term>
642 <listitem>
643 <para>
644 contains the API functions used by the
645 <application>D-Bus</application> message daemon.
646 <application>D-Bus</application> is first a library that provides
647 one-to-one communication between any two applications;
648 <command>dbus-daemon</command> is an application that uses this
649 library to implement a message bus daemon.
650 </para>
651 <indexterm zone="dbus libdbus-1">
652 <primary sortas="c-libdbus-1">libdbus-1.so</primary>
653 </indexterm>
654 </listitem>
655 </varlistentry>
656
657 </variablelist>
658
659 </sect2>
660
661 <sect2 role="content" revision="systemd">
662 <title>Contents</title>
663
664 <para>
665 A list of the installed files, along with their short
666 descriptions can be found at
667 <ulink url="&lfs-rootd;/chapter06/dbus.html#contents-dbus"/>.
668 </para>
669
670 </sect2>
671
672
673</sect1>
674
Note: See TracBrowser for help on using the repository browser.