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

login
register
mail settings
Submitter Saul Wold
Date Nov. 2, 2011, 12:21 a.m.
Message ID <9ef4f9a56a7d68c636768d2a1dbfeb9d6542b5f4.1320191934.git.sgw@linux.intel.com>
Download mbox | patch
Permalink /patch/14185/
State Accepted
Commit f0bfecc8a0af1c4c76a37a9c88f334ab6ae7e7ef
Headers show

Comments

Saul Wold - Nov. 2, 2011, 12:21 a.m.
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]

Signed-off-by: Saul Wold <sgw@linux.intel.com>
---
 meta/recipes-connectivity/avahi/avahi.inc |   16 +++++++++-------
 1 files changed, 9 insertions(+), 7 deletions(-)
Koen Kooi - Nov. 3, 2011, 12:23 p.m.
Op 2 nov. 2011, om 01:21 heeft Saul Wold het volgende geschreven:

> 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"


> 
> Fixes: [YOCTO #1699]
> 
> Signed-off-by: Saul Wold <sgw@linux.intel.com>
> ---
> meta/recipes-connectivity/avahi/avahi.inc |   16 +++++++++-------
> 1 files changed, 9 insertions(+), 7 deletions(-)
> 
> diff --git a/meta/recipes-connectivity/avahi/avahi.inc b/meta/recipes-connectivity/avahi/avahi.inc
> index 5ad9db0..79cfd73 100644
> --- a/meta/recipes-connectivity/avahi/avahi.inc
> +++ b/meta/recipes-connectivity/avahi/avahi.inc
> @@ -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

Removing that check completely would be a better idea :)

regards,

Koen
Koen Kooi - Nov. 3, 2011, 12:38 p.m.
Op 3 nov. 2011, om 13:23 heeft Koen Kooi het volgende geschreven:

> 
> Op 2 nov. 2011, om 01:21 heeft Saul Wold het volgende geschreven:
> 
>> 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


> 
> 
>> 
>> Fixes: [YOCTO #1699]
>> 
>> Signed-off-by: Saul Wold <sgw@linux.intel.com>
>> ---
>> meta/recipes-connectivity/avahi/avahi.inc |   16 +++++++++-------
>> 1 files changed, 9 insertions(+), 7 deletions(-)
>> 
>> diff --git a/meta/recipes-connectivity/avahi/avahi.inc b/meta/recipes-connectivity/avahi/avahi.inc
>> index 5ad9db0..79cfd73 100644
>> --- a/meta/recipes-connectivity/avahi/avahi.inc
>> +++ b/meta/recipes-connectivity/avahi/avahi.inc
>> @@ -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
> 
> Removing that check completely would be a better idea :)
> 
> regards,
> 
> Koen
Richard Purdie - Nov. 3, 2011, 12:39 p.m.
On Thu, 2011-11-03 at 13:23 +0100, Koen Kooi wrote:
> Op 2 nov. 2011, om 01:21 heeft Saul Wold het volgende geschreven:
> 
> > 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.

> > Fixes: [YOCTO #1699]
> > 
> > Signed-off-by: Saul Wold <sgw@linux.intel.com>
> > ---
> > meta/recipes-connectivity/avahi/avahi.inc |   16 +++++++++-------
> > 1 files changed, 9 insertions(+), 7 deletions(-)
> > 
> > diff --git a/meta/recipes-connectivity/avahi/avahi.inc b/meta/recipes-connectivity/avahi/avahi.inc
> > index 5ad9db0..79cfd73 100644
> > --- a/meta/recipes-connectivity/avahi/avahi.inc
> > +++ b/meta/recipes-connectivity/avahi/avahi.inc
> > @@ -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
> 
> 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
Koen Kooi - Nov. 3, 2011, 12:40 p.m.
Op 3 nov. 2011, om 13:38 heeft Koen Kooi het volgende geschreven:

> 
> Op 3 nov. 2011, om 13:23 heeft Koen Kooi het volgende geschreven:
> 
>> 
>> Op 2 nov. 2011, om 01:21 heeft Saul Wold het volgende geschreven:
>> 
>>> 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.

+ 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!
Koen Kooi - Nov. 3, 2011, 12:49 p.m.
Op 3 nov. 2011, om 13:39 heeft Richard Purdie het volgende geschreven:

> On Thu, 2011-11-03 at 13:23 +0100, Koen Kooi wrote:
>> Op 2 nov. 2011, om 01:21 heeft Saul Wold het volgende geschreven:
>> 
>>> 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.

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.

> 
>>> Fixes: [YOCTO #1699]
>>> 
>>> Signed-off-by: Saul Wold <sgw@linux.intel.com>
>>> ---
>>> meta/recipes-connectivity/avahi/avahi.inc |   16 +++++++++-------
>>> 1 files changed, 9 insertions(+), 7 deletions(-)
>>> 
>>> diff --git a/meta/recipes-connectivity/avahi/avahi.inc b/meta/recipes-connectivity/avahi/avahi.inc
>>> index 5ad9db0..79cfd73 100644
>>> --- a/meta/recipes-connectivity/avahi/avahi.inc
>>> +++ b/meta/recipes-connectivity/avahi/avahi.inc
>>> @@ -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
>> 
>> 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
> Openembedded-core@lists.openembedded.org
> http://lists.linuxtogo.org/cgi-bin/mailman/listinfo/openembedded-core

Patch

diff --git a/meta/recipes-connectivity/avahi/avahi.inc b/meta/recipes-connectivity/avahi/avahi.inc
index 5ad9db0..79cfd73 100644
--- a/meta/recipes-connectivity/avahi/avahi.inc
+++ b/meta/recipes-connectivity/avahi/avahi.inc
@@ -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`