[systemd-devel] How to reduce time to between Linux’ `run_init_process()` and systemd banner?

Paul Menzel pmenzel+systemd-devel at molgen.mpg.de
Fri Jul 13 18:20:19 UTC 2018


Dear systemd folks,


Trying to decrease the boot time, I got rid of the initrd. Now, there
is a noticeable delay between Linux `run_init_process()` and the first
systemd message.

I added an output line to the Linux function.

```
static int run_init_process(const char *init_filename)
{
         argv_init[0] = init_filename;

         pr_info("Run %s as init process\n", init_filename);
         return do_execve(getname_kernel(init_filename),
                 (const char __user *const __user *)argv_init,
                 (const char __user *const __user *)envp_init);
}
```

Here you see the result on a system (ASRock E350M1) with an SDD
(spinning).

```
[    0.287632] Run /sbin/init as init process
[    0.547261] systemd[1]: systemd 239 running in system mode. (+PAM 
+AUDIT +SELINUX +IMA +APPARMOR +SMACK +SYSVINIT +UTMP +LIBCRYPTSETUP 
+GCRYPT +GNUTLS +ACL +XZ +LZ4 +SECCOMP +BLKID +ELFUTILS +KMOD -IDN2 +IDN 
-PCRE2 default-hierarchy=hybrid)
```

The systemd binary is only 2.3 MB in size, so I do not think that
this is the loading time.

     $ ls -lh /lib/systemd/systemd
     -rwxr-xr-x 2 root root 2.3M Mar 12 13:44 /lib/systemd/systemd

Is there a way, to get a message from systemd as early as possible
to see where the time is spent?

`log_execution_mode(&first_boot)` is not at the beginning in
`main()` in `src/core/main.c`. I guess the “console” needs to be
set up first?

Any help is appreciated.


Kind regards,

Paul


More information about the systemd-devel mailing list