Skip to contentSkip to conversation

Add User Fixes

GIT PULL Saul Wold 3 participants 11 messages Nov 2, 2011 – Nov 3, 2011

lore
Share & tools
lore

Saul Wold

author
#0 lore raw

Richard,

Hope that third times the charm!

Fixes 1699, additional commit comments, fixed whitespace.

Sau!

The following changes since commit d0a2c87d068f2d769d47c8455bb1434b90a7a844:

Fix HOMEPAGE values in libzypp and sat-solver .bb files (2011-11-01 18:28:06 +0000)

are available in the git repository at:
git://git.openembedded.org/openembedded-core-contrib sgw/fix
http://cgit.openembedded.org/cgit.cgi/openembedded-core-contrib/log/?h=sgw/fix

Saul Wold (4):
avahi: use useradd to create avahi user for avahi-daemon
xserver-nodm-init: Use useradd to add the xuser for rootless X
connman: Use useradd to add the xuser for DBus
dbus: ensure that the useradd shell is set to /bin/false

 meta/recipes-connectivity/avahi/avahi.inc          |   16 ++++++-----
 meta/recipes-connectivity/connman/connman.inc      |    7 ++++-
 meta/recipes-connectivity/connman/connman_0.75.bb  |    2 +-
 meta/recipes-core/dbus/dbus.inc                    |    3 +-
 .../x11-common/xserver-nodm-init.bb                |   28 +++++++------------
 5 files changed, 28 insertions(+), 28 deletions(-)
Signature · 1 line
1.7.6.4
author
#1 lore raw

[Pull v3 1/4] avahi: use useradd to create avahi user for avahi-daemon

DBus was failing to start correct since the avahi user was not setup.

Keep the dbus reload since this could still be installed as a package an would require a dbus restart.

Fixes [YOCTO #1699]
---
 meta/recipes-connectivity/avahi/avahi.inc |   16 +++++++++-------
 1 files changed, 9 insertions(+), 7 deletions(-)
meta/recipes-connectivity/avahi/avahi.inc +9 -7
index 5ad9db0..79cfd73 100644
@@ -14,7 +14,7 @@ SECTION = "network"
 # python scripts are under GPLv2+
 LICENSE = "GPLv2+ & LGPLv2.1+"
 
-INC_PR = "r8"
+INC_PR = "r9"
 
 DEPENDS = "expat libcap libdaemon dbus glib-2.0"
 
@@ -23,7 +23,12 @@ SRC_URI = "http://avahi.org/download/avahi-${PV}.tar.gz \
           file://99avahi-autoipd \
           file://initscript.patch"
 
-inherit autotools pkgconfig update-rc.d gettext
+USERADD_PACKAGES = "${PN}-daemon"
+USERADD_PARAM_${PN}-daemon = "--system --home /var/run/avahi-daemon \
+                              --no-create-home --shell /bin/false \
+                              --user-group avahi"
+
+inherit autotools pkgconfig update-rc.d gettext useradd
 
 EXTRA_OECONF = "--with-distro=debian \
              --disable-introspection \
@@ -116,15 +121,12 @@ do_install_avahi-autoipd() {
 	install ${WORKDIR}/99avahi-autoipd ${D}${sysconfdir}/udhcpc.d
 }
 
-# At the time the postinst runs, dbus might not be setup so only restart if running
+# At the time the postinst runs, dbus might not be setup so only restart if running 
 
 pkg_postinst_avahi-daemon () {
-	# can't do this offline
 	if [ "x$D" != "x" ]; then
-		exit 1
+		exit 0
 	fi
-	grep "^avahi:" /etc/group > /dev/null || addgroup avahi
-	grep "^avahi:" /etc/passwd > /dev/null || adduser --disabled-password --system --home /var/run/avahi-daemon --no-create-home avahi --ingroup avahi -g Avahi
 
 	DBUSPID=`pidof dbus-daemon`
 
Signature · 1 line
1.7.6.4
#2 lore raw

Re: [Pull v3 1/4] avahi: use useradd to create avahi user for avahi-daemon

Op 2 nov. 2011, om 01:21 heeft Saul Wold het volgende geschreven:

Quoted 5 lines

DBus was failing to start correct since the avahi user was not setup.

Keep the dbus reload since this could still be installed as a package an would require a dbus restart.

This doesn't seem to work for me, I keep getting "Unknown username 'avahi' in message bus configuration file"

Quoted 38 lines
Fixes [YOCTO #1699]

---
meta/recipes-connectivity/avahi/avahi.inc | 16 +++++++++-------

1 files changed, 9 insertions(+), 7 deletions(-)
meta/recipes-connectivity/avahi/avahi.inc +0 -0
index 5ad9db0..79cfd73 100644
@@ -14,7 +14,7 @@ SECTION = "network"
 # python scripts are under GPLv2+

LICENSE = "GPLv2+ & LGPLv2.1+"

meta/recipes-connectivity/avahi/avahi.inc +1 -1
-INC_PR = "r8"
+INC_PR = "r9"

DEPENDS = "expat libcap libdaemon dbus glib-2.0"

meta/recipes-connectivity/avahi/avahi.inc +6 -1
@@ -23,7 +23,12 @@ SRC_URI = "http://avahi.org/download/avahi-${PV}.tar.gz \
          file://99avahi-autoipd \
          file://initscript.patch"
 
-inherit autotools pkgconfig update-rc.d gettext
+USERADD_PACKAGES = "${PN}-daemon"
+USERADD_PARAM_${PN}-daemon = "--system --home /var/run/avahi-daemon \
+                              --no-create-home --shell /bin/false \
+                              --user-group avahi"
+
+inherit autotools pkgconfig update-rc.d gettext useradd
 
 EXTRA_OECONF = "--with-distro=debian \
             --disable-introspection \
@@ -116,15 +121,12 @@ do_install_avahi-autoipd() {
 	install ${WORKDIR}/99avahi-autoipd ${D}${sysconfdir}/udhcpc.d
 }

meta/recipes-connectivity/avahi/avahi.inc do_install_avahi-autoipd() { · line 129

Quoted 10 lines
meta/recipes-connectivity/avahi/avahi.inc +2 -3
 
-# At the time the postinst runs, dbus might not be setup so only restart if running
+# At the time the postinst runs, dbus might not be setup so only restart if running 
 
 pkg_postinst_avahi-daemon () {
-	# can't do this offline
 	if [ "x$D" != "x" ]; then
-		exit 1
+		exit 0
 	fi

Removing that check completely would be a better idea :)

regards,

Koen

#3 lore raw

Re: [Pull v3 1/4] avahi: use useradd to create avahi user for avahi-daemon

Op 3 nov. 2011, om 13:23 heeft Koen Kooi het volgende geschreven:

Quoted 10 lines

Op 2 nov. 2011, om 01:21 heeft Saul Wold het volgende geschreven:

Quoted 5 lines

DBus was failing to start correct since the avahi user was not setup.

Keep the dbus reload since this could still be installed as a package an would require a dbus restart.

This doesn't seem to work for me, I keep getting "Unknown username 'avahi' in message bus configuration file"

Manually running the preinst on the target *does* work, so something isn't right during do_rootfs.

regards,

Koen

Quoted 56 lines
Quoted 40 lines
Fixes [YOCTO #1699]

---
meta/recipes-connectivity/avahi/avahi.inc | 16 +++++++++-------

1 files changed, 9 insertions(+), 7 deletions(-)
meta/recipes-connectivity/avahi/avahi.inc +0 -0
index 5ad9db0..79cfd73 100644
@@ -14,7 +14,7 @@ SECTION = "network"
 # python scripts are under GPLv2+

LICENSE = "GPLv2+ & LGPLv2.1+"

meta/recipes-connectivity/avahi/avahi.inc +1 -1
-INC_PR = "r8"
+INC_PR = "r9"

DEPENDS = "expat libcap libdaemon dbus glib-2.0"

meta/recipes-connectivity/avahi/avahi.inc +6 -1
@@ -23,7 +23,12 @@ SRC_URI = "http://avahi.org/download/avahi-${PV}.tar.gz \
         file://99avahi-autoipd \
         file://initscript.patch"
 
-inherit autotools pkgconfig update-rc.d gettext
+USERADD_PACKAGES = "${PN}-daemon"
+USERADD_PARAM_${PN}-daemon = "--system --home /var/run/avahi-daemon \
+                              --no-create-home --shell /bin/false \
+                              --user-group avahi"
+
+inherit autotools pkgconfig update-rc.d gettext useradd
 
 EXTRA_OECONF = "--with-distro=debian \
            --disable-introspection \
@@ -116,15 +121,12 @@ do_install_avahi-autoipd() {
 	install ${WORKDIR}/99avahi-autoipd ${D}${sysconfdir}/udhcpc.d
 }

meta/recipes-connectivity/avahi/avahi.inc do_install_avahi-autoipd() { · line 129

Quoted 10 lines
meta/recipes-connectivity/avahi/avahi.inc +2 -3
 
-# At the time the postinst runs, dbus might not be setup so only restart if running
+# At the time the postinst runs, dbus might not be setup so only restart if running 
 
 pkg_postinst_avahi-daemon () {
-	# can't do this offline
 	if [ "x$D" != "x" ]; then
-		exit 1
+		exit 0
 	fi

Removing that check completely would be a better idea :)

regards,

Koen

#4 lore raw

Re: [Pull v3 1/4] avahi: use useradd to create avahi user for avahi-daemon

Op 3 nov. 2011, om 13:38 heeft Koen Kooi het volgende geschreven:

Quoted 9 lines

Op 3 nov. 2011, om 13:23 heeft Koen Kooi het volgende geschreven:

Quoted 6 lines

Op 2 nov. 2011, om 01:21 heeft Saul Wold het volgende geschreven:

Quoted 3 lines

DBus was failing to start correct since the avahi user was not setup.

Quoted 6 lines
Quoted 4 lines
Quoted 2 lines

Keep the dbus reload since this could still be installed as a package an would require a dbus restart.

This doesn't seem to work for me, I keep getting "Unknown username 'avahi' in message bus configuration file"

Manually running the preinst on the target *does* work, so something isn't right during do_rootfs.

+ sh /OE/tentacle/build/tmp-angstrom_2010_x-eglibc/work/beaglebone-angstrom-linux-gnueabi/systemd-image-1.0-r0/rootfs/var/lib/opkg/info/avahi-daemon.preinst Running useradd commands...
grep: /OE/tentacle/build/tmp-angstrom_2010_x-eglibc/work/beaglebone-angstrom-linux-gnueabi/systemd-image-1.0-r0/rootfs/etc/passwd: No such file or directory
useradd: group '1000' does not exist
useradd: the GROUP= configuration in /etc/default/useradd will be ignored
useradd: user 'avahi' already exists

I think I know what's going wrong, patch coming soon!

#5 lore raw

Re: [Pull v3 1/4] avahi: use useradd to create avahi user for avahi-daemon

In reply to Koen Kooi
Quoted 10 lines · Koen Kooi

Op 2 nov. 2011, om 01:21 heeft Saul Wold het volgende geschreven:

Quoted 5 lines

DBus was failing to start correct since the avahi user was not setup.

Keep the dbus reload since this could still be installed as a package an would require a dbus restart.

This doesn't seem to work for me, I keep getting "Unknown username 'avahi' in message bus configuration file"

From where? On target device upgrade? do_rootfs? populate_sysroot? More info would be useful here.

Quoted 41 lines
Quoted 41 lines
Fixes [YOCTO #1699]

---
meta/recipes-connectivity/avahi/avahi.inc | 16 +++++++++-------

1 files changed, 9 insertions(+), 7 deletions(-)
meta/recipes-connectivity/avahi/avahi.inc +0 -0
index 5ad9db0..79cfd73 100644
@@ -14,7 +14,7 @@ SECTION = "network"
 # python scripts are under GPLv2+

LICENSE = "GPLv2+ & LGPLv2.1+"

meta/recipes-connectivity/avahi/avahi.inc +1 -1
-INC_PR = "r8"
+INC_PR = "r9"

DEPENDS = "expat libcap libdaemon dbus glib-2.0"

meta/recipes-connectivity/avahi/avahi.inc +7 -2
@@ -23,7 +23,12 @@ SRC_URI = "http://avahi.org/download/avahi-${PV}.tar.gz \
          file://99avahi-autoipd \
          file://initscript.patch"
 
-inherit autotools pkgconfig update-rc.d gettext
+USERADD_PACKAGES = "${PN}-daemon"
+USERADD_PARAM_${PN}-daemon = "--system --home /var/run/avahi-daemon \
+                              --no-create-home --shell /bin/false \
+                              --user-group avahi"
+
+inherit autotools pkgconfig update-rc.d gettext useradd
 
 EXTRA_OECONF = "--with-distro=debian \
             --disable-introspection \
@@ -116,15 +121,12 @@ do_install_avahi-autoipd() {
 	install ${WORKDIR}/99avahi-autoipd ${D}${sysconfdir}/udhcpc.d
 }
 
-# At the time the postinst runs, dbus might not be setup so only restart if running
+# At the time the postinst runs, dbus might not be setup so only restart if running 
 
Quoted 8 lines

meta/recipes-connectivity/avahi/avahi.inc do_install_avahi-autoipd() { · line 129

Quoted 6 lines
meta/recipes-connectivity/avahi/avahi.inc +1 -2
 pkg_postinst_avahi-daemon () {
-	# can't do this offline
 	if [ "x$D" != "x" ]; then
-		exit 1
+		exit 0
 	fi

Removing that check completely would be a better idea :)

No it wouldn't, if we're installing this at do_rootfs time, we can just mark the postinstall as done.

Cheers,

Richard

#6 lore raw

Re: [Pull v3 1/4] avahi: use useradd to create avahi user for avahi-daemon

Op 3 nov. 2011, om 13:39 heeft Richard Purdie het volgende geschreven:

Quoted 6 lines · Koen Kooi
Quoted 5 lines

Op 2 nov. 2011, om 01:21 heeft Saul Wold het volgende geschreven:

Quoted 3 lines

DBus was failing to start correct since the avahi user was not setup.

Quoted 8 lines
Quoted 5 lines
Quoted 2 lines

Keep the dbus reload since this could still be installed as a package an would require a dbus restart.

This doesn't seem to work for me, I keep getting "Unknown username 'avahi' in message bus configuration file"

From where? On target device upgrade? do_rootfs? populate_sysroot? More info would be useful here.

On target device boot. I've narrowed it down to an RDEPENDS problem, I'm working out the correct cycle of _append and += now

The basic problem:

Package: avahi-daemon
Version: 0.6.30-r9.0
[..]
Depends: libavahi-core7 (>= 0.6.30), libdaemon0 (>= 0.14), libcap2 (>= 2.22), libavahi-common3 (>= 0.6.30), libdbus-1-3 (>= 1.4.12), sysvinit-pidof, libc6 (>= 2.12), libexpat1 (>= 2.0.1)

No 'base-passwd' in there.

Quoted 63 lines
Quoted 42 lines
Quoted 42 lines
Fixes [YOCTO #1699]

---
meta/recipes-connectivity/avahi/avahi.inc | 16 +++++++++-------

1 files changed, 9 insertions(+), 7 deletions(-)
meta/recipes-connectivity/avahi/avahi.inc +0 -0
index 5ad9db0..79cfd73 100644
@@ -14,7 +14,7 @@ SECTION = "network"
 # python scripts are under GPLv2+

LICENSE = "GPLv2+ & LGPLv2.1+"

meta/recipes-connectivity/avahi/avahi.inc +1 -1
-INC_PR = "r8"
+INC_PR = "r9"

DEPENDS = "expat libcap libdaemon dbus glib-2.0"

meta/recipes-connectivity/avahi/avahi.inc +7 -2
@@ -23,7 +23,12 @@ SRC_URI = "http://avahi.org/download/avahi-${PV}.tar.gz \
         file://99avahi-autoipd \
         file://initscript.patch"
 
-inherit autotools pkgconfig update-rc.d gettext
+USERADD_PACKAGES = "${PN}-daemon"
+USERADD_PARAM_${PN}-daemon = "--system --home /var/run/avahi-daemon \
+                              --no-create-home --shell /bin/false \
+                              --user-group avahi"
+
+inherit autotools pkgconfig update-rc.d gettext useradd
 
 EXTRA_OECONF = "--with-distro=debian \
            --disable-introspection \
@@ -116,15 +121,12 @@ do_install_avahi-autoipd() {
 	install ${WORKDIR}/99avahi-autoipd ${D}${sysconfdir}/udhcpc.d
 }
 
-# At the time the postinst runs, dbus might not be setup so only restart if running
+# At the time the postinst runs, dbus might not be setup so only restart if running 
 
Quoted 8 lines

meta/recipes-connectivity/avahi/avahi.inc do_install_avahi-autoipd() { · line 129

Quoted 6 lines
meta/recipes-connectivity/avahi/avahi.inc +1 -2
 pkg_postinst_avahi-daemon () {
-	# can't do this offline
 	if [ "x$D" != "x" ]; then
-		exit 1
+		exit 0
 	fi

Removing that check completely would be a better idea :)

No it wouldn't, if we're installing this at do_rootfs time, we can just mark the postinstall as done.

Cheers,

Richard

_______________________________________________
Openembedded-core mailing list
[email protected]
http://lists.linuxtogo.org/cgi-bin/mailman/listinfo/openembedded-core

author
#7 lore raw

[Pull v3 2/4] xserver-nodm-init: Use useradd to add the xuser for rootless X

In reply to Saul Wold

This also address an issue with dbus and connman, since connmand needs to start as the xuser in the rootless X situation.

Fixes [YOCTO #1699]
---
 .../x11-common/xserver-nodm-init.bb                |   28 +++++++------------
 1 files changed, 10 insertions(+), 18 deletions(-)
meta/recipes-graphics/x11-common/xserver-nodm-init.bb +10 -18
index ea4222d..dbc1c42 100644
@@ -2,7 +2,7 @@ DESCRIPTION = "Simple Xserver Init Script (no dm)"
 LICENSE = "GPLv2"
 LIC_FILES_CHKSUM = "file://COPYING;md5=751419260aa954499f7abaabaa882bbe"
 SECTION = "x11"
-PR = "r26"
+PR = "r28"
 RDEPENDS_${PN} = "sudo"
 
 SRC_URI = "file://xserver-nodm \
@@ -23,23 +23,15 @@ do_install() {
     fi
 }
 
-pkg_postinst_${PN} () {
-    if [ "x$D" != "x" ] ; then
-        exit 1
-    fi
-
-    if [ -f /etc/X11/Xusername ]; then
-        # create the rootless X user, and add user to group tty, video, audio
-        username=`cat /etc/X11/Xusername`
-        adduser --disabled-password $username
-        # FIXME: use addgroup if busybox addgroup is ready
-        sed -i -e "s/^video:.*/&${username}/g" /etc/group
-        sed -i -e "s/^tty:.*/&${username}/g" /etc/group
-        sed -i -e "s/^audio:.*/&${username}/g" /etc/group
-    fi
-}
-
-inherit update-rc.d
+inherit update-rc.d useradd
 
 INITSCRIPT_NAME = "xserver-nodm"
 INITSCRIPT_PARAMS = "start 9 5 2 . stop 20 0 1 6 ."
+
+# Use fixed Xusername of xuser for now, this will need to be
+# fixed if the Xusername changes from xuser
+USERADD_PACKAGES = "${PN}"
+USERADD_PARAM_${PN} = "--system --no-create-home \
+                       --shell /bin/false --groups video,tty,audio \
+                       --user-group xuser"
+
Signature · 1 line
1.7.6.4
author
#8 lore raw

[Pull v3 3/4] connman: Use useradd to add the xuser for DBus

In reply to Saul Wold

Connmand needs to start as the xuser as defined in the dbus configuration and needs to share this with rootless X. Since it's possible for connmand to run on a sytem without rootless X we still need to create the user here.

Useradd will fail gracefully if the user already exists.

Fixes [YOCTO #1699]
---
 meta/recipes-connectivity/connman/connman.inc     |    7 ++++++-
 meta/recipes-connectivity/connman/connman_0.75.bb |    2 +-
 2 files changed, 7 insertions(+), 2 deletions(-)
meta/recipes-connectivity/connman/connman.inc +6 -1
index ae1b725..480b59c 100644
@@ -18,7 +18,12 @@ DEPENDS  = "libgdbus dbus glib-2.0 iptables"
 INITSCRIPT_NAME = "connman"
 INITSCRIPT_PARAMS = "start 05 5 2 3 . stop 22 0 1 6 ."
 
-inherit autotools pkgconfig update-rc.d
+USERADD_PACKAGES = "${PN}"
+USERADD_PARAM_${PN} = "--system --no-create-home \
+                       --shell /bin/false --groups video,tty,audio \
+                       --user-group xuser"
+
+inherit autotools pkgconfig update-rc.d useradd
 
 do_install_append() {
     install -d ${D}${sysconfdir}/init.d/
meta/recipes-connectivity/connman/connman_0.75.bb +1 -1
index 8a02753..78f2199 100644
@@ -1,5 +1,5 @@
 require connman.inc
-PR = "r2"
+PR = "r3"
 
 EXTRA_OECONF += "\
   ac_cv_path_WPASUPPLICANT=/usr/sbin/wpa_supplicant \
Signature · 1 line
1.7.6.4
author
#9 lore raw

[Pull v3 4/4] dbus: ensure that the useradd shell is set to /bin/false

In reply to Saul Wold
---
 meta/recipes-core/dbus/dbus.inc |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)
meta/recipes-core/dbus/dbus.inc +2 -1
index 5028310..caa781c 100644
@@ -22,7 +22,8 @@ INITSCRIPT_PARAMS = "start 02 5 3 2 . stop 20 0 1 6 ."
 USERADD_PACKAGES = "${PN}"
 GROUPADD_PARAM_${PN} = "-r netdev"
 USERADD_PARAM_${PN} = "--system --home ${localstatedir}/lib/dbus \
-                       --no-create-home --user-group messagebus"
+                       --no-create-home --shell /bin/false \
+                       --user-group messagebus"
 
 CONFFILES_${PN} = "${sysconfdir}/dbus-1/system.conf ${sysconfdir}/dbus-1/session.conf"
 
Signature · 1 line
1.7.6.4
#10 lore raw
In reply to Saul Wold
Quoted 17 lines · Saul Wold

Richard,

Hope that third times the charm!

Fixes 1699, additional commit comments, fixed whitespace.

Sau!

The following changes since commit d0a2c87d068f2d769d47c8455bb1434b90a7a844:

Fix HOMEPAGE values in libzypp and sat-solver .bb files (2011-11-01 18:28:06 +0000)

are available in the git repository at:
git://git.openembedded.org/openembedded-core-contrib sgw/fix
http://cgit.openembedded.org/cgit.cgi/openembedded-core-contrib/log/?h=sgw/fix

Quoted 5 lines

Saul Wold (4):
avahi: use useradd to create avahi user for avahi-daemon
xserver-nodm-init: Use useradd to add the xuser for rootless X
connman: Use useradd to add the xuser for DBus
dbus: ensure that the useradd shell is set to /bin/false

Thanks for the tweaks, merged to master.

Cheers,

Richard