Patchwork [1/1] systemd: ignore qemu output, and check its return code

login
register
mail settings
Submitter rongqing.li@windriver.com
Date July 24, 2013, 5:24 a.m.
Message ID <947336a1ef2b936328ba6fcf519d55a4eda7085d.1374643300.git.rongqing.li@windriver.com>
Download mbox | patch
Permalink /patch/54285/
State New
Headers show

Comments

rongqing.li@windriver.com - July 24, 2013, 5:24 a.m.
From: "Roy.Li" <rongqing.li@windriver.com>

qemu prints errors sometime, but it works well, the error information
can be captured by rpm, and lead to rpm failure. like:

	$export D=/tmp/rootfs;.../usr/bin/qemu-i386 -L $D \
		-E LD_LIBRARY_PATH=$D/usr/lib:$D/lib $D/bin/udevadm hwdb --update --root $D
	qemu: Unsupported syscall: 240
	$echo $?
	$ 0

Signed-off-by: Roy.Li <rongqing.li@windriver.com>
---
 meta/recipes-core/systemd/systemd_204.bb |    4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
Khem Raj - July 24, 2013, 5:34 a.m.
On Jul 23, 2013, at 10:24 PM, <rongqing.li@windriver.com> wrote:

> From: "Roy.Li" <rongqing.li@windriver.com>
> 
> qemu prints errors sometime, but it works well, the error information
> can be captured by rpm, and lead to rpm failure. like:
> 
> 	$export D=/tmp/rootfs;.../usr/bin/qemu-i386 -L $D \
> 		-E LD_LIBRARY_PATH=$D/usr/lib:$D/lib $D/bin/udevadm hwdb --update --root $D
> 	qemu: Unsupported syscall: 240


hmm this is a qemu issue and I bet qemu is segfaulting
This should be fixed. Can you try porting 

http://lists.gnu.org/archive/html/qemu-devel/2010-02/msg00870.html

To qemu please ?

Then you won't need this patch.
rongqing.li@windriver.com - July 24, 2013, 6:15 a.m.
On 07/24/2013 01:34 PM, Khem Raj wrote:
>
> On Jul 23, 2013, at 10:24 PM, <rongqing.li@windriver.com> wrote:
>
>> From: "Roy.Li" <rongqing.li@windriver.com>
>>
>> qemu prints errors sometime, but it works well, the error information
>> can be captured by rpm, and lead to rpm failure. like:
>>
>> 	$export D=/tmp/rootfs;.../usr/bin/qemu-i386 -L $D \
>> 		-E LD_LIBRARY_PATH=$D/usr/lib:$D/lib $D/bin/udevadm hwdb --update --root $D
>> 	qemu: Unsupported syscall: 240
>
>
> hmm this is a qemu issue and I bet qemu is segfaulting
> This should be fixed. Can you try porting
>

qemu is not segfaulting, except error message, it returns 0,
and udevadm hwdb finished its task.

> http://lists.gnu.org/archive/html/qemu-devel/2010-02/msg00870.html
>

why was this patch be not merged, it was submitted on 02/2010


-Roy
> To qemu please ?
>
> Then you won't need this patch.
>
>
>
Ross Burton - July 26, 2013, 11:53 a.m.
On 24 July 2013 07:15, Rongqing Li <rongqing.li@windriver.com> wrote:
> qemu is not segfaulting, except error message, it returns 0,
> and udevadm hwdb finished its task.

A bit of googling takes you to
https://bugs.launchpad.net/ubuntu/+source/qemu-linaro/+bug/758424.
Key quote:

"We only implement the futex syscalls if CONFIG_USE_NPTL. This isn't
defined for the i386 target (the necessary support in target-i386 for
pushing atomic insns up to the linux-user top level loop isn't
implemented). The upshot is that running multithreaded programs in
linux-user i386-target isn't supported and this is just one of the
symptoms."

Not segfaulting != working when multithreaded programs don't have
futexs.  We'll be seeing this more in the future now that GLib assumes
you can thread.

Ross
rongqing.li@windriver.com - Aug. 5, 2013, 5:21 a.m.
On 07/26/2013 07:53 PM, Burton, Ross wrote:
> On 24 July 2013 07:15, Rongqing Li <rongqing.li@windriver.com> wrote:
>> qemu is not segfaulting, except error message, it returns 0,
>> and udevadm hwdb finished its task.
>
> A bit of googling takes you to
> https://bugs.launchpad.net/ubuntu/+source/qemu-linaro/+bug/758424.
> Key quote:
>
> "We only implement the futex syscalls if CONFIG_USE_NPTL. This isn't
> defined for the i386 target (the necessary support in target-i386 for
> pushing atomic insns up to the linux-user top level loop isn't
> implemented). The upshot is that running multithreaded programs in
> linux-user i386-target isn't supported and this is just one of the
> symptoms."
>
> Not segfaulting != working when multithreaded programs don't have
> futexs.  We'll be seeing this more in the future now that GLib assumes
> you can thread.
>
> Ross
>


I see this bug was not fixed from 2011-11, what should I do?

I know my patch works well on my machine.

-Roy
rongqing.li@windriver.com - Aug. 7, 2013, 7:30 a.m.
ping

On 07/24/2013 01:24 PM, rongqing.li@windriver.com wrote:
> From: "Roy.Li" <rongqing.li@windriver.com>
>
> qemu prints errors sometime, but it works well, the error information
> can be captured by rpm, and lead to rpm failure. like:
>
> 	$export D=/tmp/rootfs;.../usr/bin/qemu-i386 -L $D \
> 		-E LD_LIBRARY_PATH=$D/usr/lib:$D/lib $D/bin/udevadm hwdb --update --root $D
> 	qemu: Unsupported syscall: 240
> 	$echo $?
> 	$ 0
>
> Signed-off-by: Roy.Li <rongqing.li@windriver.com>
> ---
>   meta/recipes-core/systemd/systemd_204.bb |    4 +++-
>   1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/meta/recipes-core/systemd/systemd_204.bb b/meta/recipes-core/systemd/systemd_204.bb
> index b8b1290..10bde33 100644
> --- a/meta/recipes-core/systemd/systemd_204.bb
> +++ b/meta/recipes-core/systemd/systemd_204.bb
> @@ -277,7 +277,9 @@ ALTERNATIVE_PRIORITY[poweroff] ?= "300"
>   pkg_postinst_udev-hwdb () {
>   	if test -n "$D"; then
>   		${@qemu_run_binary(d, '$D', '${base_bindir}/udevadm')} hwdb --update \
> -			--root $D
> +			--root $D 2>/dev/null
> +
> +		[ $? -ne 0 ] && exit 1
>   	else
>   		udevadm hwdb --update
>   	fi
>
Ross Burton - Aug. 7, 2013, 11:55 a.m.
On 7 August 2013 08:30, Rongqing Li <rongqing.li@windriver.com> wrote:
>>                 ${@qemu_run_binary(d, '$D', '${base_bindir}/udevadm')}
>> hwdb --update \
>> -                       --root $D
>> +                       --root $D 2>/dev/null
>> +
>> +               [ $? -ne 0 ] && exit 1

The $? check can be removed replaced by set -e, as many postinst
scripts do already.

Why/where is the output from runqemu considered an error?  I wasn't
aware that logs were monitored for that error message.  I don't think
we should be hiding the output of runqemu as any real errors will also
be hidden.

Ross
Khem Raj - Aug. 7, 2013, 6:26 p.m.
On Aug 7, 2013, at 12:30 AM, Rongqing Li <rongqing.li@windriver.com> wrote:

> ping
> 
> On 07/24/2013 01:24 PM, rongqing.li@windriver.com wrote:
>> From: "Roy.Li" <rongqing.li@windriver.com>
>> 
>> qemu prints errors sometime, but it works well,


how do you know ?

>> the error information
>> can be captured by rpm, and lead to rpm failure. like:
>> 
>> 	$export D=/tmp/rootfs;.../usr/bin/qemu-i386 -L $D \
>> 		-E LD_LIBRARY_PATH=$D/usr/lib:$D/lib $D/bin/udevadm hwdb --update --root $D
>> 	qemu: Unsupported syscall: 240
>> 	$echo $?
>> 	$ 0
>> 
>> Signed-off-by: Roy.Li <rongqing.li@windriver.com>
>> ---
>>  meta/recipes-core/systemd/systemd_204.bb |    4 +++-
>>  1 file changed, 3 insertions(+), 1 deletion(-)
>> 
>> diff --git a/meta/recipes-core/systemd/systemd_204.bb b/meta/recipes-core/systemd/systemd_204.bb
>> index b8b1290..10bde33 100644
>> --- a/meta/recipes-core/systemd/systemd_204.bb
>> +++ b/meta/recipes-core/systemd/systemd_204.bb
>> @@ -277,7 +277,9 @@ ALTERNATIVE_PRIORITY[poweroff] ?= "300"
>>  pkg_postinst_udev-hwdb () {
>>  	if test -n "$D"; then
>>  		${@qemu_run_binary(d, '$D', '${base_bindir}/udevadm')} hwdb --update \
>> -			--root $D
>> +			--root $D 2>/dev/null
>> +
>> +		[ $? -ne 0 ] && exit 1
>>  	else
>>  		udevadm hwdb --update
>>  	fi
>> 
> 
> -- 
> Best Reagrds,
> Roy | RongQing Li
> _______________________________________________
> Openembedded-core mailing list
> Openembedded-core@lists.openembedded.org
> http://lists.openembedded.org/mailman/listinfo/openembedded-core
rongqing.li@windriver.com - Aug. 8, 2013, 8:53 a.m.
On 08/08/2013 02:26 AM, Khem Raj wrote:
>
> On Aug 7, 2013, at 12:30 AM, Rongqing Li <rongqing.li@windriver.com> wrote:
>
>> ping
>>
>> On 07/24/2013 01:24 PM, rongqing.li@windriver.com wrote:
>>> From: "Roy.Li" <rongqing.li@windriver.com>
>>>
>>> qemu prints errors sometime, but it works well,
>
>
> how do you know ?
>

echo $? and output of "udevadm hwdb --update --root $D" shows
it works well.

-Roy


>>> the error information
>>> can be captured by rpm, and lead to rpm failure. like:
>>>
>>> 	$export D=/tmp/rootfs;.../usr/bin/qemu-i386 -L $D \
>>> 		-E LD_LIBRARY_PATH=$D/usr/lib:$D/lib $D/bin/udevadm hwdb --update --root $D
>>> 	qemu: Unsupported syscall: 240
>>> 	$echo $?
>>> 	$ 0
>>>
>>> Signed-off-by: Roy.Li <rongqing.li@windriver.com>
>>> ---
>>>   meta/recipes-core/systemd/systemd_204.bb |    4 +++-
>>>   1 file changed, 3 insertions(+), 1 deletion(-)
>>>
>>> diff --git a/meta/recipes-core/systemd/systemd_204.bb b/meta/recipes-core/systemd/systemd_204.bb
>>> index b8b1290..10bde33 100644
>>> --- a/meta/recipes-core/systemd/systemd_204.bb
>>> +++ b/meta/recipes-core/systemd/systemd_204.bb
>>> @@ -277,7 +277,9 @@ ALTERNATIVE_PRIORITY[poweroff] ?= "300"
>>>   pkg_postinst_udev-hwdb () {
>>>   	if test -n "$D"; then
>>>   		${@qemu_run_binary(d, '$D', '${base_bindir}/udevadm')} hwdb --update \
>>> -			--root $D
>>> +			--root $D 2>/dev/null
>>> +
>>> +		[ $? -ne 0 ] && exit 1
>>>   	else
>>>   		udevadm hwdb --update
>>>   	fi
>>>
>>
>> --
>> Best Reagrds,
>> Roy | RongQing Li
>> _______________________________________________
>> Openembedded-core mailing list
>> Openembedded-core@lists.openembedded.org
>> http://lists.openembedded.org/mailman/listinfo/openembedded-core
>
>
>
rongqing.li@windriver.com - Aug. 8, 2013, 8:55 a.m.
On 08/07/2013 07:55 PM, Burton, Ross wrote:
> On 7 August 2013 08:30, Rongqing Li <rongqing.li@windriver.com> wrote:
>>>                  ${@qemu_run_binary(d, '$D', '${base_bindir}/udevadm')}
>>> hwdb --update \
>>> -                       --root $D
>>> +                       --root $D 2>/dev/null
>>> +
>>> +               [ $? -ne 0 ] && exit 1
>
> The $? check can be removed replaced by set -e, as many postinst
> scripts do already.
>
> Why/where is the output from runqemu considered an error?  I wasn't
> aware that logs were monitored for that error message.  I don't think
> we should be hiding the output of runqemu as any real errors will also
> be hidden.
>
> Ross


I always get the below on error on my machine(Ubuntu 12.10) when enable 
systemd:


|  102:Installing libnfsidmap0 
######################################## [ 26%]
|  103:Installing run-postinsts 
######################################## [ 26%]
| Output from run-postinsts-1.0-r9@i586:
| --
|  257:Installing liberation-fo.. 
######################################## [ 65%]
|  258:Installing glib-networking 
######################################## [ 65%]
|  259:Installing wpa-supplicant 
######################################## [ 66%]
|  260:Installing udev-hwdb 
######################################## [ 66%]
| Output from udev-hwdb-1:204-r0@i586:
| ERROR: ld.so: object 'libpseudo.so' from LD_PRELOAD cannot be 
preloaded: ignored.
| qemu: Unsupported syscall: 240
|  261:Installing udev 
######################################## [ 66%]
|  262:Installing util-linux-fsck 
######################################## [ 67%]
| Output from util-linux-fsck-2.23.2-r0@i586:
| update-alternatives: Linking 
/buildarea/build/poky/build/tmp/work/qemux86-poky-linux/core-image-sato/1.0-r0/rootfs//sbin/fsck.minix 
to /sbin/fsck.minix.util-linux
|
| ERROR: Function failed: do_rootfs (log file is located at 
/buildarea/build/poky/build/tmp/work/qemux86-poky-linux/core-image-sato/1.0-r0/temp/log.do_rootfs.26461)
ERROR: Task 7 
(/buildarea/build/poky/meta/recipes-sato/images/core-image-sato.bb, 
do_rootfs) failed with exit code '1'
NOTE: Tasks Summary: Attempted 5548 tasks of which 924 didn't need to be 
rerun and 1 failed.
No currently running tasks (5547 of 5549)

Summary: 1 task failed:
   /buildarea/build/poky/meta/recipes-sato/images/core-image-sato.bb, 
do_rootfs
Summary: There was 1 ERROR message shown, returning a non-zero exit code.


After using the patch, it works well.


Other place used the same method to handle the qemu_run_binary result:


lirq@lirq-OptiPlex-780:/buildarea/build/poky/meta$ grep qemu_run_binary 
./ -r -A2
./classes/qemu.bbclass:# ${@qemu_run_binary(d, '$D', 
'/usr/bin/test_app')} [test_app arguments]
./classes/qemu.bbclass-#
./classes/qemu.bbclass:def qemu_run_binary(data, rootfs_path, binary):
./classes/qemu.bbclass-    qemu_binary = qemu_target_binary(data)
./classes/qemu.bbclass-    if qemu_binary == "qemu-allarch":
--
./classes/gtk-immodules-cache.bbclass:            ${@qemu_run_binary(d, 
'$D', '${bindir}/gtk-query-immodules-$maj_ver.0')} \
./classes/gtk-immodules-cache.bbclass-                $IMFILES > 
$D/etc/gtk-$maj_ver.0/gtk.immodules 2>/dev/null &&
./classes/gtk-immodules-cache.bbclass-                sed -i -e "s:$D::" 
$D/etc/gtk-$maj_ver.0/gtk.immodules
--
./classes/gtk-immodules-cache.bbclass:            ${@qemu_run_binary(d, 
'$D', '${bindir}/gtk-query-immodules-$maj_ver.0')} \
./classes/gtk-immodules-cache.bbclass-                $IMFILES > 
$D/etc/gtk-$maj_ver.0/gtk.immodules 2>/dev/null &&
./classes/gtk-immodules-cache.bbclass-                sed -i -e "s:$D::" 
$D/etc/gtk-$maj_ver.0/gtk.immodules
--
./recipes-graphics/pango/pango.inc:	${@qemu_run_binary(d, 
'$D','${bindir}/${MLPREFIX}pango-querymodules')} \
./recipes-graphics/pango/pango.inc-	 
$D${libdir}/pango/${LIBV}/modules/*.so \
./recipes-graphics/pango/pango.inc-		> 
$D${sysconfdir}/pango/${MLPREFIX}pango.modules 2>/dev/null



-Roy


>
>
Ross Burton - Aug. 8, 2013, 10:57 a.m.
On 8 August 2013 09:55, Rongqing Li <rongqing.li@windriver.com> wrote:
> | ERROR: ld.so: object 'libpseudo.so' from LD_PRELOAD cannot be preloaded:
> ignored.

That's probably what's causing the problem, not the syscall warning.

It looks like https://bugzilla.yoctoproject.org/show_bug.cgi?id=4843
which is tricky to replicate, maybe you should speak to Peter about
your configuration so we can finally fix it.

Ross

Patch

diff --git a/meta/recipes-core/systemd/systemd_204.bb b/meta/recipes-core/systemd/systemd_204.bb
index b8b1290..10bde33 100644
--- a/meta/recipes-core/systemd/systemd_204.bb
+++ b/meta/recipes-core/systemd/systemd_204.bb
@@ -277,7 +277,9 @@  ALTERNATIVE_PRIORITY[poweroff] ?= "300"
 pkg_postinst_udev-hwdb () {
 	if test -n "$D"; then
 		${@qemu_run_binary(d, '$D', '${base_bindir}/udevadm')} hwdb --update \
-			--root $D
+			--root $D 2>/dev/null
+
+		[ $? -ne 0 ] && exit 1
 	else
 		udevadm hwdb --update
 	fi