[elbe-devel] [PATCH] Fix silent command error in cpio examples

John Ogness john.ogness at linutronix.de
Tue Jul 2 08:45:58 CEST 2019


Hi Bastian,

On 2019-07-01, bage at linutronix.de wrote:
> From: Bastian Germann <bage at linutronix.de>
>
> The *cpio.xml examples do not write the rcS file because the commands fails
> silently:
>
> running cmd +chroot /var/cache/elbe/eec456e0-0fd1-45c9-b92f-e9a5616a1c50/target /bin/sh with STDIN echo "#!/bin/sh" | tee    /etc/init.d/rcS+
> ------------------------------------------------------------------------------
> ------------------------------------------------------------------------------
>
> Command failed with errorcode 1
> Finetuning Error, trying to continue anyways
> running cmd +chroot /var/cache/elbe/eec456e0-0fd1-45c9-b92f-e9a5616a1c50/target /bin/sh with STDIN echo "mount -a"  | tee -a /etc/init.d/rcS+
> ------------------------------------------------------------------------------
> qemu: unknown option 'a'
> ------------------------------------------------------------------------------

This is actually a problem relating to qemu. For some reason it is does
not call tee correctly. It seems it does not find it in the path
somehow. (More comments about this below...)

> Command failed with errorcode 1
> Finetuning Error, trying to continue anyways
> running cmd +chroot /var/cache/elbe/eec456e0-0fd1-45c9-b92f-e9a5616a1c50/target /bin/sh with STDIN chmod +x /etc/init.d/rcS+
> ------------------------------------------------------------------------------
> chmod: /etc/init.d/rcS: No such file or directory
> ------------------------------------------------------------------------------
>
> Command failed with errorcode 1
> Finetuning Error, trying to continue anyways
>
> Signed-off-by: Bastian Germann <bage at linutronix.de>
> ---
>  examples/armel-rescue-busybox-cpio.xml         | 4 ++--
>  examples/x86_64-pc-rescue-busybox-dyn-cpio.xml | 4 ++--
>  2 files changed, 4 insertions(+), 4 deletions(-)
>
> diff --git a/examples/armel-rescue-busybox-cpio.xml b/examples/armel-rescue-busybox-cpio.xml
> index 4b30d89d..657aea4c 100644
> --- a/examples/armel-rescue-busybox-cpio.xml
> +++ b/examples/armel-rescue-busybox-cpio.xml
> @@ -69,8 +69,8 @@
>  			<mknod opts="c 5 1">/dev/console</mknod>
>  			<mknod opts="c 1 3">/dev/null</mknod>
>  			<!-- Add start script (may be moved to archive) -->
> -			<command>echo "#!/bin/sh" | tee    /etc/init.d/rcS</command>
> -			<command>echo "mount -a"  | tee -a /etc/init.d/rcS</command>
> +			<command>echo "#!/bin/sh" > /etc/init.d/rcS</command>
> +			<command>echo "mount -a" >> /etc/init.d/rcS</command>
>  			<command>chmod +x /etc/init.d/rcS</command>

Changing "tee" to "/usr/bin/tee" will also fix the problem. I am curious
why qemu (started via binfmt) has a problem finding binaries started via
pipe. I guess I should open an issue about this.

If you want to fix using shell redirects instead, I recommend using
">" instead of ">" so that the XML is "cleaner". (This is my personal
preference. I really don't care if anyone wants to sign off this patch
as it is.)

John Ogness



More information about the elbe-devel mailing list