From:
systemd-devel <systemd-devel-bounces@xxxxxxxxxxxxxxxxxxxxx> on behalf of Brian Masney <bmasney@xxxxxxxxxx>
Date: Thursday, 26 September 2024 at 03:07
To: Dharma.B@xxxxxxxxxxxxx <Dharma.B@xxxxxxxxxxxxx>
Cc: serenissi@xxxxxxxxxxxxx <serenissi@xxxxxxxxxxxxx>, systemd-devel@xxxxxxxxxxxxxxxxxxxxx <systemd-devel@xxxxxxxxxxxxxxxxxxxxx>
Subject: Re: Exploring Minimal Systemd in Initramfs for Faster Boot
On Wed, Sep 25, 2024 at 03:53:36PM +0000, Dharma.B@xxxxxxxxxxxxx wrote:
> yes something similar to this, I will experiment this and get back to you.
>
> and I think since the egt service and its libraries depend on the full
> rootfs, integrating initramfs might not provide significant benefits in
> terms of faster launch time. The time saved by using an initramfs to
> launch basic services earlier would likely be offset by the delay in
> mounting the root filesystem, which is necessary for accessing the egt
> libraries.
There are some drawbacks to putting your early service in the initramfs
and having it persist across the switch root to when systemd is started
again from the root filesystem.
- The initrd is a cpio archive, and increasing the size of the initrd is
going to increase the kernel boot time since it will need to
uncompress and extract the larger cpio archive.
- Any services started from the initrd will be started before the
SELinux policy is loaded. Services started from the initrd will run
with the kernel_t label.
- Services started from the initrd can't depend on almost anything like
mounts, devices, services, dbus, etc so it's difficult to develop
software of any complexity.
- Adding all of these dependencies to the initrd is only going to move
the timing bottlenecks booting from the root filesystem to the initrd.
- Directives like Restart=always will likely not work as expected.
Personally I think that you should have the initramfs be small enough to
only get you to the root filesystem and start your early service from
the root filesystem.
Shameless self plug: Here's a presentation that I gave last month at
DevConf.us in Boston with Eric Curtin and Ed Chong about some of the
boot speed optimizations that a group of us worked on at Red Hat:
https://pretalx.com/devconf-us-2024/talk/HXVPHC/ . The talk also
lists some upstream patch sets that you will want to consider
including in your kernel to help with boot time.
Brian