[systemd-devel] Has systemd booted up command

Lennart Poettering lennart at poettering.net
Thu Jul 18 10:06:53 PDT 2013


On Thu, 18.07.13 10:08, Umut Tezduyar (umut at tezduyar.com) wrote:

> Hi,
> 
> This is in reference to
> https://bugs.freedesktop.org/show_bug.cgi?id=66926 request.
> 
> I have been polling systemd with  "systemctl is-active default.target"
> to detect if boot up has been completed or not. I have noticed that
> this is not enough though.
> 
> It seems like starting a service that is not part of the initial job
> tree can keep in state activating after default.target is reached. I
> could use systemctl list-jobs to detect if there are still jobs
> available but systemctl list-jobs's output is not meant for
> programming.
> 
> Same problem happens when I switch targets. Currently I rely on
> systemctl list-jobs output to detect if the target switch has been
> completed or not.
> 
> What can we do about it?
> 
> One way would be having a command "systemctl job-count", other would
> be having a command "systemctl has-booted" or something similar?
> 
> Any thoughts?

systemctl job-count is available in "systemctl show -p NJobs". You can
query this property easily via D-Bus too.

It should be relatively easy to write a tool that waits for the boot to
"complete", as we send out a StartupFinished signal in that case, and
"systemctl show -p Progress" will tell you as a fractional between 0 and
1 how far the boot completed so far. However, the problem I have with
adding this is the weak definition of "finished start-up". For example,
StartupFinished is actually sent out as soon as the job queue ran empty
for the first time (i.e. NJobs is 0). But you already want something
slightly different there, and also wait for some later jobs? And of
course, such a concept still wouldn't include desktop initialization times and
suchlike, so I am not totally convinced we could find an approach that
is sufficientlly well-defined that it works for most people, not just
some. If you follow what I mean...

Lennart

-- 
Lennart Poettering - Red Hat, Inc.


More information about the systemd-devel mailing list