Skip to content

main/mdevd: make it a fully supported alternative to mdev

Laurent Bercot requested to merge skarnet/aports:mdevd.20220128 into master

The mdevd package has existed on Alpine for a while, but due to the integration of mdev in busybox, mdevd was a second-class citizen and it was basically impossible to disable mdev. Also, udev, needed by cloud-init and some other packages, was kinda shoehorned in an ad-hoc and hackish way, working awkwardly alongside mdev and having a special setup-udev that worked differently from other setup scripts.

This PR evens the field, making it possible for the user to choose between mdev, mdevd or udev as their device manager of choice. (mdev is still the one used by default.)

To achieve this, we split the busybox-initscripts package, which previously contained all the mdev mechanism and policy. We move mdev stuff into two packages:

  • mdev-conf, which contains /etc/mdev.conf and related helper scripts. This is used by both mdev and mdevd.
  • mdev-openrc, which contains the /etc/init.d/mdev script. No, there is no mdev package, since mdev is still a part of busybox.

busybox-initscripts still contains all the remaining misc junk that is necessary to start the services whose daemons are provided by busybox. Properly cleaning it up is a task for another day.

Then we move the mdevd package to main, and give it an mdevd-openrc subpackage. There are now two services: the mdevd longrun, and an mdevd-init oneshot, performing the coldplug (the equivalent of mdev -s, but a complete coldplug so it doesn't need extra scripting).

alpine-base depends on busybox-initscripts; we removed the device manager from busybox-initscripts, but we need to make alpine-base depend on a device manager so users always have a device manager installed by default. So we make mdev-openrc, mdevd-openrc and udev-init-scripts-openrc all provide the dev-initscripts virtual package, and conflict between one another. Then we make alpine-base depend on dev-initscripts.

After this merge, people can only have one -openrc of either mdev, mdevd or udev-init-scripts. In order to switch between them, they can use the new setup-devd program, provided in version 3.14.0 of alpine-conf. setup-devd is called by setup-alpine at distro install time and sets mdev as the default, so nothing changes without explicit user request.

We remove the ad-hoc setup-udev program from main/eudev, and replace all its uses with proper setup-devd invocations.

After this merge, mdev, mdevd and udev can be used interchangeably in a symmetrical way. Nothing has changed for users who don't care. Users who want mdevd can have it in a fully integrated way; the way is paved for making it possible to run X with mdevd + libudev-zero instead of udev, as a fully supported configuration.

Merge request reports