[PATCH 2/2] isoimage-isohybrid-isar: fix disk full if no initrd exists

2 views
Skip to first unread message

Quirin Gylstorff

unread,
Nov 26, 2025, 6:44:56 AM (9 days ago) Nov 26
to isar-...@googlegroups.com
From: Quirin Gylstorff <quirin.g...@siemens.com>

If no initrd was generated during the rootfs build the wic plugin
uses the existing rootfs as initrd. The plugin uses shutil.copytree
to copy the rootfs to a new folder. As the rootfs contains `/dev/full`
this will fill the disk until it is full.

To avoid this error ignore all files in `/dev/` of the rootfs.

Tested-by: Herbert Bernecker <herbert....@siemens.com>
Signed-off-by: Quirin Gylstorff <quirin.g...@siemens.com>
---
.../lib/wic/plugins/source/isoimage-isohybrid-isar.py | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/meta/scripts/lib/wic/plugins/source/isoimage-isohybrid-isar.py b/meta/scripts/lib/wic/plugins/source/isoimage-isohybrid-isar.py
index 690e291e..fb6c6b39 100644
--- a/meta/scripts/lib/wic/plugins/source/isoimage-isohybrid-isar.py
+++ b/meta/scripts/lib/wic/plugins/source/isoimage-isohybrid-isar.py
@@ -203,8 +203,14 @@ class IsoImagePlugin(SourcePlugin):
# Create initrd from rootfs directory
initrd = "%s/initrd.cpio.gz" % cr_workdir
initrd_dir = "%s/INITRD" % cr_workdir
+ def ignore_contents(src, names):
+ if os.path.basename(src) == 'dev':
+ return names
+ return []
+
shutil.copytree("%s" % rootfs_dir, \
- "%s" % initrd_dir, symlinks=True)
+ "%s" % initrd_dir, \
+ ignore=ignore_contents, symlinks=True)

if os.path.isfile("%s/init" % rootfs_dir):
shutil.copy2("%s/init" % rootfs_dir, "%s/init" % initrd_dir)
--
2.51.2

Quirin Gylstorff

unread,
Nov 26, 2025, 6:44:56 AM (9 days ago) Nov 26
to isar-...@googlegroups.com
From: Quirin Gylstorff <quirin.g...@siemens.com>

This fixes the following error:

ERROR: _exec_cmd: export PATH=//sbin://usr/sbin://usr/bin://usr/bin/None://bin:None:$PATH;/usr/bin/python3-native/python3 /usr/bin/bmaptool create /tmp/isar-image-base-debian-bookworm-qemuamd64-iso.wic/tmp.wic.h061sjt6/isohybrid-efi-202511201339-cd.direct -o /tmp/isar-image-base-debian-bookworm-qemuamd64-iso.wic/tmp.wic.h061sjt6/isohybrid-efi-202511201339-cd.direct.bmap returned '1' instead of 0
| output: bmaptool: ERROR: An error occurred, here is the traceback:
| Traceback (most recent call last):
| File "/usr/lib/python3/dist-packages/bmaptools/BmapCreate.py", line 200, in _open_image_file
| self._f_image = open(self._image_path, 'rb')
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
| FileNotFoundError: [Errno 2] No such file or directory: '/tmp/isar-image-base-debian-bookworm-qemuamd64-iso.wic/tmp.wic.h061sjt6/isohybrid-efi-202511201339-cd.direct'
|
| During handling of the above exception, another exception occurred:
|
| Traceback (most recent call last):
| File "/usr/lib/python3/dist-packages/bmaptools/CLI.py", line 555, in create_command
| creator = BmapCreate.BmapCreate(args.image, output, "sha256")
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
| File "/usr/lib/python3/dist-packages/bmaptools/BmapCreate.py", line 166, in __init__
| self._open_image_file()
| File "/usr/lib/python3/dist-packages/bmaptools/BmapCreate.py", line 202, in _open_image_file
| raise Error("cannot open image file '%s': %s"
|
| bmaptool: ERROR: cannot open image file '/tmp/isar-image-base-debian-bookworm-qemuamd64-iso.wic/tmp.wic.h061sjt6/isohybrid-efi-202511201339-cd.direct': [Errno 2] No such file or directory: '/tmp/isar-image-base-debian-bookworm-qemuamd64-iso.wic/tmp.wic.h061sjt6/isohybrid-efi-202511201339-cd.direct'

Tested-by: Herbert Bernecker <herbert....@siemens.com>
Signed-off-by: Quirin Gylstorff <quirin.g...@siemens.com>
---

This is already broken in bitbake upstream and I will also sent the patch there.
Quirin
meta/scripts/lib/wic/plugins/source/isoimage-isohybrid-isar.py | 1 +
1 file changed, 1 insertion(+)

diff --git a/meta/scripts/lib/wic/plugins/source/isoimage-isohybrid-isar.py b/meta/scripts/lib/wic/plugins/source/isoimage-isohybrid-isar.py
index b46527b8..690e291e 100644
--- a/meta/scripts/lib/wic/plugins/source/isoimage-isohybrid-isar.py
+++ b/meta/scripts/lib/wic/plugins/source/isoimage-isohybrid-isar.py
@@ -533,3 +533,4 @@ class IsoImagePlugin(SourcePlugin):
os.remove(disk.path)
shutil.copy2(iso_img, full_path_iso)
shutil.copy2(full_path_iso, full_path)
+ disk.path=full_path
--
2.51.2

Quirin Gylstorff

unread,
Nov 27, 2025, 6:10:29 AM (8 days ago) Nov 27
to isar-...@googlegroups.com


On 11/26/25 12:43, 'Quirin Gylstorff' via isar-users wrote:
> From: Quirin Gylstorff <quirin.g...@siemens.com>
>
> If no initrd was generated during the rootfs build the wic plugin
> uses the existing rootfs as initrd. The plugin uses shutil.copytree
> to copy the rootfs to a new folder. As the rootfs contains `/dev/full`
> this will fill the disk until it is full.
>
> To avoid this error ignore all files in `/dev/` of the rootfs.
>
> Tested-by: Herbert Bernecker <herbert....@siemens.com>
> Signed-off-by: Quirin Gylstorff <quirin.g...@siemens.com>
> ---
/dev should be populate by mmdebstrap so another way should be
--skip=output/mknod or --skip=output/dev but during the initial
testing these option broke package builds.

Quirin

Zhihang Wei

unread,
Nov 28, 2025, 4:02:48 AM (7 days ago) Nov 28
to Quirin Gylstorff, isar-...@googlegroups.com


On 11/27/25 12:10, 'Quirin Gylstorff' via isar-users wrote:
>
>
> On 11/26/25 12:43, 'Quirin Gylstorff' via isar-users wrote:
>> From: Quirin Gylstorff <quirin.g...@siemens.com>
>>
>> If no initrd was generated during the rootfs build the wic plugin
>> uses the existing rootfs as initrd. The plugin uses shutil.copytree
>> to copy the rootfs to a new folder. As the rootfs contains `/dev/full`
>> this will fill the disk until it is full.
>>
>> To avoid this error ignore all files in `/dev/` of the rootfs.
>>
>> Tested-by:    Herbert Bernecker <herbert....@siemens.com>
>> Signed-off-by: Quirin Gylstorff <quirin.g...@siemens.com>
>> ---
> /dev should be populate by mmdebstrap so another way should be
> --skip=output/mknod or  --skip=output/dev  but during the initial
> testing these option broke package builds.
>
> Quirin
>
This patch has passed CI and LGTM. We'll merge this by end of this
workday if no more discussion is coming.

Zhihang

Zhihang Wei

unread,
Nov 28, 2025, 11:07:26 AM (7 days ago) Nov 28
to Quirin Gylstorff, isar-...@googlegroups.com
Applied to next, thanks.

Zhihang

On 11/26/25 12:43, 'Quirin Gylstorff' via isar-users wrote:
Reply all
Reply to author
Forward
0 new messages