All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] avahi: fix useradd race condition
@ 2011-11-03 12:57 Koen Kooi
  2011-11-03 13:04 ` Koen Kooi
  0 siblings, 1 reply; 5+ messages in thread
From: Koen Kooi @ 2011-11-03 12:57 UTC (permalink / raw)
  To: openembedded-core; +Cc: Koen Kooi

Avahi doesn't work at boot because of:

+ sh /OE/../rootfs/var/lib/opkg/info/avahi-daemon.preinst
Running useradd commands...
grep: /OE/../rootfs/etc/passwd: No such file or directory

That is due to:

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)

After this patch:

 Package: avahi-daemon
 Version: 0.6.30-r10.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), shadow, libexpat1 (>= 2.0.1), base-passwd

This also changes ${PN}-daemon to avahi-daemon to be consistent with the PACKAGES/FILES lines below

Signed-off-by: Koen Kooi <koen@dominion.thruhere.net>
---
 meta/recipes-connectivity/avahi/avahi.inc |    7 ++++---
 1 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/meta/recipes-connectivity/avahi/avahi.inc b/meta/recipes-connectivity/avahi/avahi.inc
index 79cfd73..728c38f 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 = "r9"
+INC_PR = "r10"
 
 DEPENDS = "expat libcap libdaemon dbus glib-2.0"
 
@@ -23,8 +23,9 @@ SRC_URI = "http://avahi.org/download/avahi-${PV}.tar.gz \
           file://99avahi-autoipd \
           file://initscript.patch"
 
-USERADD_PACKAGES = "${PN}-daemon"
-USERADD_PARAM_${PN}-daemon = "--system --home /var/run/avahi-daemon \
+USERADDPN = "avahi-daemon"
+USERADD_PACKAGES = "avahi-daemon"
+USERADD_PARAM_avahi-daemon = "--system --home /var/run/avahi-daemon \
                               --no-create-home --shell /bin/false \
                               --user-group avahi"
 
-- 
1.7.2.5




^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH] avahi: fix useradd race condition
  2011-11-03 12:57 [PATCH] avahi: fix useradd race condition Koen Kooi
@ 2011-11-03 13:04 ` Koen Kooi
  2011-11-03 14:39   ` Richard Purdie
  0 siblings, 1 reply; 5+ messages in thread
From: Koen Kooi @ 2011-11-03 13:04 UTC (permalink / raw)
  To: openembedded-core

[-- Attachment #1: Type: text/plain, Size: 2079 bytes --]


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

> Avahi doesn't work at boot because of:
> 
> + sh /OE/../rootfs/var/lib/opkg/info/avahi-daemon.preinst
> Running useradd commands...
> grep: /OE/../rootfs/etc/passwd: No such file or directory
> 
> That is due to:
> 
> 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)
> 
> After this patch:
> 
> Package: avahi-daemon
> Version: 0.6.30-r10.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), shadow, libexpat1 (>= 2.0.1), base-passwd
> 
> This also changes ${PN}-daemon to avahi-daemon to be consistent with the PACKAGES/FILES lines below
> 
> Signed-off-by: Koen Kooi <koen@dominion.thruhere.net>
> ---
> meta/recipes-connectivity/avahi/avahi.inc |    7 ++++---
> 1 files changed, 4 insertions(+), 3 deletions(-)
> 
> diff --git a/meta/recipes-connectivity/avahi/avahi.inc b/meta/recipes-connectivity/avahi/avahi.inc
> index 79cfd73..728c38f 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 = "r9"
> +INC_PR = "r10"
> 
> DEPENDS = "expat libcap libdaemon dbus glib-2.0"
> 
> @@ -23,8 +23,9 @@ SRC_URI = "http://avahi.org/download/avahi-${PV}.tar.gz \
>           file://99avahi-autoipd \
>           file://initscript.patch"
> 
> -USERADD_PACKAGES = "${PN}-daemon"
> -USERADD_PARAM_${PN}-daemon = "--system --home /var/run/avahi-daemon \
> +USERADDPN = "avahi-daemon"

My gut feeling is that useradd.bbclass should add the RDEPENDS in its pythoncode instead of relying on people to set both USERADD_PACKAGES and USERADDPN to the same value.

regards,

Koen.

[-- Attachment #2: Message signed with OpenPGP using GPGMail --]
[-- Type: application/pgp-signature, Size: 169 bytes --]

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] avahi: fix useradd race condition
  2011-11-03 13:04 ` Koen Kooi
@ 2011-11-03 14:39   ` Richard Purdie
  2011-11-03 21:04     ` Scott Garman
  0 siblings, 1 reply; 5+ messages in thread
From: Richard Purdie @ 2011-11-03 14:39 UTC (permalink / raw)
  To: Patches and discussions about the oe-core layer

On Thu, 2011-11-03 at 14:04 +0100, Koen Kooi wrote:
> Op 3 nov. 2011, om 13:57 heeft Koen Kooi het volgende geschreven:
> 
> > Avahi doesn't work at boot because of:
> > 
> > + sh /OE/../rootfs/var/lib/opkg/info/avahi-daemon.preinst
> > Running useradd commands...
> > grep: /OE/../rootfs/etc/passwd: No such file or directory
> > 
> > That is due to:
> > 
> > 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)
> > 
> > After this patch:
> > 
> > Package: avahi-daemon
> > Version: 0.6.30-r10.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), shadow, libexpat1 (>= 2.0.1), base-passwd
> > 
> > This also changes ${PN}-daemon to avahi-daemon to be consistent with the PACKAGES/FILES lines below
> > 
> > Signed-off-by: Koen Kooi <koen@dominion.thruhere.net>
> > ---
> > meta/recipes-connectivity/avahi/avahi.inc |    7 ++++---
> > 1 files changed, 4 insertions(+), 3 deletions(-)
> > 
> > diff --git a/meta/recipes-connectivity/avahi/avahi.inc b/meta/recipes-connectivity/avahi/avahi.inc
> > index 79cfd73..728c38f 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 = "r9"
> > +INC_PR = "r10"
> > 
> > DEPENDS = "expat libcap libdaemon dbus glib-2.0"
> > 
> > @@ -23,8 +23,9 @@ SRC_URI = "http://avahi.org/download/avahi-${PV}.tar.gz \
> >           file://99avahi-autoipd \
> >           file://initscript.patch"
> > 
> > -USERADD_PACKAGES = "${PN}-daemon"
> > -USERADD_PARAM_${PN}-daemon = "--system --home /var/run/avahi-daemon \
> > +USERADDPN = "avahi-daemon"
> 
> My gut feeling is that useradd.bbclass should add the RDEPENDS in its
> pythoncode instead of relying on people to set both USERADD_PACKAGES
> and USERADDPN to the same value.

Agreed, looking at the code I think we can make this easier on the user.
I'll take the fix to solve the short term issues but we could do with
improving this.

Cheers,

Richard




^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] avahi: fix useradd race condition
  2011-11-03 14:39   ` Richard Purdie
@ 2011-11-03 21:04     ` Scott Garman
  2011-11-04  9:00       ` Koen Kooi
  0 siblings, 1 reply; 5+ messages in thread
From: Scott Garman @ 2011-11-03 21:04 UTC (permalink / raw)
  To: openembedded-core

On 11/03/2011 07:39 AM, Richard Purdie wrote:
> On Thu, 2011-11-03 at 14:04 +0100, Koen Kooi wrote:
>> Op 3 nov. 2011, om 13:57 heeft Koen Kooi het volgende geschreven:
>>
>>> Avahi doesn't work at boot because of:
>>>
>>> + sh /OE/../rootfs/var/lib/opkg/info/avahi-daemon.preinst
>>> Running useradd commands...
>>> grep: /OE/../rootfs/etc/passwd: No such file or directory
>>>
>>> That is due to:
>>>
>>> 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)
>>>
>>> After this patch:
>>>
>>> Package: avahi-daemon
>>> Version: 0.6.30-r10.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), shadow, libexpat1 (>= 2.0.1), base-passwd
>>>
>>> This also changes ${PN}-daemon to avahi-daemon to be consistent with the PACKAGES/FILES lines below
>>>
>>> Signed-off-by: Koen Kooi<koen@dominion.thruhere.net>
>>> ---
>>> meta/recipes-connectivity/avahi/avahi.inc |    7 ++++---
>>> 1 files changed, 4 insertions(+), 3 deletions(-)
>>>
>>> diff --git a/meta/recipes-connectivity/avahi/avahi.inc b/meta/recipes-connectivity/avahi/avahi.inc
>>> index 79cfd73..728c38f 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 = "r9"
>>> +INC_PR = "r10"
>>>
>>> DEPENDS = "expat libcap libdaemon dbus glib-2.0"
>>>
>>> @@ -23,8 +23,9 @@ SRC_URI = "http://avahi.org/download/avahi-${PV}.tar.gz \
>>>            file://99avahi-autoipd \
>>>            file://initscript.patch"
>>>
>>> -USERADD_PACKAGES = "${PN}-daemon"
>>> -USERADD_PARAM_${PN}-daemon = "--system --home /var/run/avahi-daemon \
>>> +USERADDPN = "avahi-daemon"
>>
>> My gut feeling is that useradd.bbclass should add the RDEPENDS in its
>> pythoncode instead of relying on people to set both USERADD_PACKAGES
>> and USERADDPN to the same value.
>
> Agreed, looking at the code I think we can make this easier on the user.
> I'll take the fix to solve the short term issues but we could do with
> improving this.

I've filed a bug and will work on a fix for this:

http://bugzilla.pokylinux.org/show_bug.cgi?id=1727

Thank you for uncovering the source of the problem.

Scott

-- 
Scott Garman
Embedded Linux Engineer - Yocto Project
Intel Open Source Technology Center



^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] avahi: fix useradd race condition
  2011-11-03 21:04     ` Scott Garman
@ 2011-11-04  9:00       ` Koen Kooi
  0 siblings, 0 replies; 5+ messages in thread
From: Koen Kooi @ 2011-11-04  9:00 UTC (permalink / raw)
  To: Patches and discussions about the oe-core layer

[-- Attachment #1: Type: text/plain, Size: 3769 bytes --]


Op 3 nov. 2011, om 22:04 heeft Scott Garman het volgende geschreven:

> On 11/03/2011 07:39 AM, Richard Purdie wrote:
>> On Thu, 2011-11-03 at 14:04 +0100, Koen Kooi wrote:
>>> Op 3 nov. 2011, om 13:57 heeft Koen Kooi het volgende geschreven:
>>> 
>>>> Avahi doesn't work at boot because of:
>>>> 
>>>> + sh /OE/../rootfs/var/lib/opkg/info/avahi-daemon.preinst
>>>> Running useradd commands...
>>>> grep: /OE/../rootfs/etc/passwd: No such file or directory
>>>> 
>>>> That is due to:
>>>> 
>>>> 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)
>>>> 
>>>> After this patch:
>>>> 
>>>> Package: avahi-daemon
>>>> Version: 0.6.30-r10.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), shadow, libexpat1 (>= 2.0.1), base-passwd
>>>> 
>>>> This also changes ${PN}-daemon to avahi-daemon to be consistent with the PACKAGES/FILES lines below
>>>> 
>>>> Signed-off-by: Koen Kooi<koen@dominion.thruhere.net>
>>>> ---
>>>> meta/recipes-connectivity/avahi/avahi.inc |    7 ++++---
>>>> 1 files changed, 4 insertions(+), 3 deletions(-)
>>>> 
>>>> diff --git a/meta/recipes-connectivity/avahi/avahi.inc b/meta/recipes-connectivity/avahi/avahi.inc
>>>> index 79cfd73..728c38f 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 = "r9"
>>>> +INC_PR = "r10"
>>>> 
>>>> DEPENDS = "expat libcap libdaemon dbus glib-2.0"
>>>> 
>>>> @@ -23,8 +23,9 @@ SRC_URI = "http://avahi.org/download/avahi-${PV}.tar.gz \
>>>>           file://99avahi-autoipd \
>>>>           file://initscript.patch"
>>>> 
>>>> -USERADD_PACKAGES = "${PN}-daemon"
>>>> -USERADD_PARAM_${PN}-daemon = "--system --home /var/run/avahi-daemon \
>>>> +USERADDPN = "avahi-daemon"
>>> 
>>> My gut feeling is that useradd.bbclass should add the RDEPENDS in its
>>> pythoncode instead of relying on people to set both USERADD_PACKAGES
>>> and USERADDPN to the same value.
>> 
>> Agreed, looking at the code I think we can make this easier on the user.
>> I'll take the fix to solve the short term issues but we could do with
>> improving this.
> 
> I've filed a bug and will work on a fix for this:
> 
> http://bugzilla.pokylinux.org/show_bug.cgi?id=1727
> 
> Thank you for uncovering the source of the problem.

Some more digging reveals a second bug:

+ for i in '/OE/tentacle/build/tmp-angstrom_2010_x-eglibc/work/beaglebone-angstrom-linux-gnueabi/cloud9-image-1.0-r0/rootfs/var/lib/opkg/info/*.preinst'

That will go alphabetically, with 'avahi-daemon' going before 'base-passwd' :(

I'm going to test this patch:

diff --git a/meta/classes/rootfs_ipk.bbclass b/meta/classes/rootfs_ipk.bbclass
index e02b816..9a8edb1 100644
--- a/meta/classes/rootfs_ipk.bbclass
+++ b/meta/classes/rootfs_ipk.bbclass
@@ -77,6 +77,15 @@ fakeroot rootfs_ipk_do_rootfs () {
        ${ROOTFS_POSTINSTALL_COMMAND}
        
        runtime_script_required=0
+
+       # Base-passwd needs to run first to install /etc/passwd and friends
+       if [ -e ${IMAGE_ROOTFS}${opkglibdir}/info/base-passwd.preinst ] ; then
+               if ! sh $i; then
+                       runtime_script_required=1
+                       opkg-cl ${IPKG_ARGS} flag unpacked base-passwd
+               fi
+       fi
+


regards,

Koen

[-- Attachment #2: Message signed with OpenPGP using GPGMail --]
[-- Type: application/pgp-signature, Size: 169 bytes --]

^ permalink raw reply related	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2011-11-04  9:06 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-11-03 12:57 [PATCH] avahi: fix useradd race condition Koen Kooi
2011-11-03 13:04 ` Koen Kooi
2011-11-03 14:39   ` Richard Purdie
2011-11-03 21:04     ` Scott Garman
2011-11-04  9:00       ` Koen Kooi

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.