troglobit / finit

Fast init for Linux. Cookies included
https://troglobit.com/projects/finit/
MIT License
633 stars 63 forks source link

Plugin request, support launching mdevd as part of hotplug plugin #195

Closed hongkongkiwi closed 2 years ago

hongkongkiwi commented 3 years ago

I'm running mdevd rather than busybox mdev. It runs as a daemon and supports a few additional features in the config file.

Is it possible to add some compile time args to support different mdev loaders (such as mdevd?)

e.g. --with-mdev-daemon="/usr/bin/mdevd" --with-mdev-daemon-args="" --with-mdev-coldplug-cmd="/usr/bin/mdevd-coldplug"

I guess that mdevd behaves more like udev in the sense that it's a running daemon rather than a one off command.

Right now, since mdevd and mdev use a compatible config file, loading mdev at boot time picks up the same config. But that limits me to only using mdev compatible parts in the mdev.conf file.

troglobit commented 3 years ago

Anything's possible, but since we're not using mdevd ourselves, this feature extension would have to be done by a 3rd party and approved by us before allowing it in.

hongkongkiwi commented 2 years ago

To resolve my issue here, would it be enough to delete the modprobe module?

That way, I can run mdevd service then run modprobe myself using the postscript.

I don't see any flag at compile time to disable the modprobe module, so I was wondering if deleting it will cause any weird behaviour?

troglobit commented 2 years ago

Modprobe? That's for loading kernel modules (automatically), I think you mean the hotplug.so plugin, right? There's a --disable-hotplug-plugin for this. Hope that helps :)

troglobit commented 2 years ago

See #270 for the discussion related to this. A first prototype is available here https://github.com/hongkongkiwi/finit/blob/master/plugins/mdevd.c

troglobit commented 2 years ago

Initial import of mdevd plugin to Finit mainline in d6f3590.

I'm however concerned with the way mdevd is started, and in particular how mdevd-coldplug later called, so I'll be looking into a notification mechanism similar to that of s6 to see if we can synchronize these two a bit better in the future. If my ideas hold up I think we can even consider replacing this plugin with a .conf file snippet. I'll let you know :)

hongkongkiwi commented 2 years ago

Perfect, actually I really like the s6 readiness mechanism, I think it's clever and simple. Quite easy to support for custom programs and can provide better status's.

Yea, I'm quite keen to do away with plugins in the core like this. The less custom code the better ;) (excluding custom plugins in other repo ofcourse).

troglobit commented 2 years ago

My hope is to fold in support for the systemd sd_notify() as well in this notify thing, the ideas are similar and for "I'm ready" it seems both systemd and s6 are quite similar (s6 ignores everything sent before newline, so READY=1\n is interpreted the same).

Thank you, my colleague Tobias shares that sentiment :)