Mail archive

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

From: Natanael Copa <>
Date: Mon, 27 Jul 2015 12:07:44 +0200

On Sun, 26 Jul 2015 12:10:26 +0200
Christoph Lohmann <> wrote:

> Greetings.
> Alan Pillay was asking me to join in on the discussion about Alpine Lin*
> ux needing a udev replacement to strive more towards a KISS future of
> this distribution.


Thanks for joing the discussion.
> I am the author of nldev and nlmon, which I am using personally on my
> Laptop. During this development my goal was to have a KISS solution to
> the udev mess and its abstraction layers. Well, the idea never complete*
> ly finished due to me being satisfied with what nldev and nlmon do and
> no reason to write the biggest threat to motivation: a libudev replace*
> ment.

Thanks for joining. I have been doing some experiments and are using
nldev code as base.

> I*m just describing how device management in Linux works now:


My conclusion is that /proc/sys/kernel/hotplug is a dead end for two

1) serialization. You can get race conditions. busybox mdev has some
workarounds for those but I think it is ugly. It is better solved with

2) performance. You can get a lot of forks during boot. Yes I know some
people does not care if the box take 60 seconds to boot. I do care, and
I believe it can be solved and still keep things simple.

However, using netlink has the drawback that it requires a forever
running daemon, and normally you only need it during bootup, and after
that, you need it seldomly, when you plug in an usb disk, a mouse or

> The KISS way I imagined would be this way: nldev not just
> executing mdev, but it caching the configuration file for the
> speedup. That*s what smdev tries to do but it does not implement all
> of the busybox mdev.conf syntax.

Here is what I have been thinking, and what came out of a long
discussion on busybox mailing list.

Implement the netlink daemon as a socket activator. When there is a new
event, fork/exec the handler and pass over the socket.

The handler reads the events from the socket and handles them. Set a
timout on the socket and exit when there are no events withing one or two
seconds. The socket activator takes over again.

I have this implemented, based on nldev code:

> For compatibility reasons the
> libudev*compat needs to be ripped off into a separate project so you
> don*t infect smdev with systemd code. The libudev compatibility is
> especially needed for and dynamic uevent device discovery.

This makes sense yes.

I am interested in libudev comaptibility, but have not looked too much
into it. I don't need full ABI compatibility, but it would be very
helpful to make it easy to port current applictions who uses libudev.

> What needs to be done for solving this udev problem once and for all
> and have a modular replacement:
> * Send in patches to smdev to have the complete busybox syntax
> mdev.conf implemented so all the mdev.conf examples out there can be
> reused.
> * Create a repository with all kind of mdev scripts so they can be
> reused.
> * Rip off libudev-compat from vdev and have it a separate package, if
> needed.

Alternatively, we could make an alternative xorg config backend. It
does not look too difficult:

> Please don*t use vdev. It does not follow the KISS principles and
> uses C++. The namespace for gid/uid is a big hack which should be
> in the kernel, as it is in Plan 9.

C++ is a no-go.

> I invite all interested developers to join suckless in its strive
> for a better KISS future and send patches to
> for the smdev[0] project or to implement the libudev*compat or join
> discussions on

I think it might make sense to do the mdev.conf parsing and event
handlig from either busybox or toybox. Those toolboxes also have things
like modprobe and blkid, which should make it possible to load
modaliases without fork/exec and find root=... on /proc/cmdline. (very
useful from initramfs)

> Sincerely,
> Christoph Lohmann
> [0]

Received on Mon Jul 27 2015 - 12:07:44 UTC