Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

logind-user: switch tracking logic to user-runtime-dir@.service #30910

Merged
merged 5 commits into from
Feb 15, 2024

Commits on Feb 15, 2024

  1. login/logind-session-dbus: some follow-ups for 'user-incomplete' (sys…

    …temd#30226)
    
    We don't usually say ", refusing" in bus error messages.
    Also, make use of unref_and_replace_full.
    YHNdnzj committed Feb 15, 2024
    Configuration menu
    Copy the full SHA
    5518b72 View commit details
    Browse the repository at this point in the history
  2. logind-user: track user started/stopping state through user-runtime-d…

    …ir@.service
    
    Before systemd#30884, the user state is tied to user@.service (user service
    manager). However, systemd#30884 introduced sessions that need no manager,
    and we can no longer rely on that.
    
    Consider the following situation:
    
    1. A 'background-light' session '1' is created (i.e. no user service manager
       is needed)
    2. Session '1' scope unit pulls in user-runtime-dir@.service
    3. Session '1' exits. A stop job is enqueued for user-runtime-dir@.service
       due to StopWhenUnneeded=yes
    4. At the same time, another session '2' which requires user manager is started.
       However, session scope units have JobMode=fail, therefore the start job
       for user-runtime-dir@.service that was pulled in by session '2' scope job
       is deleted as it conflicts with the stop job.
    
    We want session scope units to continue using JobMode=fail, but we still need
    the dependencies to be started correctly, i.e. explicitly requested by logind
    beforehand. Therefore, let's stop using StopWhenUnneeded=yes for
    user-runtime-dir@.service, and track users' `started` and `stopping` state
    based on that when user@.service is not needed. Then, for every invocation
    of user_start(), we'll recheck if we need the service manager and start it
    if so.
    
    Also, the dependency type on user-runtime-dir@.service from user@.service
    is upgraded to `BindsTo=`, in order to ensure that when logind stops the
    former, the latter is stopped as well.
    YHNdnzj committed Feb 15, 2024
    Configuration menu
    Copy the full SHA
    e2a42c0 View commit details
    Browse the repository at this point in the history
  3. logind-session: use Requires= for user{,-runtime-dir}@.service

    Since we do require these basic user services, let's make
    the dependency stronger. Note that logind should enqueue
    start jobs for these already in user_start(), so mostly
    just paranoia.
    YHNdnzj committed Feb 15, 2024
    Configuration menu
    Copy the full SHA
    52bcc87 View commit details
    Browse the repository at this point in the history
  4. env-util: minor modernization

    YHNdnzj committed Feb 15, 2024
    Configuration menu
    Copy the full SHA
    9128fd5 View commit details
    Browse the repository at this point in the history
  5. Configuration menu
    Copy the full SHA
    0ba2495 View commit details
    Browse the repository at this point in the history