Skip to content
  • intrigeri's avatar
    Terminate GDM's GNOME session after the amnesia user logs in, in order to free... · 9e6df451
    intrigeri authored
    Terminate GDM's GNOME session after the amnesia user logs in, in order to free memory (refs: #12092)
    
    I've heard rumors that we can drop this hack when we switch to Wayland (#12213).
    We'll see :)
    
    We kill it as part of desktop.target, i.e. during the "Applications" phase of
    the initialization of the GNOME session. We cannot do this earlier reliably:
    
     - basic.target is started by "systemd --user" for almost every command run as
       the amnesia user and may thus be triggered too early, at a time when we still
       need GDM's processes.
    
     - If we do this as part of basic.target, it sometimes happens before amnesia's
       X.Org has started, and sometimes after that, which causes racy behaviour,
       weird bugs, and amnesia's $DISPLAY can be either :0 or :1, which breaks our
       code that relies on that value to be always the same.
    
    We're in no rush to kill GDM's GNOME session super early anyway.
    
    Note that we keep GDM running while we kill its GNOME session,
    otherwise, the amnesia user can't unlock the screen:
    
      Failed to open reauthentication channel: Gio:DBusError:
      GDBus.Error:org.freedesktop.DBus.Error.ServiceUnknown: The name
      org.gnome.DisplayManager was not provided by any .service files
    
    Also, we ensure gdm-session-worker does not start new sessions once the amnesia
    user has logged in, which should hopefully prevent GDM from activating
    such a session while we want the amnesia's user session to remain active.
    9e6df451