I am attempting to run various Gnome applications via X11 Forwarding and SSH. Some applications will cause the 'dbus-launch' application to be spawned first. The problem is that dbus-launch doesn't close when the X application is exited, and therefore must be killed before the SSH session can be closed properly.
I assume the problem is that the X/Gnome applications can't connect with the main message bus daemon and therefore must launch their own copy? How can I fix this? Or what am I missing?
Here is an example. I have X11 Forwarding enabled, all seems to work fine.
[me@host ~]$ gnome-calculator &
[1] 4803
(here the gcalctool program launches and is displayed to my remove X server (Xming))
[me@host ~]$ ps
PID TTY TIME CMD
4706 pts/0 00:00:00 bash
4803 pts/0 00:00:00 gnome-calculator
4807 pts/0 00:00:00 dbus-launch
4870 pts/0 00:00:00 ps
(now, after closing the gcalctool app in the remote session)
[me@host ~]$ ps
PID TTY TIME CMD
4706 pts/0 00:00:00 bash
4807 pts/0 00:00:00 dbus-launch
4898 pts/0 00:00:00 ps
Note that dbus-launch is still active. And the worst part, this prevents the SSH connection from closing properly until it is killed.
Note that the system wide message daemon is running, as can be seen here:
[me@host ~]$ ps ax
4696 ? Ssl 0:00 dbus-daemon --system
What am I missing here? I have never seen this behavior before. Presumably, I've only ever seen applications that can connect to the message bus daemon unhindered? I have looked in /etc/dbus-1 for answers, but don't know what to look for.
Thanks in advance for the help.
[EDIT]
OK, I'm realizing that I'm experiencing a common problem. It seems this is a fairly common behavior, but without a good solution. I'm experiencing the SSH hang because dbus-launch is still active in the tty. But there's seemingly no good way to get the dbus-launch to happen quietly.
Looking at /etc/X11/xinit/xinitrc.d/00-start-message-bus.sh gives some clue as to what is supposed to happen with a "normal" X session. This of course doesn't work when just invoking an X application to a remote X Server.
As a temporary workaround, I've added this to my .bash_logout:
# ~/.bash_logout
pkill -u $USER -t `tty | cut -d '/' -f 3,4` dbus-launch
This will allow the SSH session to close out, but it feels kludgy. Are there any better solutions out there? What's the proper way to run remote X11 applications without dbus getting in the way?