@@ -6,7 +6,7 @@ LIC_FILES_CHKSUM = "file://COPYING.GPLv2;md5=ebb5c50ab7cab4baeffba14977030c07 \
DEPENDS = "udev libusb1 libplist libimobiledevice-glue"
-inherit autotools pkgconfig gitpkgv systemd
+inherit autotools pkgconfig gitpkgv systemd useradd
PKGV = "${GITPKGVTAG}"
PV = "1.1.2+git"
@@ -22,5 +22,18 @@ UPSTREAM_CHECK_COMMITS = "1"
EXTRA_OECONF += "--without-preflight"
FILES:${PN} += "${base_libdir}/udev/rules.d/"
+FILES:${PN} += "${nonarch_libdir}/sysusers.d"
SYSTEMD_SERVICE:${PN} = "usbmuxd.service"
+
+# 39-usbmuxd.rules carries OWNER="usbmux"; from systemd v258 udev drops the
+# whole rule line when the user does not exist, so the daemon is never
+# started. Create the account, and ship a sysusers.d fragment so it is also
+# recreated on systems whose /etc predates this recipe.
+USERADD_PACKAGES = "${PN}"
+USERADD_PARAM:${PN} = "--system --no-create-home --shell /bin/false --user-group usbmux"
+
+do_install:append() {
+ install -d ${D}${nonarch_libdir}/sysusers.d
+ printf 'u usbmux - "usbmux daemon"\n' > ${D}${nonarch_libdir}/sysusers.d/usbmuxd.conf
+}
usbmuxd ships 39-usbmuxd.rules, which starts the daemon when an Apple device appears: ACTION=="add", ..., OWNER="usbmux", ENV{SYSTEMD_WANTS}="usbmuxd.service" The recipe never creates that account. Up to systemd v257 udev only logged a warning and the rest of the line still ran. systemd a1ee55e3c9 ("udev-rules: ignore OWNER=/GROUP= with unknown user/group", first released in v258) makes udev drop the whole rule line instead, so SYSTEMD_WANTS is never applied and usbmuxd is never started when a device is plugged in. Creating the account is what the rule already expects, and it preserves the intent of the systemd change: that change guards against a rule naming a nonexistent user silently clearing a valid earlier ownership assignment, and with the account present there is no nonexistent user. Removing OWNER= from the rule would evade that check instead of satisfying it. The daemon still runs as root, so nothing else changes. Also ship a sysusers.d fragment. Systems that modified a user or password at runtime carry a copied-up /etc/passwd in a writable /etc, which masks an account added at image build time even after an update; systemd-sysusers recreates it there. The uid may then differ, but the udev rule resolves the account by name and the daemon runs as root, so only the name matters. Distros that keep /etc on persistent storage may also need systemd-sysusers to actually run on boot; that is outside the scope of this recipe. Signed-off-by: Eric Chiang <ericyunlinchiang@gmail.com> --- .../recipes-connectivity/usbmuxd/usbmuxd_git.bb | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-)