DBUS-RUN-SESSION(1)
โจ DBUS-RUN-SESSION โจ
okay so bestie, welcome to dbus-run-session โ it's a User Commands situation and honestly it's giving "tiny tool, big main character energy" ๐
๐ธ NAME ๐ธ
dbus-run-session โ start a process as a new D-Bus session. that's it. that's the whole vibe. ๐ฆ
โจ SYNOPSIS โจ
dbus-run-session [--config-file FILENAME] [--dbus-daemon BINARY] [--]
PROGRAM [ARGUMENTS...]
dbus-run-session --help
dbus-run-session --version
like, you give it a program, it gives that program a whole fresh session bus. match made in heaven fr fr ๐
๐ DESCRIPTION ๐
so dbus-run-session is used to start a session bus instance of dbus-daemon from a shell script, and then start a specified program in that session. the dbus-daemon will run for as long as the program does, after which it will terminate. iconic behaviour, no notes ๐
one use is to run a shell with its own dbus-daemon in a text-mode or SSH session, and have the dbus-daemon terminate automatically on leaving the sub-shell, like this:
dbus-run-session -- bash
or, if you wanna replace the login shell altogether, by combining dbus-run-session with the exec builtin:
exec dbus-run-session -- bash
another use โ and this one is lowkey the bestie-coded one โ is to run regression tests and similar things in an isolated D-Bus session, so you avoid either interfering with the "real" D-Bus session or relying on there already being a D-Bus session active, for instance:
dbus-run-session -- make check
or (in automake(1)):
AM_TESTS_ENVIRONMENT = export MY_DEBUG=all;
LOG_COMPILER = dbus-run-session
AM_LOG_FLAGS = --
see how clean that is? no cap, it ate ๐
๐ OPTIONS ๐
--config-file=FILENAME,--config-file FILENAMEโ pass--config-file=FILENAMEto the bus daemon, instead of passing it the--sessionargument. seedbus-daemon(1). ๐ซ--dbus-daemon=BINARY,--dbus-daemon BINARYโ runBINARYasdbus-daemon(1), instead of searching thePATHin the usual way for an executable calleddbus-daemon. you pick the daemon, you're the main character now ๐ซถ--helpโ print usage information and exit. ๐ง--versionโ print the version ofdbus-run-sessionand exit. โญ
๐ EXIT STATUS ๐
okay listen, this part matters, don't skip it:
dbus-run-session exits with the exit status of PROGRAM, 0 if the --help or --version options were used, 127 on an error within dbus-run-session itself, or 128+n if the PROGRAM was killed by signal n.
like, it's literally just passing the vibes through ๐ญ
๐ฆ ENVIRONMENT ๐ฆ
PATH is searched to find PROGRAM, and (if the --dbus-daemon option is not used or its argument does not contain a / character) to find dbus-daemon. so yeah, PATH is doing a lot of heavy lifting here ๐ซก
the session bus' address is made available to PROGRAM in the environment variable DBUS_SESSION_BUS_ADDRESS. cute little handoff ๐
the variables DBUS_SESSION_BUS_PID, DBUS_SESSION_BUS_WINDOWID, DBUS_STARTER_BUS_TYPE and DBUS_STARTER_ADDRESS are removed from the environment, if present. yeah, they get yeeted ๐
๐ฅ BUGS ๐ฅ
please send bug reports to the D-Bus mailing list or bug tracker, see https://www.freedesktop.org/wiki/Software/dbus/
(no gatekeeping, they wanna hear from you ๐)
๐ AUTHOR ๐
see https://dbus.freedesktop.org/doc/AUTHORS
๐ธ SEE ALSO ๐ธ
dbus-daemon(1), dbus-launch(1)
that's the whole page bestie, go forth and session-bus responsibly ๐
this has been D-Bus 1.16.2, dated 03/03/2025 โ mwah, ily, bye ๐ ๐
๐ฆ where this page comes from
- alpine 3.22: dbus-doc 1.16.2-r1 ยท AFL-2.1 OR GPL-2.0-or-later
- ๐ girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms