1
$ sudo lsof +E -a -U -p 1480
lsof: WARNING: can't stat() fuse.gvfsd-fuse file system /run/user/1000/gvfs
      Output information may be incomplete.
lsof: WARNING: can't stat() fuse.gvfsd-fuse file system /run/user/1001/gvfs
      Output information may be incomplete.
COMMAND    PID USER   FD   TYPE             DEVICE SIZE/OFF  NODE NAME
Xorg       717 root   43u  unix 0xffff975eacf2d400      0t0 30862 @/tmp/.X11-unix/X0 type=STREAM ->INO=28661 1480,lxtermina,3u
dbus-daem  980    t   34u  unix 0xffff975eacf2fc00      0t0 30865 /run/user/1000/bus type=STREAM ->INO=28666 1480,lxtermina,9u
dbus-daem 1073    t   13u  unix 0xffff975eacf2c400      0t0 28664 @/tmp/dbus-vtzJFcQ5Cy type=STREAM ->INO=28663 1480,lxtermina,5u
lxtermina 1480    t    3u  unix 0xffff975eacf2c000      0t0 28661 type=STREAM ->INO=30862 717,Xorg,43u
lxtermina 1480    t    5u  unix 0xffff975eacf2d000      0t0 28663 type=STREAM ->INO=28664 1073,dbus-daem,13u
lxtermina 1480    t    7u  unix 0xffff975eacf2f000      0t0 28665 /run/user/1000/.lxterminal-socket- type=STREAM
lxtermina 1480    t    9u  unix 0xffff975eacf2e800      0t0 28666 type=STREAM ->INO=30865 980,dbus-daem,34u

The lxterminal process communicates with Xorg process for GUI of lxterminal.

Then What is communication with dbus for? It's just a terminal emulator, why does it want to use dbus?

Thanks.

Tim
  • 101,790

1 Answers1

2

Note that there can be several DBus instances on your system:

  • the system bus, that has its socket at /var/run/dbus/system_bus_socket or similar directory that is only writable by root. It is started at boot time.
  • the user session bus that is started when you start a GUI desktop session and goes away when you log out.
  • the accessibility bus, which originally used CORBA but has now been switched to more lightweight DBus. It supports various accessibility features of the desktop environment.

Since the dbus-daemon process is running on your own user account

The description of lxterminal at LXDE.org says:

LXTerminal supports multiple tabs. All instances of program share the same process to reduce memory usage.

I don't personally use LXTerminal, but this is probably the main reason for its use of DBus: when you attempt to start a new lxterminal window by clicking on a desktop icon or menu, the starting lxterminal process probably uses D-Bus to see if another instance of it is already running.

If there's already one LXTerminal process running, the new one can then simply send a "open a new window/tab with these options..." DBus message to the already-running process, and exit. The already-running LXTerminal process will then open a new window or set up a new tab according to its settings and/or options passed to it.

telcoM
  • 96,466
  • Thanks. https://unix.stackexchange.com/a/486140/674 says lxterminal uses Unix domain sockets to ensure only one process running lxterminal. Are you sure it is D-bus instead of sockets? – Tim Jan 06 '19 at 13:42
  • I'm not really sure, but it could use both: its own socket for situations where session D-Bus is not available, and D-Bus to allow the desktop environment to start more terminal windows/tabs in a standardized way that is not limited to LXTerminal or LXDE only. It might also do more than that with DBus. You could use dbus-monitor to see what happens on the DBus when you start the first LXTerminal instance, or use dbus-send to introspect the DBus interface provided by the LXTerminal process. – telcoM Jan 06 '19 at 14:12
  • What does the desktop environment (LXDE or Gnome or whichever you know) use D-Bus for in general? – Tim Jan 06 '19 at 14:22
  • Another question, is D-bus is implemented using sockets? Is /run/user/1000/.lxterminal-socket- type=STREAM the socket that lxterminal used for ensuring only one process is running lxterminal? Is the socket not the one underlying D-bus? – Tim Jan 06 '19 at 15:37
  • LXTerminal uses its own socket for client-server work. https://unix.stackexchange.com/a/333578/5132 . It does not use the Desktop Bus, and in fact itself contains no D-Bus code. – JdeBP Jan 06 '19 at 16:45