77.1. dbus-1.16.2
Message bus system for communication between processes
| Version | 1.16.2, release 1 |
| Shelf | base — The minimal userland and system daemons that every KDOS image boots with |
| Phase | 41_system (System), 27 of 1047 in build order |
| Licence | AFL-2.1 OR GPL-2.0-or-later |
| Homepage | https://www.freedesktop.org/wiki/Software/dbus/ |
| Build time | 1.3 SBU |
| Installed size | 1.4 MiB in 70 files |
| Recipe | ports/core/base/dbus/kpkgbuild |
About
D-Bus is the message bus most Linux system services and desktop programs talk to each other over. This port installs dbus-daemon, the reference libdbus client library and the command-line tools (dbus-send, dbus-monitor and the rest). KDOS runs two kinds of bus with it. The system bus is started at boot by /etc/init.d/40_dbus.sh and carries NetworkManager, polkit, ModemManager and the other root services. Each user’s session runs one session bus at a fixed address in $XDG_RUNTIME_DIR, which boxed applications reach at the same path; see The session message bus.
The build differs from a systemd distribution’s in what it leaves out: no systemd integration, no X11 autolaunch, no AppArmor or SELinux mediation and no audit logging. Activation of root services still goes through dbus-daemon-launch-helper, the setuid helper the port’s postinstall.sh repairs.
Sources
dbus-1.16.2.tar.gz(1.5 MiB)
sha25639d7ad68d6124a2c19262cd488c14d1d09bc0a90d634d2b7fd73c0c0943e8dea
upstream: https://gitlab.freedesktop.org/dbus/dbus/-/archive/dbus-1.16.2/dbus-1.16.2.tar.gz
archive copy: sources-1/base--dbus-1.16.2.tar.gz
Dependencies
Depends on: expat, meson, libxslt, docbook-xsl, docbook-xml.
Required by (76): accountsservice, amiberry, ardour, at-spi2-core, avahi, bluez, bolt, brltty, chromium, cups, dconf, ddcutil, dnsmasq, elogind, fastfetch, fcitx5, firefox-esr, fltk, fluidsynth, fprintd, freedv-gui, fwupd, geoclue, goxel, gpsd, gvfs, hplip, iio-sensor-proxy, imhex, impression, kdeconnect, kdos-settingsd, kdos-sysupdated, kdos-welcome, kio-admin, knighttime, kodi, kpmcore, kscreen, libcupsfilters, libdecor, libpcap, libpulse, libreoffice, librewolf, modemmanager, networkmanager, openal-soft, orcaslicer, pipewire, plasma-workspace, polkit, prusaslicer, python3-dasbus, python3-dbus, python3-pyqt5, python3-pyqt6, qt5-qtbase, qt6-qtbase, qt6-qtwebengine, sddm, sdl3, signond, thermald, thunderbird, tlp-pd, udisks2, upower, vlc, wesnoth, wine, wpa_supplicant, xdg-desktop-portal, xdg-desktop-portal-gtk, xfconf, zbar.
Installation
From the repository root, inside the build container, this is the line kdosbuild runs for the port:
script/chroot/exec.sh bash -c 'source script/phases/41_system/phase.env && kpkg install dbus'
What kpkg does
kpkg runs these steps, in this order, as root inside the chroot. The port directory is /ports/core/base/dbus.
1. Verify every declared source. Each file a sha256 = line names, found in the port directory or in /var/cache/kpkg/sources, must hash to its line; a mismatch stops the build before anything is unpacked.
cd /ports/core/base/dbus
echo '39d7ad68d6124a2c19262cd488c14d1d09bc0a90d634d2b7fd73c0c0943e8dea dbus-1.16.2.tar.gz' | sha256sum -c -
2. Unpack. The work directory is emptied and the first source is unpacked into $SRC with its top directory stripped; any later tarball lands unstripped beside it in $SRC_ROOT, and a file that is not a tarball is copied into $SRC.
SRC_ROOT=/var/cache/kpkg/work/dbus
SRC=$SRC_ROOT/dbus-1.16.2
PKG=$SRC_ROOT/pkg
rm -rf "$SRC_ROOT"
mkdir -p "$SRC" "$PKG"
tar --no-same-permissions --warning=no-unknown-keyword -xf dbus-1.16.2.tar.gz -C "$SRC" --strip-components=1
Every config.guess and config.sub older than automake’s is then replaced with automake’s, so a configure script recognises the musl target.
3. Build. build.sh is sourced in a subshell under set -e, from $SRC, with name, version, release and the five paths PKGNAME, PORT_SRC, SRC_ROOT, SRC and PKG set as shell variables. Its body, verbatim:
meson setup build --buildtype=release \
--prefix=/usr \
--sysconfdir=/etc \
--libexecdir=/usr/lib/$name \
--libdir=/usr/lib \
--localstatedir=/var \
-D x11_autolaunch=disabled \
-D systemd=disabled \
-D launchd=disabled \
-D kqueue=disabled \
-D epoll=enabled \
-D inotify=enabled \
-D apparmor=disabled \
-D selinux=disabled \
-D libaudit=disabled \
-D qt_help=disabled \
-D ducktype_docs=disabled \
-D modular_tests=disabled \
-D doxygen_docs=disabled \
-D xml_docs=enabled \
-D system_pid_file=/run/dbus/pid \
-D system_socket=/run/dbus/system_bus_socket
meson compile -C build
DESTDIR=$PKG meson install --no-rebuild -C build
rm -rf $PKG/run
The switches, and why each is set:
--libexecdir=/usr/lib/$name— Putsdbus-daemon-launch-helperin/usr/lib/dbus/, the path the system bus configuration names in<servicehelper>, and the onepostinstall.shandkdos doctorcheck.-D x11_autolaunch=disabled— Builds no X11 autolaunch: with it, libdbus links libX11 and a client with no session bus address can start one through the X display. KDOS has no X server on the login path, and the session starts its bus itself.-D systemd=disabled— Builds no systemd support, which upstream describes asat_consolethrough systemd. KDOS has no systemd; see No systemd.-D launchd=disabled,-D kqueue=disabled— macOS launchd autolaunch and the BSD kqueue event loop, which do not apply on Linux. Each defaults toauto.-D epoll=enabled,-D inotify=enabled— Use epoll for the daemon’s main loop and inotify to notice changed configuration and service files.enabledmakes configure fail if either is missing, whereautowould quietly build without it.-D apparmor=disabled,-D selinux=disabled,-D libaudit=disabled— Build no AppArmor or SELinux mediation of bus messages and no audit logging. None of libapparmor, libselinux or libaudit is a port.-D qt_help=disabled,-D ducktype_docs=disabled,-D doxygen_docs=disabled— Build none of the Qt help file, the Ducktype (Mallard) documentation or the Doxygen API reference.-D modular_tests=disabled— Builds none of the GLib-based regression tests.-D xml_docs=enabled— Builds the manual pages and HTML documentation from DocBook withxsltproc, from libxslt, docbook-xsl and docbook-xml.enabledstops configure when the DocBook stylesheets cannot be found, whereautowould build without the manual pages.-D system_pid_file=/run/dbus/pid,-D system_socket=/run/dbus/system_bus_socket— The system bus’s pid file and listening socket, written intosystem.confand compiled into libdbus as the default system bus address. They are the paths meson derives from--prefix=/usranyway.40_dbus.shstarts the bus with--nopidfile, so the pid file is never written:dbus-daemonleaves it behind when it exits on SIGTERM and will not start while it exists, which would make every restart by the supervisor or byservice restart dbusfail.
The common switches of each build system are explained in the Flag glossary.
postinstall.sh runs on the installed system after the package is adopted:
# Everything is written under PKG_ROOT, the root kpkgadd is installing into:
# --root and an A/B update install into a tree that is not the running one.
#
# The system bus runs as messagebus and starts every User=root service through
# dbus-daemon-launch-helper, which it can execute only through the helper's
# GROUP bit. kpkg rolls every package root:root, so the group upstream's
# install step gave it is gone by the time the package lands: without this the
# bus is refused with EACCES for each activation — wpa_supplicant, fprintd,
# fwupd, boltd, upower, ModemManager and NetworkManager's dispatcher never
# start, and the only trace is a Spawn.ExecFailed in the log.
#
# The group is messagebus's primary gid, read from the target's passwd as a
# number: chown resolves a name against the running root, not this one. chown
# clears the setuid bit, so the mode is set after it. 4110 is upstream's:
# nobody but root and the bus's group may run it, and nobody may read it.
root="${PKG_ROOT:-/}"
helper="$root/usr/lib/dbus/dbus-daemon-launch-helper"
[ -f "$helper" ] || exit 0
while IFS=: read -r n _ _ gid _; do
[ "$n" = messagebus ] || continue
chown "0:$gid" "$helper"
chmod 4110 "$helper"
done < "$root/etc/passwd"
4. Package. kpkg removes libtool archives, the info directory index, mimeinfo.cache and every fonts.dir from $PKG, copies the source’s licence files into /usr/share/licenses/dbus, prunes what the image does not ship, lints the tree and rolls it reproducibly:
tar --sort=name --format=gnu --numeric-owner --owner=0 --group=0 \
--mtime=@$SOURCE_DATE_EPOCH \
--use-compress-program='xz -9 -T0 --block-size=32MiB --no-adjust' \
-cf dbus-1.16.2-1.tar.xz -C "$PKG" .
5. Adopt. kpkgadd installs the package’s files over the root, refusing a path another package owns, records the file list in /var/lib/kpkg/db/dbus, and runs the triggers its paths call for.
Contents
Installed programs: dbus-cleanup-sockets, dbus-daemon, dbus-launch, dbus-monitor, dbus-run-session, dbus-send, dbus-test-tool, dbus-update-activation-environment, dbus-uuidgen.
Installed libraries: libdbus-1.so.
Installed directories: /usr/lib/cmake/DBus1, /usr/lib/dbus, /usr/lib/dbus-1.0, /usr/share/dbus-1/session.d, /usr/share/doc/dbus, /usr/share/licenses/dbus, /usr/share/xml/dbus-1, /var/lib/dbus.
Short descriptions
dbus-cleanup-sockets |
clean up leftover sockets in a directory |
dbus-daemon |
Message bus daemon |
dbus-launch |
Utility to start a message bus from a shell script |
dbus-monitor |
debug probe to print message bus messages |
dbus-run-session |
start a process as a new D-Bus session |
dbus-send |
Send a message to a message bus |
dbus-test-tool |
D-Bus traffic generator and test tool |
dbus-update-activation-environment |
update environment used for D-Bus session services |
dbus-uuidgen |
Utility to generate UUIDs |
dbus-1.pc |
Free desktop message bus |
Notes
rm -rf $PKG/run removes the empty /run/dbus directory the install creates. /run is a tmpfs created afresh at every boot, so nothing in a package can live there; 40_dbus.sh makes /run/dbus before it starts the daemon.
Some clients have the old address unix:path=/var/run/dbus/system_bus_socket compiled in, basu’s sd_bus_open_system() among them. The daemon listens under /run, and they reach it because /var/run is a link to /run, made by script/phases/10_bootstrap/000_file_system.sh. A root where /var/run is a real directory leaves every such client unable to find the system bus.
The machine id the bus needs, /var/lib/dbus/machine-id, is not in the package: an image that carried one would give every machine the same id. 40_dbus.sh creates it on first boot with dbus-uuidgen --ensure and links /etc/machine-id to it.
kpkg installs every file root:root, so the launch helper loses the messagebus group upstream’s install gives it. postinstall.sh sets it back, owner root:messagebus and mode 4110, or the bus cannot start any activated root service; see setuid binaries.