[systemd-devel] A way to debug machine shutdown

Lennart Poettering lennart at poettering.net
Tue Jun 16 08:33:42 UTC 2020


On Di, 16.06.20 11:22, darkpenguin (darkpenguin at yandex.com) wrote:

> I would be able to figure it out if systemd told me what is going on.
> This is my main point - maybe it should tell us immediately that "this
> process is stalling the shutdown" or "this thing reloads me too much"?
> And ideally "...Do you want to kill it?".

Uh, interactivity during shutdown is not something I even want to
start with.

Thing is, systemd actually does tell you that, it tells you whcih
session is at fault. I understand you'd want more finegrained info at
that point, and we place that in the logs. Now, in your system there's
a tonload going on, so it's hard to figure out what is the actual
culprit, but you can't hardly complain we give you too few logs, we
give you rather too many...

Anyway we can certainly extend the console status output at shutdown
to show offending processes, but it's not trivial to do so: the thing
is that system shutdown is handled by PID 1, it shuts down all system
services. One of which is your user's service manager, i.e. the
systemd --user instance. Now, if we blindly tell you that it is not
exiting, you might then complain that systemd is at fault, but
actually it is a service under the systemd --user's supervision that
is at fault. But that relationship is something only the systemd
--user instance understands. Now, we could of course ask `systemd
--user` for the output, but that means we'd allow unpriv programs to
log to the system console just like that, which I find highly
problematic...

So, it's not an easy problem. If we indeed want to show more info on
the system console if user programs misbheave during shutdown we need
to figure out a safe way how to do that, that cannot be gamed by said
users to output whatever they want onto the console.

Lennart

--
Lennart Poettering, Berlin


More information about the systemd-devel mailing list