[systemd-devel] systemd-bootchart, switch-root breakage

James Muir (jamesmui) jamesmui at cisco.com
Fri Jan 3 20:21:54 UTC 2025


Is anyone else using systemd-bootchart on a system that boots using an initial ramdisk?  (e.g. like Fedora 41)

I am fighting with two issues and am looking for some advice.


**1. systemd-bootchart stops too early**

According to “man systemd-bootchart”, the recommended way to invoke bootchart is via a kernel parameter:

  init=/usr/lib/systemd/systemd-bootchart

That parameter causes systemd-bootchart to be executed as the new init process when we switch into the real root filesystem.

bootchart does run, but it stops too early.

In /etc/systemd/bootchart.conf, I have bootchart configured to collect 1800 samples at a frequency of 10 samples per sec.  It should run for about 3 minutes.

When I login, the svg file is already present under /run/log (but the system has only been up for about 10 secs).

Doing “grep bootchart /proc/*/cmdline” when I login shows that bootchart is not running.


**2. systemd-bootchart errors out during switch root**

In this case, I have systemd-bootchart added to the initial ramdisk and execute it via the “rdinit” kernel parameter:

  rdinit=/usr/lib/systemd/systemd-bootchart

In the systemd-bootchart source, you can see that the first character of its argv[0] is changed to “@”, so bootchart should survive the switch-root killing spree.

Unfortunately, bootchart errors out during switch root because it wants to read /proc/schedstat and it is not available (I have an strace log confirming that).

There seems to be a time-of-check / time-of-use issue in the code -- it checks that the proc filesystem is available, but then when it goes to read /proc/schedstat the file is not there (ENOENT).


Has anyone else come across these?

Should I open github issues?

I can try creating a PR to fix issue 2.

Thanks,

-James M

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/systemd-devel/attachments/20250103/da110727/attachment.htm>


More information about the systemd-devel mailing list