crops / yocto-dockerfiles

This repository is for -base and -builder containers for building derivative containers (such as poky-container) for containerized Yocto Project builds.
GNU General Public License v2.0
147 stars 56 forks source link

Cannot run some wic commands #30

Open bjurr opened 5 years ago

bjurr commented 5 years ago

Using the ubuntu-16.04 image, I noticed that some (all?) wic commands fail because of the dependency on parted:

pokyuser@edc7b75281c4:/workdir/poky/build/tmp/deploy/images/intel-corei7-64$ wic ls core-image-sato-intel-corei7-64.wic

ERROR: Can't find executable parted

Manually adding parted to the list of installed packages seems to fix the issue, but I'm unsure if this is really the way to go since the requirements listed in the Yocto Dev Manual states that parted should be built through bitbake?

https://www.yoctoproject.org/docs/2.6/dev-manual/dev-manual.html#wic-requirements

$ bitbake parted-native dosfstools-native mtools-native
pauleggleton-intel commented 5 years ago

Hmm, so digging into the code, wic's current behaviour is to use the native sysroot for the image you've built on the assumption that contains everything it needs, but that may only be true when wic is being invoked from within a build (i.e. IMAGE_FSTYPES contains "wic"). To get the full set of tools for running wic from the command line you could build them with bitbake, but I'm not sure that will actually work with current versions of the build system without explicitly telling wic the native sysroot that will contain the tools (which wouldn't be a single path with the instructions given in the manual). I think this is a bug in wic.

rewitt1 commented 5 years ago

@pauleggleton The requirements https://www.yoctoproject.org/docs/2.6/dev-manual/dev-manual.html#wic-requirements do say

Include "wic" as part of the IMAGE_FSTYPES variable

Are you saying even after following all the requirements, it still won't use the native-sysroot?

@bjurr, I'm assuming you have "wic" in your IMAGE_FSTYPES variable?

bjurr commented 5 years ago

@rewitt1 I'm using the meta-intel MACHINE intel-corei7-64, which defines IMAGE_FSTYPES += "wic"

Just to be clear, the image.wic is generated properly, but I can't modify it without adding parted to the container.

SrijanNandi commented 4 years ago

Facing the same issue. /opt/graylog-poky/build/tmp/deploy/images/genericx86-64$ wic ls core-image-full-cmdline-genericx86-64-20200707053041.rootfs.wic

ERROR: Can't find executable parted

rewitt1 commented 4 years ago

This is a bug in wic. Ideally it would use the parted that exists in the native-sysroot, but it doesn't.

There is actually an argument for wic to specify the sysroot but it didn't work by default either:

$ wic ls -n tmp/sysroots-components/x86_64/parted-native  tmp/deploy/images/qemux86-64/core-image-minimal-qemux86-64.wic

ERROR: _exec_cmd: tmp/sysroots-components/x86_64/parted-native/usr/sbin/parted -sm tmp/deploy/images/qemux86-64/core-image-minimal-qemux86-64.wic unit B print returned '127' instead of 0
output: tmp/sysroots-components/x86_64/parted-native/usr/sbin/parted: error while loading shared libraries: libreadline.so.8: cannot open shared object file: No such file or directory

However, I was able to get it to work by using LD_LIBRARY_PATH

$ LD_LIBRARY_PATH=tmp/sysroots-components/x86_64/readline-native/usr/lib/ wic ls -n tmp/sysroots-components/x86_64/parted-native  tmp/deploy/images/qemux86-64/core-image-minimal-qemux86-64.wic
Num     Start        End          Size      Fstype
 1       1048576     26757119     25708544  fat16
 2      27262976     53168127     25905152  ext4

This shouldn't be necessary. If I file a bug against wic, I'll update this issue. If anyone else does, please feel free to do the same.

jjcf89 commented 4 years ago

wic ls -n tmp/sysroots-components/x86_64/parted-native tmp/deploy/images/qemux86-64/core-image-minimal-qemux86-64.wic

I had some luck pointing wic to the recipe-sysroot-native directory build for wic-tools. Not sure why it doesn't use this by default.

$ wic ls -n tmp/work/armv7at2hf-neon-linux-gnueabi/wic-tools/1.0-r0/recipe-sysroot-native tmp/deploy/images/mitysom-am57x/arago-base-tisdk-image-mitysom-am57x.wic
Num     Start        End          Size      Fstype
 1          4096     21814271     21810176  fat16
 2      21815296    455231487    433416192  ext4
DavidAntliff commented 2 years ago

Hi @rewitt1,

If I file a bug against wic, I'll update this issue.

Just wondering if you did file such a bug?

FWIW, the -n tmp/sysroots-components/x86_64/parted-native option worked for me.