[systemd-devel] systemd-analyze for shutdown?

Lennart Poettering lennart at poettering.net
Fri May 27 16:32:53 UTC 2016


On Fri, 27.05.16 08:46, Nikolaus Rath (Nikolaus at rath.org) wrote:

> Hello,
> 
> Is there a way to run systemd-analyze for system shutdown, instead of
> boot-up?
> 
> I am pretty sure that my system takes way longer than it should to power
> off, but the "shutdown-log.txt" technique from
> https://freedesktop.org/wiki/Software/systemd/Debugging/#index2h1
> doesn't show anything obvious. So if there was a way to do
> e.g. "systemd-analyze blame" for shutdown, that would help a lot.

No, this is currently not available.

And it's not as easy to add actually. Note that systemd only keeps
units loaded as long as they are referenced by something else that is
loaded, are running, have failed, or have a job queued. That means if
a service is terminated at shutdown there's a very good chance it is
GC'ed away pretty quickly. Now, while systemd keeps timestamping info
around for services that tell us how long a service was running, took
to start or took to shut down all that info is lost the instant the
unit is GC'ed away...

To implement something like this we hence cannot just do what
"systemd-analyze blame" does, and iterate through the loaded units and
print their timestamp data, because most likely the units won't be
loaded anymore.

The right approach to implement this properly would probably be to log
the time data to the journal the instant a service is shut down, and
then make the tool read that back from the journal.

Anyway, for RFEs like this, please file an issue on github.

Lennart

-- 
Lennart Poettering, Red Hat


More information about the systemd-devel mailing list