Bug 6204

Summary: WIC does not check presence of e2fsprogs-native
Product: [Build System, Metadata & Runtime] OE-Core Reporter: Alexandre Fournier <alexandre.fournier>
Component: deploymentAssignee: Ed Bartosh <eduard.bartosh>
Status: RESOLVED FIXED QA Contact: Daniel Istrate <daniel.alexandrux.istrate>
Severity: enhancement    
Priority: Medium CC: bogdanx.a.voiculescu, jessica.zhang, joaohf, magnus
Version: unspecified   
Target Milestone: 2.1   
Hardware: All   
OS: Multiple   
Whiteboard:
OS type for building Yocto: --- Type of Regression: ---
Verified: Documentation change: No (bug/feature does not impact docs)
Bug Depends on: 8474    
Bug Blocks:    

Description Alexandre Fournier 2014-04-22 14:46:22 UTC
When using WIC to build ext2/3/4 partitions, mkfs.ext{2,3,4} may fail if e2fsprogs-native is not already baked. As mkfs.ext{2,3,4} is used in conjunction with pseudo it can execute system's mkfs instead of oe-core's.

This can be fixed by running 'bitbake e2fsprogs-native' before 'wic create'

$ wic create generic-pc -e test-image gives the following error:

Debug: exec_cmd: output for export PATH=/tmp/OE/tmp-eglibc/sysroots/x86_64-linux/sbin:/tmp/OE/tmp-eglibc/sysroots/x86_64-linux/usr/sbin:/tmp/OE/tmp-eglibc/sysroots/x86_64-linux/usr/bin:$PATH;export PSEUDO_PREFIX=/tmp/OE/tmp-eglibc/sysroots/x86_64-linux/usr;export PSEUDO_LOCALSTATEDIR=/tmp/OE/tmp-eglibc/work/openvox-oe-linux/test-image/1.0-r0/rootfs/../pseudo;export PSEUDO_PASSWD=/tmp/OE/tmp-eglibc/work/openvox-oe-linux/test-image/1.0-r0/rootfs;export PSEUDO_NOSYMLINKEXP=1;/tmp/OE/tmp-eglibc/sysroots/x86_64-linux/usr/bin/pseudo mkfs.ext4 -F -i 8192 /var/tmp/wic/build/rootfs_data.ext4 -d /tmp/OE/tmp-eglibc/work/openvox-oe-linux/test-image/1.0-r0/rootfs (rc = 1):

mkfs.ext4: invalid option -- 'd'
Usage: mkfs.ext4 [-c|-l filename] [-b block-size] [-C cluster-size]
	[-i bytes-per-inode] [-I inode-size] [-J journal-options]
	[-G flex-group-size] [-N number-of-inodes]
	[-m reserved-blocks-percentage] [-o creator-os]
	[-g blocks-per-group] [-L volume-label] [-M last-mounted-directory]
	[-O feature[,...]] [-r fs-revision] [-E extended-option[,...]]
	[-t fs-type] [-T usage-type ] [-U UUID] [-jnqvDFKSV] device [blocks-count]

Warning: WARNING: export PATH=/tmp/OE/tmp-eglibc/sysroots/x86_64-linux/sbin:/tmp/OE/tmp-eglibc/sysroots/x86_64-linux/usr/sbin:/tmp/OE/tmp-eglibc/sysroots/x86_64-linux/usr/bin:$PATH;export PSEUDO_PREFIX=/tmp/OE/tmp-eglibc/sysroots/x86_64-linux/usr;export PSEUDO_LOCALSTATEDIR=/tmp/OE/tmp-eglibc/work/openvox-oe-linux/test-image/1.0-r0/rootfs/../pseudo;export PSEUDO_PASSWD=/tmp/OE/tmp-eglibc/work/openvox-oe-linux/test-image/1.0-r0/rootfs;export PSEUDO_NOSYMLINKEXP=1;/tmp/OE/tmp-eglibc/sysroots/x86_64-linux/usr/bin/pseudo mkfs.ext4 -F -i 8192 /var/tmp/wic/build/rootfs_data.ext4 -d /tmp/OE/tmp-eglibc/work/openvox-oe-linux/test-image/1.0-r0/rootfs returned '1' instead of 0
Comment 1 João Henrique 2014-06-03 23:39:59 UTC
Hi,

Not only e2fsprogs-native but syslinux-native, syslinux, and mtools-native must be baked before 'wic create'. If you are using bootimg-pcbios or bootimg-efi.

As wic is a tool that could be used without OE, maybe it's necessary implements a environment check? or if wic is running inside OE environment it should  bake the needed tools, without user requests?
Comment 2 Ed Bartosh 2015-04-05 10:33:39 UTC
Currently wic can't be used without oe build system as it's tightly coupled with tools and build artifacts produced by it.

However, there is a feature request to detach wic from the build system: https://bugzilla.yoctoproject.org/show_bug.cgi?id=6558

I like the idea of environment check and two working modes of wic, but I think it would be better if we take step by step approach. As a first step I'd rather make sure wic is using only native tools. This would allow us to fully  understand wic runtime dependencies and make wic more stable, i.e. independent of host environment.
Comment 3 Ed Bartosh 2015-04-07 08:16:19 UTC
This patch partly fixes the issue as wic will not be able to find host tools anymore: http://lists.openembedded.org/pipermail/openembedded-core/2015-April/103397.html

I'm going to add requirements to bake parted-native, syslinux, e2fsprogs and mtools to the documentation and close this issue.

Please, speak up if you think something else should be done.
Comment 4 Ed Bartosh 2015-04-14 14:36:48 UTC
My patch got accepted: http://git.yoctoproject.org/cgit/cgit.cgi/poky/commit/?id=024514037ddcc92de4f685f85bb916b2815fb47e

So, I think this issue is fixed. I'm going to update documentation accordingly.
Comment 5 Daniel Istrate 2015-10-09 15:18:49 UTC
Verified on master: eac61f37e36099f74485dab398b57f3812826d17


Steps to verify:
1. bitbake core-image-minimal syslinux dosfstools-native mtools-native syslinux-native parted-native 
2. bitbake -c clean e2fsprogs-native
3. [daniel@fedora-ws poky-build]$ wic create directdisk -e core-image-minimal
Checking basic build environment...
Done.

Creating image(s)...

Error: exec_cmd: 'export PSEUDO_PREFIX=/media/ssd/poky-build/tmp/sysroots/x86_64-linux/usr;export PSEUDO_LOCALSTATEDIR=/media/ssd/poky-build/tmp/work/qemux86-poky-linux/core-image-minimal/1.0-r0/rootfs/../pseudo;export PSEUDO_PASSWD=/media/ssd/poky-build/tmp/work/qemux86-poky-linux/core-image-minimal/1.0-r0/rootfs;export PSEUDO_NOSYMLINKEXP=1;/media/ssd/poky-build/tmp/sysroots/x86_64-linux/usr/bin/pseudo mkfs.ext4 -F -i 8192 /var/tmp/wic/build/rootfs_platform.7.ext4 -L platform -d /media/ssd/poky-build/tmp/work/qemux86-poky-linux/core-image-minimal/1.0-r0/rootfs' returned '1' instead of 0
[daniel@fedora-ws poky-build]$ 

4. [daniel@fedora-ws poky-build]$ rpm -qa |grep e2fsprogs
e2fsprogs-libs-1.42.12-4.fc21.x86_64
e2fsprogs-1.42.12-4.fc21.x86_64


At step 3 wic should provide a more meaningful message.
Comment 6 Ed Bartosh 2015-10-21 12:19:12 UTC
The reason for that is that mkfs is run with pseudo and exec_native_cmd isn't aware of that. I'll modify it that it supports pseudo.
Comment 8 Ed Bartosh 2015-11-24 13:56:40 UTC
Updated the patch and sent for review again: http://lists.openembedded.org/pipermail/openembedded-core/2015-November/113271.html as previous was forgotten and doesn't apply anymore.