Leftover dbus processes after launching a dbus-using application remotely and then closing the application

Solution Verified - Updated -

Environment

  • Red Hat Enterprise Linux (RHEL)
    • 6
    • 7 (but < 7.5)

Issue

When processes needing dbus are launched remotely (via ssh, LSF, or a similar tool), dbus processes keep running even after the main process is closed, blocking the remote session and preventing it from terminating properly.

Resolution

  • First, update to

    • (RHEL 7) dbus-1.10.24-3.el7
    • (RHEL 6) dbus-1.2.24-9.el6
      or later
  • For interactive use, make sure to launch dbus-run-session before the shell. For instance, add this to .bashrc:

if test -z "$DBUS_SESSION_BUS_ADDRESS" ; then
  exec dbus-run-session -- bash
  echo "D-Bus per-session daemon address is: $DBUS_SESSION_BUS_ADDRESS"
fi

so that the resulting process tree shows the bash shell running under dbus-run-session:

$ ps f
  PID TTY      STAT   TIME COMMAND
 2075 pts/0    Ss     0:00 dbus-run-session -- bash
 2095 pts/0    Sl     0:00  \_ dbus-daemon --nofork --print-address 4 --session
 2096 pts/0    S      0:00  \_ bash
  • For non-interactive use, use "dbus-run-session -- command" directly, which will solve the issue unless the command forks in the background.

Diagnostic Steps

  • launch a command like gnome-terminal or gnome-text-editor remotely (via ssh -X for instance)
  • exit gnome-terminal / gnome-text-editor
  • the remote session stays stuck instead of exiting
  • dbus-launch and dbus-daemon processes are left over in the output of "ps ax"

This solution is part of Red Hat’s fast-track publication program, providing a huge library of solutions that Red Hat engineers have created while supporting our customers. To give you the knowledge you need the instant it becomes available, these articles may be presented in a raw and unedited form.

Close

Welcome! Check out the Getting Started with Red Hat page for quick tours and guides for common tasks.