After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 744736 - use systemd user scope units
use systemd user scope units
Status: RESOLVED OBSOLETE
Product: gnome-terminal
Classification: Core
Component: general
unspecified
Other Linux
: Normal enhancement
: ---
Assigned To: GNOME Terminal Maintainers
GNOME Terminal Maintainers
Depends on:
Blocks:
 
 
Reported: 2015-02-18 18:02 UTC by Christian Persch
Modified: 2020-04-27 20:24 UTC
See Also:
GNOME target: ---
GNOME version: ---



Description Christian Persch 2015-02-18 18:02:47 UTC
Suggested in http://lists.freedesktop.org/archives/dbus/2015-February/016540.html : "Ideally gnome-terminal would open a user scope unit for each of its tabs."
Comment 1 Martin Pitt 2016-05-11 12:14:54 UTC
Won't systemd user scopes also just be children of the user@1000.service, instead of being children of the actual logind session (like session-c2.scope) which has all the other "appliation" processes of the user in that session, such as the WM or firefox?

With current user dbus and bug 759115 fixed, the hierarchy now has this structure (I removed most bits from systemd-cgls, and only kept the interesting bits):

Control group /:
└─user.slice
  └─user-1000.slice
    ├─user@1000.service
    │ ├─dbus.service
    │ │ ├─2199 /usr/bin/dbus-daemon --session --address=systemd: --nofork --n...
    │ │ ├─2462 /usr/lib/x86_64-linux-gnu/gconf/gconfd-2
    │ │ └─3116 /usr/bin/gnome-screensaver --no-daemon
    │ ├─init.scope
    │ │ ├─2139 /lib/systemd/systemd --user
    │ └─gnome-terminal-server.service
    │   ├─2394 /usr/lib/gnome-terminal/gnome-terminal-server
    │   ├─2415 bash
    │   └─3607 systemd-cgls
    └─session-c2.scope
      ├─1120 lightdm --session-child 12 19
      ├─2191 i3
      ├─2322 /usr/lib/firefox/firefox

I. e. processes started in a terminal (bash and systemd-cgls here) are detached from the logind session scope which has (and is supposed to) have all my other session processes such as firefox or the window manager (i3).

Now, if gnome-terminal-server would start user scopes, I assume it would look something like

Control group /:
└─user.slice
  └─user-1000.slice
    ├─user@1000.service
    │ ├─dbus.service
    │ │ ├─2199 /usr/bin/dbus-daemon --session --address=systemd: --nofork --n...
    │ │ ├─2462 /usr/lib/x86_64-linux-gnu/gconf/gconfd-2
    │ │ └─3116 /usr/bin/gnome-screensaver --no-daemon
    │ ├─init.scope
    │ │ ├─2139 /lib/systemd/systemd --user
    │ ├─gnome-terminal-tab@1.scope
    │ │ └─2415 bash
    │ ├─gnome-terminal-tab@2.scope
    │ │ ├─3606 bash
    │ │ └─3607 systemd-cgls
    │ └─gnome-terminal-server.service
    │   └─2394 /usr/lib/gnome-terminal/gnome-terminal-server
    └─session-c2.scope
      ├─1120 lightdm --session-child 12 19
      ├─2191 i3
      ├─2322 /usr/lib/firefox/firefox

which is still not what we want, as we randomly distribute user-facing applications (which are specific to the session) across the logind session .scope and the user dbus.service.

For D-Bus services like gvfs, d-conf, or dbus-daemon itself it's fine and intended to *not* put them into the logind scope, but everything else (firefox, WM, visible terminal tabs and processes started from them) are specific to the particular session only and do belong into session-c2.scope and not user@1000.service.

This is also the main thing that keeps us (and I figure others) from actually using systemd --user to replace gnome-session -- There is a missing link how user .services can state that they apply to a particular logind session scope only. Once we have that, we can make gnome-terminal-server and also a "gnome-session-systemd" replacement for gnome-session use that.
Comment 2 Martin Pitt 2016-05-11 12:33:09 UTC
> everything else (firefox, WM, visible terminal tabs and processes started from
> them) are specific to the particular session only and do belong into
> session-c2.scope and not user@1000.service.

Rationale: All these have a $DISPLAY environment which is tied to the lifetime of the corresponding display manager/X.org instance. You can't keep firefox, xeyes or anything else to keep alive across display server boundaries, nor do you really want to.

That's of course not true for CLI apps that do not actually use the $DISPLAY variable, but (1) treating them differently would be highly inconsistent (some processes survive, some not), (2) predicting which of those use $DISPLAY and which don't is not feasible (as they might spawn X clients later on as subprocesses), and (3) would not exactly help in making the whole architecture simpler and more robust.
Comment 3 Martin Pitt 2016-05-11 21:29:45 UTC
For the record, I started a thread to discuss the more general problem: https://lists.freedesktop.org/archives/systemd-devel/2016-May/036440.html
Comment 4 Christian Persch 2020-04-27 20:24:12 UTC
This is fixed with vte 0.60.