[systemd-devel] switch-root, init, SIGHUP
James Muir (jamesmui)
jamesmui at cisco.com
Tue Jan 21 17:02:12 UTC 2025
> > I think the SIGHUP must come from the new PID 1.
>
> I don't know if this will help you, however here is a program that I
> wrote last year that starts a service in the initramfs, it survives
> the systemd killing spree during the transition to the root
> filesystem, a new copy of the program is started from the root
> filesystem, the previous running state is passed from the initramfs to
> the version started from the root filesystem, and the version started
> from the initramfs is gracefully shut down. The program does not have
> the SIGHUP issue that you describe, so maybe there's something here
> that may help you.
>
> https://github.com/masneyb/early-service-example
Thanks very much for this pointer!
I will take a closer look at your code since I would indeed prefer to start my process (and systemd-bootchart) in the initrd.
I had tried doing that using "rdinit=" and did observe that the SIGHUP problem does not occur in that case (btw, it is SIGHUP followed by SIGCONT).
For systemd-bootchart, after it does some initial set-up, it only reads files under /proc (and it keeps a directory stream to /proc open).
Unfortunately, the switch-root operation somehow causes /proc/schedstat to become inaccessible, so systemd-bootchart is broken with "rdinit=" as well.
-James M
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/systemd-devel/attachments/20250121/2d210698/attachment-0001.htm>
More information about the systemd-devel
mailing list