What are the practical implications, if any, of using software which processes are not the descendants of the window manager

openboxsystemd

I've set up Openbox on bare X with the slim login manager, all on a systemd init (on Gentoo). I'm using two different terminal emulators on the desktop so as to be able to create different behaviors for each in my rc.xml file (standard sized lxterminal snap to top left, roxterm to right maximized vertically). I went further and added an entry to my .config/openbox/autostart file to start lxterminal automatically upon login. Then I opened two other instances of lxterminal manually, as well as roxterm. Looking at the pstree output:

systemd 
  ├─acpid -f
  ├─agetty --noclear tty1
  ├─at-spi-bus-laun
  │   ├─dbus-daemon --config-file=/etc/at-spi2/accessibility.conf --nofork--print-addres
  │   └─2*[{at-spi-bus-laun}]
  ├─at-spi2-registr --use-gnome-session
  │   └─{at-spi2-registr}
  ├─dbus-daemon --system --address=systemd: --nofork --nopidfile--systemd-activation
  ├─dbus-daemon --fork --print-pid 6 --print-address 8 --session
  ├─dbus-launch --exit-with-session /etc/X11/Sessions/openbox
  ├─dhcpcd -q --nobackground
  ├─lal -c blue -s 10 -b -f %c -w 152
  ├─lxterminal   <----------(1)
  │   ├─bash
  │   │   └─htop
  │   ├─bash
  │   │   └─su
  │   │       └─bash
  │   │           └─grc /usr/lib/python-exec/python2.7/grc tail -f ...
  │   │               ├─grcat /usr/lib/python-exec/python2.7/grcat conf.log
  │   │               └─tail -f /var/log/emerge.log
  │   ├─bash
  │   │   └─su
  │   │       └─bash
  │   │           └─grc /usr/lib/python-exec/python2.7/grc tail -f /var/log/dmesg
  │   │               ├─grcat /usr/lib/python-exec/python2.7/grcat conf.log
  │   │               └─tail -f /var/log/dmesg
  │   ├─gnome-pty-helpe
  │   └─{lxterminal}
  ├─slim -nodaemon -s
  │   ├─X -nolisten tcp -br -deferglyphs 16 vt07 -auth /var/run/slim.auth
  │   └─sh /etc/X11/Sessions/openbox
  │       └─openbox --startup /usr/libexec/openbox-autostart OPENBOX
  │           ├─firefox
  │           │   ├─plugin-containe /usr/lib64/nsbrowser/plugins/libflashplayer.so ...
  │           │   │   └─6*[{plugin-containe}]
  │           │   └─35*[{firefox}]
  │           └─roxterm   <------------------------(2)
  │               ├─bash
  │               │   └─pstree -a
  │               ├─gnome-pty-helpe
  │               └─{roxterm}
  ├─systemd --user
  │   └─(sd-pam)                 
  ├─systemd-journal
  ├─systemd-logind
  ├─systemd-udevd
  └─xcompmgr -c -C -t-5 -l-5 -r4.2 -o.55

I noticed that lxterminal(1) and the other instances of bash I called through launching it manually are not children instances of the slim/X/openbox processes, like roxterm(2) or firefox are; rather their parent is systemd directly. I don't understand why something stemming from Openbox autostart can yield a process that wouldn't be its direct descendant. Nevertheless, inspired by how seemingly some of the 'widgets' are set up under Archbang, I modified autostart to include a substitution $(lxterminal) & instead of just lxterminal &. The result is still outside the Openbox process context and here's the relevant part:

├─sh /home/myuser/.config/openbox/autostart
  │   └─lxterminal <----------------------(3)
  │       ├─bash
  │       ├─bash
  │       │   └─pstree -a
  │       ├─gnome-pty-helpe
  │       └─{lxterminal}
  • What are the practical implications, if any, from using software which processes don't stem from your window manager like with lxterminal(1) here and which are not 'gated' so to speak by your login manager?
  • Does the substitution in (3) introduce anything new to the setup (i.e. is it different than in (1) and how so )?

Part of ps -aux output, for a look at the process state column (see codes in man) etc.:

root         1  0.0  0.0  40008  3096 ?        Ss   17:16   0:00 /usr/lib/systemd/systemd
...
root       3290  0.0  0.0  30048  1656 ?        Ss   17:17   0:00 /usr/lib/systemd/systemd-logind
root       3291  0.0  0.0   4248   824 ?        Ss   17:17   0:00 /usr/sbin/acpid -f
message+   3292  0.0  0.0  21732  1568 ?        Ss   17:17   0:00 /usr/bin/dbus-daemon --system --address=systemd: --nofork --nopidfile --systemd-activation
root       3299  0.0  0.0  19900  1104 tty1     Ss+  17:17   0:00 /sbin/agetty --noclear tty1
user       3359  0.0  0.0  30916  2064 ?        Ss   17:17   0:00 /usr/lib/systemd/systemd --user
user       3362  0.0  0.0  56820  1132 ?        S    17:17   0:00 (sd-pam)                 
root       3820  0.0  0.0      0     0 ?        S    17:31   0:00 [kworker/1:1]
root       3823  0.0  0.0      0     0 ?        S    17:31   0:00 [kworker/3:0]
root       4644  0.0  0.0      0     0 ?        S    18:09   0:00 [kworker/1:2]
root       4912  0.0  0.0      0     0 ?        S    18:18   0:00 [kworker/1:0]
root       4918  0.0  0.0      0     0 ?        S    18:18   0:00 [kworker/0:0]
root       4919  0.2  0.4 132660 17632 ?        Ss   18:18   0:00 /usr/bin/slim -nodaemon -s
root       4921  2.6  0.8 132044 34176 tty7     Ss+  18:18   0:05 /usr/bin/X -nolisten tcp -br -deferglyphs 16 vt07 -auth /var/run/slim.auth
user       4931  0.0  0.0  14804  1384 ?        S    18:18   0:00 /bin/sh /etc/X11/Sessions/openbox
user       4961  0.0  0.0  24480   628 ?        S    18:18   0:00 /usr/bin/dbus-launch --exit-with-session /etc/X11/Sessions/openbox
user       4962  0.0  0.0  21716  1068 ?        Ss   18:18   0:00 /usr/bin/dbus-daemon --fork --print-pid 6 --print-address 8 --session
user       4963  0.1  0.2 108152  9484 ?        S    18:18   0:00 /usr/bin/openbox --startup /usr/libexec/openbox-autostart OPENBOX
user       4973  0.0  0.0  31056  2896 ?        S    18:18   0:00 xcompmgr -c -C -t-5 -l-5 -r4.2 -o.55
user       4974  0.0  0.0  35636  3764 ?        S    18:18   0:00 lal -c blue -s 10 -b -f %c -w 152
user       4976  0.1  0.3 330660 12916 ?        Sl   18:18   0:00 lxterminal
user       4978  0.0  0.0  14696   808 ?        S    18:18   0:00 gnome-pty-helper
user       4979  0.0  0.0  23368  2200 pts/0    Ss   18:18   0:00 /bin/bash
user       4988  0.0  0.0  23368  2200 pts/1    Ss   18:18   0:00 /bin/bash
user       4996  0.0  0.0  23368  2252 pts/2    Ss   18:18   0:00 /bin/bash
user       5003  0.4  0.0  21668  1952 pts/0    S+   18:18   0:00 htop
user       5004  0.2  0.4 300924 18704 ?        Sl   18:19   0:00 roxterm
user       5006  0.0  0.0 258980  2972 ?        Sl   18:19   0:00 /usr/libexec/at-spi-bus-launcher
user       5009  0.0  0.0  21612  1508 ?        S    18:19   0:00 /usr/bin/dbus-daemon --config-file=/etc/at-spi2/accessibility.conf --nofork --print-address 3
user       5012  0.0  0.0 120304  3284 ?        Sl   18:19   0:00 /usr/libexec/at-spi2-registryd --use-gnome-session
user       5014  0.0  0.0  14696   780 ?        S    18:19   0:00 gnome-pty-helper
user       5015  0.0  0.0  23368  2316 pts/3    Ss   18:19   0:00 -bash
root       5027  0.0  0.0  59876  2020 pts/1    S    18:19   0:00 su
root       5030  0.0  0.0  23480  2292 pts/1    S    18:19   0:00 bash
root       5035  0.0  0.1  24904  4796 pts/1    S+   18:19   0:00 /usr/bin/python2.7 /usr/lib/python-exec/python2.7/grc tail -f /var/log/emerge.log
root       5036  0.0  0.0   7292   608 pts/1    S+   18:19   0:00 tail -f /var/log/emerge.log
root       5037  0.0  0.1  25180  4860 pts/1    S+   18:19   0:00 /usr/bin/python2.7 /usr/lib/python-exec/python2.7/grcat conf.log
root       5039  0.0  0.0  59876  2020 pts/2    S    18:19   0:00 su
root       5042  0.0  0.0  23476  2292 pts/2    S    18:19   0:00 bash
root       5047  0.0  0.1  24904  4792 pts/2    S+   18:19   0:00 /usr/bin/python2.7 /usr/lib/python-exec/python2.7/grc tail -f /var/log/dmesg
root       5048  0.0  0.0   7292   612 pts/2    S+   18:19   0:00 tail -f /var/log/dmesg
root       5049  0.0  0.1  25180  4856 pts/2    S+   18:19   0:00 /usr/bin/python2.7 /usr/lib/python-exec/python2.7/grcat conf.log
user       5051 10.6  5.7 901616 231196 ?       Sl   18:19   0:13 /opt/firefox/firefox
root       5106  0.0  0.0  59876  2020 pts/3    S    18:20   0:00 su
root       5109  0.0  0.0  23488  2380 pts/3    S    18:20   0:00 bash
root       5181  0.0  0.0  20560  1304 pts/3    R+   18:22   0:00 ps -aux

Best Answer

The main practical implementation is that descendants of the window manager will inherit the environment variables of the window manager. This is helpful for dealing with cryptographic key agents such as gpg-agent or ssh-agent where the login manager starts up the agents so the window manager and its descendants inherit the SSH_AGENT_PID and SSH_AUTH_SOCK environment variables automatically.

You can compare the /proc/PID/environ output for both processes:

cat /proc/`pgrep openbox`/environ | xargs -0 -l1

with

cat /proc/`pgrep lxterminal`/environ | xargs -0 -l1

The xargs -0 -l1 simply prints the null-terminated output of environ to multiple lines.

Related Question