Why does shutdown time vary?
I always shut down my Ubuntu MATE 16.04 system in exactly the same way: I keep hitting alt+F4 until I get to the very last terminal window and all other applications have been exited, and then I type poweroff
Despite the consistency of my procedure, the time taken by the system to fully shut down (ie the amount of time I'm watching the splash screen) varies a lot, from about 3 seconds to about 25 seconds. Why does this happen, or how can I find out?
I know I can read the logs, but I would love some tips on how to analyse for this
From man 8 shutdown
:
Once TIME has elapsed, shutdown sends a request to the init(8) daemon
to bring the system down into the appropriate runlevel.
This is performed by emitting the runlevel(7) event, which includes the
new runlevel in the RUNLEVEL environment variable as well as the
previous runlevel (obtained from the environment or from /var/run/utmp)
in the PREVLEVEL variable. An additional INIT_HALT variable may be
set, this will contain the value HALT when bringing the system down for
halt and POWEROFF when bringing the system down for power off.
Then, each and every daemon process recognizes the change in RUNLEVEL, and takes appropriate action. This could be anything from a quick exit
to a configuration save to a cache flush or even a whole database freeze.
Depending on what level of logging you have set up for each daemon. you may see some information in /var/log/*
and subdirectories of /var/log/
.