Benjamin Berg, one of the Red Hat engineers at GNOME, has summarized the results of moving GNOME to session management exclusively with systemd, without using the gnome-session process.
For a long time, systemd-logind has been used to control GNOME login, which monitors the state of sessions in relation to the user, manages session identifiers, is responsible for switching between active sessions, coordinates multi-seat environments, sets up access policies for devices, provides tools to shut down and enter sleep mode, etc.
At the same time, part of the session-related functionality remained on the shoulders of the gnome-session process, which was engaged in control via D-Bus, launching the display manager and GNOME components, and organizing autorun of user-specified applications. During the GNOME 3.34 development process, gnome-session-specific features are formatted as unit files for systemd running in “systemd –user” mode, i.e. in relation to the environment of a specific user, and not the entire system. The changes have already been applied to the Fedora 31 distribution, which is expected to be released in late October.
Using systemd made it possible to organize the launch of handlers on demand or upon the occurrence of certain events, as well as to more sophisticatedly respond to premature termination of processes due to crashes and to expand the processing of dependencies when GNOME components are launched. As a result, you can reduce the number of constantly running processes and reduce memory consumption. For example, XWayland can now be launched only when trying to run an application based on the X11 protocol, and components specific to a particular equipment, only if such equipment is available (for example, smart card handlers will start when a card is inserted and end when it is removed).
There are more flexible tools for controlling the launch of services for the user, for example, to disable the multimedia key handler it will be enough to run “systemctl –user stop gsd-media-keys.target”. In case of problems associated with each processor, the logs can be viewed with the journalctl command (for example, “journalctl –user -u gsd-media-keys.service”), after enabling debugging logging in the service (“Environment = G_MESSAGES_DEBUG = all”). Also, it became possible to run all GNOME components in sandbox environments that are subject to increased security requirements.
To smooth the transition, support for the old way to start processes is planned to be maintained over several GNOME development cycles. Further, developers will review the state of gnome-session and most likely (marked as “likely”) will remove from it the means of starting processes and maintaining the D-Bus API. Then the use of “systemd –user” will be transferred to the category of mandatory functions, which may create difficulties for systems without systemd and will require the preparation of an alternative solution, as was the case with systemd-logind. Nevertheless, in his speech at the GUADEC 2019 conference, Benjamin Berg mentioned his intention to maintain support for the old startup method for systems without systemd, but this information is at variance with the plans on the project page.