Bug 15951 - poky/scripts/lib/wic/partition.py: add du --apparent-size to solve build error on compressed ZFS dataset
Summary: poky/scripts/lib/wic/partition.py: add du --apparent-size to solve build erro...
Status: ACCEPTED
Alias: None
Product: Wic
Classification: Yocto Project Subprojects
Component: wic (show other bugs)
Version: v0.3.0
Hardware: x86 Multiple
: Medium normal
Target Milestone: v0.4.0
Assignee: Trevor Woerner
QA Contact:
URL:
Whiteboard:
Depends on:
Blocks:
 
Reported: 2025-08-13 05:47 UTC by Wojciech Niziński
Modified: 2026-08-07 19:38 UTC (History)
3 users (show)

See Also:
OS type for building Yocto: ---
Type of Regression: ---
Verified:
Documentation change: No (bug/feature does not impact docs)


Attachments
patch proposal (1.13 KB, patch)
2025-08-13 05:47 UTC, Wojciech Niziński
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Wojciech Niziński 2025-08-13 05:47:57 UTC
Created attachment 5132 [details]
patch proposal

Buildiing in LXC container on ZFS dataset with compression enabled:

ERROR: core-image-minimal-1.0-r0 do_image_wic: ExecutionError('build/tmp/work/.../core-image-minimal/1.0/temp/run.do_image_wic.1471812', 1, None, None)
...

| Writing inode tables: done 
| Creating journal (4096 blocks): done
| Copying files into the device: __populate_fs: Could not allocate block in ext2 filesystem while writing file "cc1"
| mkfs.ext4: Could not allocate block in ext2 filesystem while populating file system
| 512
| 
| WARNING: exit code 1 from a shell command.


Similar problem (https://lists.yoctoproject.org/g/poky/topic/image_bbclass/81548542) in image.bblcass was solved with commits:

https://git.yoctoproject.org/poky/commit/?h=master-next&id=3743234dab23e4068e1d1fde9e1fa0bc09fdb182

https://git.yoctoproject.org/poky/commit/?h=master-next&id=f7ed81182c7797fd6b0069fa5c90535b13848657

Now function prepare_root_fs_ext() in file poky/scripts/lib/wic/partition.py needs similar fix.
Comment 1 Randy MacLeod 2025-08-14 14:38:59 UTC
Ross will want to look at this when he's back.
The code involved may need a re-write.
Comment 2 Victor Johan Hansen 2026-01-23 08:21:07 UTC
(In reply to Randy MacLeod from comment #1)
> Ross will want to look at this when he's back.
> The code involved may need a re-write.

This patch also resolves spurious 
'ERROR: Actual rootfs size (y kB) is larger than allowed size x kB' failures when building wic images on ZFS hosts.

The root cause: du -ks reports disk usage based on allocated blocks, which on ZFS varies depending on pool fragmentation and fill level. This means identical builds can report different sizes across builders:

builder 1 - du -ks: 281870 kB
builder 2 - du -ks: 281534 kB

The ERROR becomes more prevalent when your target rootfs reaches capacity, i.e. less "wiggle room".


Would it be possible to backport this fix to scarthgap?
Comment 3 Ross Burton 2026-03-12 15:11:54 UTC
As this is a wic issue I'm going to throw it to Trevor :)
Comment 4 Randy MacLeod 2026-06-04 15:17:15 UTC
Trevor, Does this patch work for you ?