Mail archive
alpine-devel

Re: [alpine-devel] Re: udev replacement on Alpine Linux

From: Natanael Copa <ncopa_at_alpinelinux.org>
Date: Mon, 27 Jul 2015 12:00:52 +0200

On Sat, 25 Jul 2015 22:34:34 -0500
Rob Landley <rob_at_landley.net> wrote:

> On 07/25/2015 07:11 PM, Alan Pillay wrote:
> > Dear Alpine Linux developers and mailing-list lurkers,
> >
> > udev is currently being used on Alpine version 3.2.2, but we all know
> > it detracts from the philosophy to keep things simple, small and
> > efficient.
> > There are many programs out there that could replace udev and help
> > Alpine get in a better shape. I will list some that I know.
> >
> > [mdev] there are 2 mdev implementations that I know, busybox's and
> > toybox's. On Alpine Linux, busybox already comes installed by default
> > (and its mdev comes with it, which is weird since it isn't currently
> > used, but I digress)
>
> I'm the primary developer of toybox and the original author of busybox
> mdev, but busybox's mdev has grown a lot of new features over the years
> that toybox doesn't implement yet.

Busybox mdev has lots of feature/solutions for problems that I think
should not been there in first place. For example firmware loading, now
handled by kernel, device node creation could be handled by devtmpfs
(if we want be able to optionally use udev for Xorg we will need
devtmpfs anyway).

busybox mdev has also a solution for serialization of the
hotplug events, which I think is an ugly hack. Code could have been
simpler by just reading events from netlink.

> I'm happy to add them, but am mostly waiting for patches from the users
> telling me what they need. (My own embedded systems mostly just use
> devtmpfs, they don't tend to hotplug a lot of stuff.)

So what I have been thinking:

a netlink socket activator[1], which when there comes an event, fork
and execs a handler and passes over the the netlink socket.

The handler reads various events from netlink socket. It should be able
load kernel modules without forking, and ideally, it should be able to
handle each event without forking, including doing blkid lookups
without forking. After one or two seconds without any netlink event it
will exit and the socket activator takes over again.

There was a huge thread about netlink and mdev in busybox mailing list.
There were some strong opinions of making a more general read events
from any pipe, but I think that needlessly complicates things.

I am also interested in loading modules without forking, so I was
thinking of making modprobe read modaliases from a stream. Doing so in
busybox would require a major refactoring so I instead looked at using
libkmod for that. But then libkmod only works with binary format of
modaliases so busybox depmod needed a fix[2][3] to generate a binary
format of the indexes so libkmod can read those.

The current plan is to use nlsockd as socket activator, a netlink
reader[4] which will load kernel modules with libkmod and fork mdev -
but only on the relevant events - those who has DEVNAME set.
 
> If there's interest in my fleshing out toybox's mdev, I can bump it up
> the todo list, but I tend to be chronically overcommitted so need
> repeated poking...

What I might be interested in is making toybox mdev read events from a
netlink socket (stdin or other filedescriptor), add support for loading
modaliases without forking.


-nc

[1]: http://git.alpinelinux.org/cgit/user/ncopa/nlplug/tree/nlsockd.c
[2]: http://lists.busybox.net/pipermail/busybox/2015-July/083143.html
[3]: http://lists.busybox.net/pipermail/busybox/2015-July/083142.html
[4]: http://git.alpinelinux.org/cgit/user/ncopa/nlplug/tree/nlplug.c


---
Unsubscribe:  alpine-devel+unsubscribe_at_lists.alpinelinux.org
Help:         alpine-devel+help_at_lists.alpinelinux.org
---
Received on Mon Jul 27 2015 - 12:00:52 GMT