Message ID | CAAfyv34URex-eHs1s7cM6iU-6fg9oOOc51sizeHWGV74NUs0ZA@mail.gmail.com |
---|---|
State | New |
Headers | show |
Series | [RFC] : wic: Fix issue when building image with multiple partitions and swap | expand |
On 11/24/21 5:28 AM, Marek Belisko wrote: > Hi, > > I've posted something similar on yocto mailing list but no response so > far so trying here as wic comes from open-embedded. > Please send it to openembedded-core mailing list too. Looks a sane approach to me. > With wks file like this: > echo '### Contents of wks file ###' > | ### Contents of wks file ### > | + cat /home/marek/projects/kas-test/build/tmp/work/raspberrypi4-poky-linux-gnueabi/core-image-minimal/1.0-r0/mender-sdimg.wks > | part --source rawcopy > --sourceparams="file=/home/marek/projects/kas-test/build/tmp/work/raspberrypi4-poky-linux-gnueabi/core-image-minimal/1.0-r0/uboot.env" > --ondisk "mmcblk0" --align 8192 --no-table > | part --source rootfs --rootfs-dir > /home/marek/projects/kas-test/build/tmp/work/raspberrypi4-poky-linux-gnueabi/core-image-minimal/1.0-r0/bootfs.image_sdimg > --ondisk "mmcblk0" --fstype=vfat --label boot --align 8192 > --fixed-size 16 --active > | part --source rawcopy > --sourceparams="file=/home/marek/projects/kas-test/build/tmp/work/raspberrypi4-poky-linux-gnueabi/core-image-minimal/1.0-r0/deploy-core-image-minimal-image-complete/core-image-minimal-raspberrypi4.ext4" > --ondisk "mmcblk0" --align 8192 --fixed-size 172032k > | part --source rawcopy > --sourceparams="file=/home/marek/projects/kas-test/build/tmp/work/raspberrypi4-poky-linux-gnueabi/core-image-minimal/1.0-r0/deploy-core-image-minimal-image-complete/core-image-minimal-raspberrypi4.ext4" > --ondisk "mmcblk0" --align 8192 --fixed-size 172032k > | part swap --ondisk "mmcblk0" --fstype=swap --label swap --align 8192 > --size 512 > | part --source rawcopy > --sourceparams="file=/home/marek/projects/kas-test/build/tmp/work/raspberrypi4-poky-linux-gnueabi/core-image-minimal/1.0-r0/deploy-core-image-minimal-image-complete/core-image-minimal-raspberrypi4.dataimg" > --ondisk "mmcblk0" --align 8192 --fixed-size 128 > | > | bootloader --ptable msdos > | + echo '### End of contents of wks file ###' > | ### End of contents of wks file ### > > I'm seeing issue like: > > | INFO: Creating image(s)... > | > | Traceback (most recent call last): > | File "/home/marek/projects/kas-test/poky/scripts/wic", line 542, in <module> > | sys.exit(main(sys.argv[1:])) > | File "/home/marek/projects/kas-test/poky/scripts/wic", line 537, in main > | return hlp.invoke_subcommand(args, parser, hlp.wic_help_usage, > subcommands) > | File "/home/marek/projects/kas-test/poky/scripts/lib/wic/help.py", > line 83, in invoke_subcommand > | subcmd[0](args, usage) > | File "/home/marek/projects/kas-test/poky/scripts/wic", line 219, > in wic_create_subcommand > | engine.wic_create(wks_file, rootfs_dir, bootimg_dir, kernel_dir, > | File "/home/marek/projects/kas-test/poky/scripts/lib/wic/engine.py", > line 190, in wic_create > | plugin.do_create() > | File "/home/marek/projects/kas-test/poky/scripts/lib/wic/plugins/imager/direct.py", > line 96, in do_create > | self.create() > | File "/home/marek/projects/kas-test/poky/scripts/lib/wic/plugins/imager/direct.py", > line 180, in create > | self._image.prepare(self) > | File "/home/marek/projects/kas-test/poky/scripts/lib/wic/plugins/imager/direct.py", > line 354, in prepare > | part.prepare(imager, imager.workdir, imager.oe_builddir, > | File "/home/marek/projects/kas-test/poky/scripts/lib/wic/partition.py", > line 182, in prepare > | plugin.do_prepare_partition(self, srcparams_dict, creator, > | File "/home/marek/projects/kas-test/poky/scripts/lib/wic/plugins/source/rootfs.py", > line 112, in do_prepare_partition > | copyhardlinktree(orig_dir, new_rootfs) > | File "/home/marek/projects/kas-test/poky/meta/lib/oe/path.py", > line 121, in copyhardlinktree > | subprocess.check_output(cmd, shell=True, stderr=subprocess.STDOUT) > | File "/home/marek/projects/kas-test/build/tmp/work/raspberrypi4-poky-linux-gnueabi/core-image-minimal/1.0-r0/recipe-sysroot-native/usr/lib/python3.8/subprocess.py", > line 411, in check_output > | return run(*popenargs, stdout=PIPE, timeout=timeout, check=True, > | File "/home/marek/projects/kas-test/build/tmp/work/raspberrypi4-poky-linux-gnueabi/core-image-minimal/1.0-r0/recipe-sysroot-native/usr/lib/python3.8/subprocess.py", > line 512, in run > | raise CalledProcessError(retcode, process.args, > | subprocess.CalledProcessError: Command 'cd > /home/marek/projects/kas-test/build/tmp/work/raspberrypi4-poky-linux-gnueabi/core-image-minimal/1.0-r0/bootfs.image_sdimg; > find . -type d -print | tar --xattrs --xattrs-include='*' -cf - -S -C > /home/marek/projects/kas-test/build/tmp/work/raspberrypi4-poky-linux-gnueabi/core-image-minimal/1.0-r0/bootfs.image_sdimg > -p --no-recursion --files-from - | tar --xattrs --xattrs-include='*' > -xhf - -C /home/marek/projects/kas-test/build/tmp/work/raspberrypi4-poky-linux-gnueabi/core-image-minimal/1.0-r0/deploy-core-image-minimal-image-complete/core-image-minimal-raspberrypi4-20211115212420-sdimg/tmp.wic.1oe9hwjw/rootfs2' > returned non-zero exit status 2. > > After some debugging spent by adding following issue seems to be fixed: > diff --git a/scripts/lib/wic/plugins/imager/direct.py > b/scripts/lib/wic/plugins/imager/direct.py > index 7e1c1c0..d37ecee 100644 > --- a/scripts/lib/wic/plugins/imager/direct.py > +++ b/scripts/lib/wic/plugins/imager/direct.py > @@ -115,7 +115,7 @@ class DirectPlugin(ImagerPlugin): > updated = False > for part in self.parts: > if not part.realnum or not part.mountpoint \ > - or part.mountpoint == "/": > + or part.mountpoint == "/" or part.mountpoint == "swap": > continue > if part.use_uuid: > > Does it make any sense or is it just a hack? I'm not a wic expert at all. > > Thanks and BR, > > marek > > > > -=-=-=-=-=-=-=-=-=-=-=- > Links: You receive all messages sent to this group. > View/Reply Online (#94113): https://lists.openembedded.org/g/openembedded-devel/message/94113 > Mute This Topic: https://lists.openembedded.org/mt/87280766/1997914 > Group Owner: openembedded-devel+owner@lists.openembedded.org > Unsubscribe: https://lists.openembedded.org/g/openembedded-devel/unsub [raj.khem@gmail.com] > -=-=-=-=-=-=-=-=-=-=-=- >
On Wed, Nov 24, 2021 at 5:36 PM Khem Raj <raj.khem@gmail.com> wrote: > > > > On 11/24/21 5:28 AM, Marek Belisko wrote: > > Hi, > > > > I've posted something similar on yocto mailing list but no response so > > far so trying here as wic comes from open-embedded. > > > > Please send it to openembedded-core mailing list too. Looks a sane > approach to me. Seems fix is already present in actual poky master: 37b4fa7a102f1212843411bd1d97202ba9da0e19 can it be backported to dunfell pls? Thanks. > > > With wks file like this: > > echo '### Contents of wks file ###' > > | ### Contents of wks file ### > > | + cat /home/marek/projects/kas-test/build/tmp/work/raspberrypi4-poky-linux-gnueabi/core-image-minimal/1.0-r0/mender-sdimg.wks > > | part --source rawcopy > > --sourceparams="file=/home/marek/projects/kas-test/build/tmp/work/raspberrypi4-poky-linux-gnueabi/core-image-minimal/1.0-r0/uboot.env" > > --ondisk "mmcblk0" --align 8192 --no-table > > | part --source rootfs --rootfs-dir > > /home/marek/projects/kas-test/build/tmp/work/raspberrypi4-poky-linux-gnueabi/core-image-minimal/1.0-r0/bootfs.image_sdimg > > --ondisk "mmcblk0" --fstype=vfat --label boot --align 8192 > > --fixed-size 16 --active > > | part --source rawcopy > > --sourceparams="file=/home/marek/projects/kas-test/build/tmp/work/raspberrypi4-poky-linux-gnueabi/core-image-minimal/1.0-r0/deploy-core-image-minimal-image-complete/core-image-minimal-raspberrypi4.ext4" > > --ondisk "mmcblk0" --align 8192 --fixed-size 172032k > > | part --source rawcopy > > --sourceparams="file=/home/marek/projects/kas-test/build/tmp/work/raspberrypi4-poky-linux-gnueabi/core-image-minimal/1.0-r0/deploy-core-image-minimal-image-complete/core-image-minimal-raspberrypi4.ext4" > > --ondisk "mmcblk0" --align 8192 --fixed-size 172032k > > | part swap --ondisk "mmcblk0" --fstype=swap --label swap --align 8192 > > --size 512 > > | part --source rawcopy > > --sourceparams="file=/home/marek/projects/kas-test/build/tmp/work/raspberrypi4-poky-linux-gnueabi/core-image-minimal/1.0-r0/deploy-core-image-minimal-image-complete/core-image-minimal-raspberrypi4.dataimg" > > --ondisk "mmcblk0" --align 8192 --fixed-size 128 > > | > > | bootloader --ptable msdos > > | + echo '### End of contents of wks file ###' > > | ### End of contents of wks file ### > > > > I'm seeing issue like: > > > > | INFO: Creating image(s)... > > | > > | Traceback (most recent call last): > > | File "/home/marek/projects/kas-test/poky/scripts/wic", line 542, in <module> > > | sys.exit(main(sys.argv[1:])) > > | File "/home/marek/projects/kas-test/poky/scripts/wic", line 537, in main > > | return hlp.invoke_subcommand(args, parser, hlp.wic_help_usage, > > subcommands) > > | File "/home/marek/projects/kas-test/poky/scripts/lib/wic/help.py", > > line 83, in invoke_subcommand > > | subcmd[0](args, usage) > > | File "/home/marek/projects/kas-test/poky/scripts/wic", line 219, > > in wic_create_subcommand > > | engine.wic_create(wks_file, rootfs_dir, bootimg_dir, kernel_dir, > > | File "/home/marek/projects/kas-test/poky/scripts/lib/wic/engine.py", > > line 190, in wic_create > > | plugin.do_create() > > | File "/home/marek/projects/kas-test/poky/scripts/lib/wic/plugins/imager/direct.py", > > line 96, in do_create > > | self.create() > > | File "/home/marek/projects/kas-test/poky/scripts/lib/wic/plugins/imager/direct.py", > > line 180, in create > > | self._image.prepare(self) > > | File "/home/marek/projects/kas-test/poky/scripts/lib/wic/plugins/imager/direct.py", > > line 354, in prepare > > | part.prepare(imager, imager.workdir, imager.oe_builddir, > > | File "/home/marek/projects/kas-test/poky/scripts/lib/wic/partition.py", > > line 182, in prepare > > | plugin.do_prepare_partition(self, srcparams_dict, creator, > > | File "/home/marek/projects/kas-test/poky/scripts/lib/wic/plugins/source/rootfs.py", > > line 112, in do_prepare_partition > > | copyhardlinktree(orig_dir, new_rootfs) > > | File "/home/marek/projects/kas-test/poky/meta/lib/oe/path.py", > > line 121, in copyhardlinktree > > | subprocess.check_output(cmd, shell=True, stderr=subprocess.STDOUT) > > | File "/home/marek/projects/kas-test/build/tmp/work/raspberrypi4-poky-linux-gnueabi/core-image-minimal/1.0-r0/recipe-sysroot-native/usr/lib/python3.8/subprocess.py", > > line 411, in check_output > > | return run(*popenargs, stdout=PIPE, timeout=timeout, check=True, > > | File "/home/marek/projects/kas-test/build/tmp/work/raspberrypi4-poky-linux-gnueabi/core-image-minimal/1.0-r0/recipe-sysroot-native/usr/lib/python3.8/subprocess.py", > > line 512, in run > > | raise CalledProcessError(retcode, process.args, > > | subprocess.CalledProcessError: Command 'cd > > /home/marek/projects/kas-test/build/tmp/work/raspberrypi4-poky-linux-gnueabi/core-image-minimal/1.0-r0/bootfs.image_sdimg; > > find . -type d -print | tar --xattrs --xattrs-include='*' -cf - -S -C > > /home/marek/projects/kas-test/build/tmp/work/raspberrypi4-poky-linux-gnueabi/core-image-minimal/1.0-r0/bootfs.image_sdimg > > -p --no-recursion --files-from - | tar --xattrs --xattrs-include='*' > > -xhf - -C /home/marek/projects/kas-test/build/tmp/work/raspberrypi4-poky-linux-gnueabi/core-image-minimal/1.0-r0/deploy-core-image-minimal-image-complete/core-image-minimal-raspberrypi4-20211115212420-sdimg/tmp.wic.1oe9hwjw/rootfs2' > > returned non-zero exit status 2. > > > > After some debugging spent by adding following issue seems to be fixed: > > diff --git a/scripts/lib/wic/plugins/imager/direct.py > > b/scripts/lib/wic/plugins/imager/direct.py > > index 7e1c1c0..d37ecee 100644 > > --- a/scripts/lib/wic/plugins/imager/direct.py > > +++ b/scripts/lib/wic/plugins/imager/direct.py > > @@ -115,7 +115,7 @@ class DirectPlugin(ImagerPlugin): > > updated = False > > for part in self.parts: > > if not part.realnum or not part.mountpoint \ > > - or part.mountpoint == "/": > > + or part.mountpoint == "/" or part.mountpoint == "swap": > > continue > > if part.use_uuid: > > > > Does it make any sense or is it just a hack? I'm not a wic expert at all. > > > > Thanks and BR, > > > > marek > > > > > > > > -=-=-=-=-=-=-=-=-=-=-=- > > Links: You receive all messages sent to this group. > > View/Reply Online (#94113): https://lists.openembedded.org/g/openembedded-devel/message/94113 > > Mute This Topic: https://lists.openembedded.org/mt/87280766/1997914 > > Group Owner: openembedded-devel+owner@lists.openembedded.org > > Unsubscribe: https://lists.openembedded.org/g/openembedded-devel/unsub [raj.khem@gmail.com] > > -=-=-=-=-=-=-=-=-=-=-=- > >
On Tue, Dec 7, 2021 at 12:22 AM Belisko Marek <marek.belisko@gmail.com> wrote: > > On Wed, Nov 24, 2021 at 5:36 PM Khem Raj <raj.khem@gmail.com> wrote: > > > > > > > > On 11/24/21 5:28 AM, Marek Belisko wrote: > > > Hi, > > > > > > I've posted something similar on yocto mailing list but no response so > > > far so trying here as wic comes from open-embedded. > > > > > > > Please send it to openembedded-core mailing list too. Looks a sane > > approach to me. > Seems fix is already present in actual poky master: > 37b4fa7a102f1212843411bd1d97202ba9da0e19 can it be backported to > dunfell pls? Thanks. I'll add this backport to my dunfell testing queue. Steve > > > > > With wks file like this: > > > echo '### Contents of wks file ###' > > > | ### Contents of wks file ### > > > | + cat /home/marek/projects/kas-test/build/tmp/work/raspberrypi4-poky-linux-gnueabi/core-image-minimal/1.0-r0/mender-sdimg.wks > > > | part --source rawcopy > > > --sourceparams="file=/home/marek/projects/kas-test/build/tmp/work/raspberrypi4-poky-linux-gnueabi/core-image-minimal/1.0-r0/uboot.env" > > > --ondisk "mmcblk0" --align 8192 --no-table > > > | part --source rootfs --rootfs-dir > > > /home/marek/projects/kas-test/build/tmp/work/raspberrypi4-poky-linux-gnueabi/core-image-minimal/1.0-r0/bootfs.image_sdimg > > > --ondisk "mmcblk0" --fstype=vfat --label boot --align 8192 > > > --fixed-size 16 --active > > > | part --source rawcopy > > > --sourceparams="file=/home/marek/projects/kas-test/build/tmp/work/raspberrypi4-poky-linux-gnueabi/core-image-minimal/1.0-r0/deploy-core-image-minimal-image-complete/core-image-minimal-raspberrypi4.ext4" > > > --ondisk "mmcblk0" --align 8192 --fixed-size 172032k > > > | part --source rawcopy > > > --sourceparams="file=/home/marek/projects/kas-test/build/tmp/work/raspberrypi4-poky-linux-gnueabi/core-image-minimal/1.0-r0/deploy-core-image-minimal-image-complete/core-image-minimal-raspberrypi4.ext4" > > > --ondisk "mmcblk0" --align 8192 --fixed-size 172032k > > > | part swap --ondisk "mmcblk0" --fstype=swap --label swap --align 8192 > > > --size 512 > > > | part --source rawcopy > > > --sourceparams="file=/home/marek/projects/kas-test/build/tmp/work/raspberrypi4-poky-linux-gnueabi/core-image-minimal/1.0-r0/deploy-core-image-minimal-image-complete/core-image-minimal-raspberrypi4.dataimg" > > > --ondisk "mmcblk0" --align 8192 --fixed-size 128 > > > | > > > | bootloader --ptable msdos > > > | + echo '### End of contents of wks file ###' > > > | ### End of contents of wks file ### > > > > > > I'm seeing issue like: > > > > > > | INFO: Creating image(s)... > > > | > > > | Traceback (most recent call last): > > > | File "/home/marek/projects/kas-test/poky/scripts/wic", line 542, in <module> > > > | sys.exit(main(sys.argv[1:])) > > > | File "/home/marek/projects/kas-test/poky/scripts/wic", line 537, in main > > > | return hlp.invoke_subcommand(args, parser, hlp.wic_help_usage, > > > subcommands) > > > | File "/home/marek/projects/kas-test/poky/scripts/lib/wic/help.py", > > > line 83, in invoke_subcommand > > > | subcmd[0](args, usage) > > > | File "/home/marek/projects/kas-test/poky/scripts/wic", line 219, > > > in wic_create_subcommand > > > | engine.wic_create(wks_file, rootfs_dir, bootimg_dir, kernel_dir, > > > | File "/home/marek/projects/kas-test/poky/scripts/lib/wic/engine.py", > > > line 190, in wic_create > > > | plugin.do_create() > > > | File "/home/marek/projects/kas-test/poky/scripts/lib/wic/plugins/imager/direct.py", > > > line 96, in do_create > > > | self.create() > > > | File "/home/marek/projects/kas-test/poky/scripts/lib/wic/plugins/imager/direct.py", > > > line 180, in create > > > | self._image.prepare(self) > > > | File "/home/marek/projects/kas-test/poky/scripts/lib/wic/plugins/imager/direct.py", > > > line 354, in prepare > > > | part.prepare(imager, imager.workdir, imager.oe_builddir, > > > | File "/home/marek/projects/kas-test/poky/scripts/lib/wic/partition.py", > > > line 182, in prepare > > > | plugin.do_prepare_partition(self, srcparams_dict, creator, > > > | File "/home/marek/projects/kas-test/poky/scripts/lib/wic/plugins/source/rootfs.py", > > > line 112, in do_prepare_partition > > > | copyhardlinktree(orig_dir, new_rootfs) > > > | File "/home/marek/projects/kas-test/poky/meta/lib/oe/path.py", > > > line 121, in copyhardlinktree > > > | subprocess.check_output(cmd, shell=True, stderr=subprocess.STDOUT) > > > | File "/home/marek/projects/kas-test/build/tmp/work/raspberrypi4-poky-linux-gnueabi/core-image-minimal/1.0-r0/recipe-sysroot-native/usr/lib/python3.8/subprocess.py", > > > line 411, in check_output > > > | return run(*popenargs, stdout=PIPE, timeout=timeout, check=True, > > > | File "/home/marek/projects/kas-test/build/tmp/work/raspberrypi4-poky-linux-gnueabi/core-image-minimal/1.0-r0/recipe-sysroot-native/usr/lib/python3.8/subprocess.py", > > > line 512, in run > > > | raise CalledProcessError(retcode, process.args, > > > | subprocess.CalledProcessError: Command 'cd > > > /home/marek/projects/kas-test/build/tmp/work/raspberrypi4-poky-linux-gnueabi/core-image-minimal/1.0-r0/bootfs.image_sdimg; > > > find . -type d -print | tar --xattrs --xattrs-include='*' -cf - -S -C > > > /home/marek/projects/kas-test/build/tmp/work/raspberrypi4-poky-linux-gnueabi/core-image-minimal/1.0-r0/bootfs.image_sdimg > > > -p --no-recursion --files-from - | tar --xattrs --xattrs-include='*' > > > -xhf - -C /home/marek/projects/kas-test/build/tmp/work/raspberrypi4-poky-linux-gnueabi/core-image-minimal/1.0-r0/deploy-core-image-minimal-image-complete/core-image-minimal-raspberrypi4-20211115212420-sdimg/tmp.wic.1oe9hwjw/rootfs2' > > > returned non-zero exit status 2. > > > > > > After some debugging spent by adding following issue seems to be fixed: > > > diff --git a/scripts/lib/wic/plugins/imager/direct.py > > > b/scripts/lib/wic/plugins/imager/direct.py > > > index 7e1c1c0..d37ecee 100644 > > > --- a/scripts/lib/wic/plugins/imager/direct.py > > > +++ b/scripts/lib/wic/plugins/imager/direct.py > > > @@ -115,7 +115,7 @@ class DirectPlugin(ImagerPlugin): > > > updated = False > > > for part in self.parts: > > > if not part.realnum or not part.mountpoint \ > > > - or part.mountpoint == "/": > > > + or part.mountpoint == "/" or part.mountpoint == "swap": > > > continue > > > if part.use_uuid: > > > > > > Does it make any sense or is it just a hack? I'm not a wic expert at all. > > > > > > Thanks and BR, > > > > > > marek > > > > > > > > > > > > -=-=-=-=-=-=-=-=-=-=-=- > > > Links: You receive all messages sent to this group. > > > View/Reply Online (#94113): https://lists.openembedded.org/g/openembedded-devel/message/94113 > > > Mute This Topic: https://lists.openembedded.org/mt/87280766/1997914 > > > Group Owner: openembedded-devel+owner@lists.openembedded.org > > > Unsubscribe: https://lists.openembedded.org/g/openembedded-devel/unsub [raj.khem@gmail.com] > > > -=-=-=-=-=-=-=-=-=-=-=- > > >
diff --git a/scripts/lib/wic/plugins/imager/direct.py b/scripts/lib/wic/plugins/imager/direct.py index 7e1c1c0..d37ecee 100644 --- a/scripts/lib/wic/plugins/imager/direct.py +++ b/scripts/lib/wic/plugins/imager/direct.py @@ -115,7 +115,7 @@ class DirectPlugin(ImagerPlugin): updated = False for part in self.parts: if not part.realnum or not part.mountpoint \ - or part.mountpoint == "/": + or part.mountpoint == "/" or part.mountpoint == "swap": continue if part.use_uuid: