Not bootable Debian i386 image using an i386 container running in a amd64 host

16 views
Skip to first unread message

Massi aka Ergosum

unread,
Nov 17, 2024, 1:54:37 PM11/17/24
to kiwi
Hello,
I'm trying to build a Debian i386  image using kiwi-ng 10.1.18 that runs inside the following container:

https://hub.docker.com/r/i386/debian/

The container runs using podman on a amd64 host.
From inside the container:

# dpkg --print-architecture
i386
# uname -m
x86_64

The build works fine, and everything is installed as expected (even the i686-PAE kernel).
But the result image has the x86_64 extension and the .iso is not bootable at all.
Some info compared to a good image:

$ isoinfo -d -i GoodImage.x86_64-x.y.z.iso
D-ROM is in ISO 9660 format
System id:
Volume id: Debian_Remix
Volume set id:
Publisher id: SUSE LINUX GMBH
Data preparer id: KIWI - HTTPS://GITHUB.COM/OSINSIDE/KIWI
Application id: 0X5C90FABD
Copyright File id:
Abstract File id:
Bibliographic File id:
Volume set size is: 1
Volume set sequence number is: 1
Logical block size is: 2048
Volume size is: 621412
El Torito VD version 1 found, boot catalog is in sector 200
Joliet with UCS level 3 found
Rock Ridge signatures version 1 found
Eltorito validation header:
    Hid 1
    Arch 0 (x86)
    ID ''
    Key 55 AA
    Eltorito defaultboot header:
        Bootid 88 (bootable)
        Boot media 0 (No Emulation Boot)
        Load segment 0
        Sys type 0
        Nsect 4
       
$ isoinfo -d -i NotBootable.x86_64-x.y.z.iso
CD-ROM is in ISO 9660 format
System id:
Volume id: TDE_Remix
Volume set id:
Publisher id: SUSE LINUX GMBH
Data preparer id: KIWI - HTTPS://GITHUB.COM/OSINSIDE/KIWI
Application id: 0X5C65CFE0
Copyright File id:
Abstract File id:
Bibliographic File id:
Volume set size is: 1
Volume set sequence number is: 1
Logical block size is: 2048
Volume size is: 261294
Joliet with UCS level 3 found
Rock Ridge signatures version 1 found

Any idea about how to create a bootable image or about to convert the bad one?

Thanks
Massi

Marcus Schäfer

unread,
Nov 17, 2024, 5:54:18 PM11/17/24
to kiwi-...@googlegroups.com
Hi,

> https://hub.docker.com/r/i386/debian/
> The container runs using podman on a amd64 host.

ok

> From inside the container:
> # dpkg --print-architecture
> i386
> # uname -m
> x86_64
> The build works fine, and everything is installed as expected (even the
> i686-PAE kernel).
> But the result image has the x86_64 extension and the .iso is not
> bootable at all.

Only setting the architecture for the repos to 32bit x86 might
not be enough here because there are still a couple of tools called
from the container as 64bit x86 applications.

From my perspective building 32bit x86 images can only work reliable
if you build from a 32bit x86 container. Given you have an ix86
container at hand you should be able to run it via:

linux32 podman ...

For real multiarch builds I usually fetch multiarch qemu binfmts via

sudo podman run --rm --privileged \
docker.io/multiarch/qemu-user-static --reset -p yes

and run e.g. aarch64 builds on x86_64. But you need a container
of the desired architecture. I haven't built any 32bit only images
for x86 since several years and the distros I use do not even
build 32bit packages :) Thus I'm sorry this is outside of our
integration test matrix. The linux32 invocation should however
do the trick

Best regards,
Marcus
--
Public Key available via: https://keybase.io/marcus_schaefer/key.asc
keybase search marcus_schaefer
signature.asc

Massi aka Ergosum

unread,
Nov 24, 2024, 2:46:03 PM11/24/24
to kiwi-...@googlegroups.com
Hi,

Il giorno dom 17 nov 2024 alle ore 23:54 Marcus Schäfer
<marcus....@gmail.com> ha scritto:
>
> Only setting the architecture for the repos to 32bit x86 might
> not be enough here because there are still a couple of tools called
> from the container as 64bit x86 applications.
>
> From my perspective building 32bit x86 images can only work reliable
> if you build from a 32bit x86 container. Given you have an ix86
> container at hand you should be able to run it via:
>
> linux32 podman ...
>

You're right, I used the '--arch=i386', that's good, but it's not enough.
So I tried:

$ podman exec tdebuild-i386 linux32 kiwi-ng

and everything runs fine. The resulting image now has the ix86
extension, but it is still not bootable.

> For real multiarch builds I usually fetch multiarch qemu binfmts via
>
> sudo podman run --rm --privileged \
> docker.io/multiarch/qemu-user-static --reset -p yes
>
> and run e.g. aarch64 builds on x86_64. But you need a container
> of the desired architecture. I haven't built any 32bit only images
> for x86 since several years and the distros I use do not even
> build 32bit packages :) Thus I'm sorry this is outside of our
> integration test matrix. The linux32 invocation should however
> do the trick
>

I see from log that the image is built using the command:

/usr/bin/xorriso -application_id 0xe58618a7 -publisher SUSE LINUX GmbH
-preparer_id KIWI - https://github.com/OSInside/kiwi
-volid TDE_Remix -joliet on -padding 0 -outdev
/live/target/TDE-Remix.ix86-12.8.0.iso
-map /live/target/live-media.jtd6_61q / -chmod 0755 / --
-boot_image any partition_offset=16 -boot_image any
cat_path=boot/ix86/boot.catalog
-boot_image any cat_hidden=on -boot_image any boot_info_table=on
-boot_image any platform_id=0x00
-boot_image any emul_type=no_emulation -boot_image any load_size=2048

So I investigated the 'xorriso' command. Then I patched the image like
the following:

podman exec tdebuild-i386 xorriso -indev
/live/target/TDE-Remix.ix86-12.8.0.iso \
-outdev /live/target/TDE-Remix.i386.iso -publisher TDE_Remix \
-boot_image grub bin_path=boot/ix86/loader/eltorito.img \
-boot_image grub grub2_mbr=/lib/grub/i386-pc/boot_hybrid.img \
-boot_image any grub2_boot_info=on -boot_image any boot_info_table=on \
-boot_image any platform_id=0x00 -boot_image any emul_type=no_emulation \
-joliet on -commit_eject all

Now the image boots using both qemu-kvm virtualization and physical
legacy BIOS (see attached image).

I documented the procedure here [1] and here [2].
Hope this helps.

Regards
Massi


[1] https://github.com/mbugni/tde-remix
[2] https://github.com/mbugni/tde-remix/blob/main/how-to-build-i386.md
tde_remix_i386.jpg
Reply all
Reply to author
Forward
0 new messages