[systemd-devel] Custom initrd services

Carolina Jubran cjubran at nvidia.com
Thu Jun 13 16:20:21 UTC 2024


>> Hello!
>>
>> I have modules that need to be loaded using services because some of
>> them don't autoload their modules.

>"Modules"? do you mean kmod kernel modules with that?

Yes
>> I want the modules to load in initrd, before initrd.target. However,
>> the service is not consistently loading in initrd in the current
>> implementation.

>If you have kernel modules that to not autoload, it should typically
>suffice to add any kernel modules to a file in /etc/modules-load.d/ in
>the initrd.
The load of the modules is based on hardware presence, that's why we dont use modules-load.d.
>That said, in 2024 kernel modules that do not autoload seems quite out
>of place.

Many of these issues have been fixed in recent years, but we still haven't addressed everything.

>> To resolve this issue, I added "systemctl add-wants initrd.target
>> A.service" in the dracut configuration.

>Hmm, I don't follow? what would such a line do to kernel modules?

>> Is this sufficient for my setup, or do I need to make any further
>> changes in the systemd side to ensure the correct loading before
>> initrd.target? I'm using systemd-load-modules to load the modules.

>I am not sure I follow really. That service that needs the kernel
>modules, what kind f service is that?

We are trying to load these modules using the service:
[Service]
Type=oneshot
RemainAfterExit=yes
ExecStart=/lib/systemd/systemd-modules-load /etc/rdma/modules/%I.conf
TimeoutSec=90s

The service itself doesn't use the modules.
>Note that services can add the followng to their deps:

 >   Wants=modprobe at foobar.service
 >  After=modprobe at foobar.service

>To ensure the kmod "foobar" is definitely loaded before the service
>begins execution.

>Lennart

>--
>Lennart Poettering, Berlin

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


More information about the systemd-devel mailing list