#1098212 Please add a postinst step to create the netdev group

Package:
iwd
Source:
iwd
Description:
wireless daemon for Linux
Submitter:
Philip Stewart
Date:
2025-02-18 09:51:01 UTC
Severity:
normal
#1098212#5
Date:
2025-02-17 19:41:51 UTC
From:
To:
Hello,

During startup I see: dbus-daemon[1012]: dbus[1012]: Unknown group
"netdev" in message bus configuration file

I believe this is due to policy group in
/usr/share/dbus-1/system.d/iwd-dbus.conf:

<policy group="netdev">
  ...
</policy>

Following [1], I understand a postinst step needs to be added to
create the netdev group, if not already present:

+    # create the netdev group used by dbus
+    if ! getent group netdev > /dev/null; then
+        addgroup --quiet --system netdev
+    fi

Thanks,
Phil

[1] https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=385495#22

#1098212#10
Date:
2025-02-17 23:10:20 UTC
From:
To:
I cant comment if you need the group or not, but:

You don't need the getent group check here.
  addgroup --quiet --system netdev
should be enough.

Chris

#1098212#15
Date:
2025-02-18 09:49:44 UTC
From:
To:
From: Matthieu Baerts <matttbe@kernel.org>

Similar to wpasupplicant and NetworkManager, this group is used in the
D-Bus policy, see the file src/iwd-dbus.conf.

A new post-install step is added, simply to create the netdev group.
Note that 'addgroup' will return the exit code 0 if the group has been
successfully created, or if it already exists.

'adduser' is then now needed to create the new group.

Closes: https://bugs.debian.org/1098212
Reported-by: Philip Stewart <philip.stewart.public@gmail.com>
Suggested-by: Chris Hofstaedtler <zeha@debian.org>
Signed-off-by: Matthieu Baerts <matttbe@kernel.org>
---
 debian/control      |  1 +
 debian/iwd.postinst | 36 ++++++++++++++++++++++++++++++++++++
 2 files changed, 37 insertions(+)
 create mode 100644 debian/iwd.postinst

diff --git a/debian/control b/debian/control
index e52e3bdb..5a5a8856 100644
--- a/debian/control
+++ b/debian/control
@@ -21,6 +21,7 @@ Architecture: linux-any
 Depends:
  ${misc:Depends},
  ${shlibs:Depends},
+ adduser,
 Recommends:
  dbus | dbus-system-bus,
  wireless-regdb,
diff --git a/debian/iwd.postinst b/debian/iwd.postinst
new file mode 100644
index 00000000..f2720bf7
--- /dev/null
+++ b/debian/iwd.postinst
@@ -0,0 +1,36 @@
+#!/bin/sh
+
+set -e
+
+# This script can be called in the following ways:
+#
+# After the package was installed:
+#	<postinst> configure <old-version>
+#
+#
+# If prerm fails during upgrade or fails on failed upgrade:
+#	<old-postinst> abort-upgrade <new-version>
+#
+# If prerm fails during deconfiguration of a package:
+#	<postinst> abort-deconfigure in-favour <new-package> <version>
+#	           removing <old-package> <version>
+#
+# If prerm fails during replacement due to conflict:
+#	<postinst> abort-remove in-favour <new-package> <version>
+
+case "$1" in
+    configure)
+        # Create netdev group used in the D-Bus policy. No error if it exists.
+        addgroup --quiet --system netdev
+        ;;
+
+    abort-upgrade|abort-deconfigure|abort-remove)
+        ;;
+
+    *)
+        echo "$0 called with unknown argument \`$1'" 1>&2
+        exit 1
+        ;;
+esac
+
+#DEBHELPER#