10

When I try to close a logind session (by logging out), some processes remain running under the session, preventing it from properly terminating, resulting in [email protected] not terminating either. I've heard that the latter is an intended behavior (it is desirable for some units to remain running), but I assume that leaving sessions running is not the proper way to achieve that. Furthermore, when I manually terminate the session, the [email protected] also terminates, so it almost seems like lingering sessions are used for this purpose.

To illustrate what I'm on about, this is a part of the output of systemd-cgls while I am normally logged in (i.e. Right now):

Control group /:
-.slice
└─user.slice
  └─user-1000.slice
    ├─[email protected]
    │ └─ //various units listed; removed for brevity
    └─session-c8.scope
      ├─4883 login -- sammko     
      ├─4905 /usr/bin/gnome-keyring-daemon --daemonize --login
      └─ //various other processes listed; removed for brevity

The output is completely expected. After logging out of the session:

Control group /:
-.slice
└─user.slice
  └─user-1000.slice
    ├─[email protected]
    │ └─ //various units listed; removed for brevity
    └─session-c8.scope
      └─4905 /usr/bin/gnome-keyring-daemon --daemonize --login

gnome-keyring-daemon somehow survives, keeping the session alive. If we now run loginctl show-session c8, we find State=closing in the output. If we proceed to kill -HUP 4905 we find that the process and the session terminate, taking the entire user-uid.slice with it. If we were to proceed with kill -TERM 4905, the process would also have terminated. This makes me think that gnome-keyring-daemon does not ignore the signals, or anything like that. In case the process needed a signal twice to actually close, I tried to kill -HUP 4905 before logging out and the process terminated as well.

I was under the impression that systemd attempts to terminate processes with SIGHUP, to which gnome-keyring-daemon normally responds accordingly. (I have had gpg-agent linger along with it as well, and that successfully ignores SIGHUP. But that's a different story.)

So my question is: Why does gnome-keyring-daemon keep running after logging out for no apparent reason and how to resolve it, other than enabling KillUserProcesses.

Also, please note that this question is not related to the changes in systemd-230

2
  • 2
    Very nice question yet an other messy thing with systemd... this also happen if you run a script that call sleep or loop sleep (it get stuck and does not terminate)
    – intika
    May 15, 2019 at 1:48
  • 1
    Is there an answer for this? I'm having similar problems with non-terminating sessions on a multi-user computer. Jul 28, 2020 at 5:05

0

You must log in to answer this question.

Browse other questions tagged .