Skip to content

Conversation

@lzap
Copy link
Contributor

@lzap lzap commented Dec 3, 2025

When using virt-install --location disk.iso the libosinfo library is used to detect operating system and path to kernel and initramdisk on the ISO image. This is done by comparing disk label against its database of known OSes.

While most of the images I tested do work, to fully ensure this is the case and to prevent regressions, let's run this tool after image is built in case it is an ISO.

For unknown OS versions, the database contains "unknown" entries which are still recognized as unreleased versions, so this should work even if our runners will have older version of the library.


Closes: https://issues.redhat.com/browse/HMS-9801

@lzap lzap requested review from a team, achilleas-k and thozza as code owners December 3, 2025 16:15
@lzap lzap requested a review from croissanne December 3, 2025 16:15
mvo5
mvo5 previously approved these changes Dec 3, 2025
Copy link
Contributor

@mvo5 mvo5 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice!

supakeen
supakeen previously approved these changes Dec 3, 2025
@supakeen
Copy link
Member

supakeen commented Dec 3, 2025

Needs linter appeasement.

@achilleas-k
Copy link
Member

Python test script linting isn't a required check, but let's be clean here and fix them before merging :)

@lzap lzap dismissed stale reviews from supakeen and mvo5 via 2aa9d3e December 3, 2025 17:51
@lzap lzap force-pushed the libosinfo1-HMS-9801 branch from 4fabbfe to 2aa9d3e Compare December 3, 2025 17:51
@lzap
Copy link
Contributor Author

lzap commented Dec 3, 2025

Fixed linter, let's see if all ISOs have correct OS labels. Oh wait, since this is a change in build-image, I need to bump seed I guess? Maybe I should move it somewhere else?

achilleas-k
achilleas-k previously approved these changes Dec 3, 2025
supakeen
supakeen previously approved these changes Dec 3, 2025
@lzap
Copy link
Contributor Author

lzap commented Dec 4, 2025

Aha, Fedoras are not detected, our runner is likely CentOS? Need to figure out how to fetch latest and greatest libos database.

✅ Build finished!!
🔍 Testing ISO installer with libosinfo: build/fedora_42-x86_64-minimal_installer-empty/bootiso/installer.iso
❌ osinfo-detect output does not detect the image as a valid installer:
Media is bootable.

@lzap lzap dismissed stale reviews from supakeen and achilleas-k via a13ca29 December 4, 2025 06:53
@lzap lzap force-pushed the libosinfo1-HMS-9801 branch from 2aa9d3e to a13ca29 Compare December 4, 2025 06:53
@lzap
Copy link
Contributor Author

lzap commented Dec 4, 2025

Ok, added the following to install_dependencies:

# latest database for libosinfo-detect checks
OSDB_DIR=$(mktemp -d -t osinfodb.XXXXXX)/osinfo-db
cleanup() {
        test "$OSDB_DIR" && rm -rf "$OSDB_DIR"
}
trap cleanup EXIT INT TERM

git clone https://gitlab.com/libosinfo/osinfo-db "$OSDB_DIR"
pushd "$OSDB_DIR"
# install into $HOME/.config/osinfo
make install -j2
popd

@lzap
Copy link
Contributor Author

lzap commented Dec 4, 2025

The only ISO images that fail the test are those which are minimal-installer which is because the ISO label is set to "Unknown":

iso_label: "Unknown"

Actually, our ISO label is in the form of Fedora-44-XXX-x86_64 where XXX is one of Everything, Workstation, IoT, or Unknown. This does not match the official Fedora media ISO labels which are in the form of:

$ grep volume-id /usr/share/osinfo/os/fedoraproject.org/* | grep fedora-41
/usr/share/osinfo/os/fedoraproject.org/fedora-41.xml:        <volume-id>Fedora-WS-Live-41.*</volume-id>
/usr/share/osinfo/os/fedoraproject.org/fedora-41.xml:        <volume-id>Fedora-S-dvd-x86_64-41</volume-id>
/usr/share/osinfo/os/fedoraproject.org/fedora-41.xml:        <volume-id>Fedora-S-dvd-x86_64-41</volume-id>
/usr/share/osinfo/os/fedoraproject.org/fedora-41.xml:        <volume-id>Fedora-S-dvd-aarch64-41</volume-id>
/usr/share/osinfo/os/fedoraproject.org/fedora-41.xml:        <volume-id>Fedora-S-dvd-aarch64-41</volume-id>
/usr/share/osinfo/os/fedoraproject.org/fedora-41.xml:        <volume-id>Fedora-S-dvd-s390x-41</volume-id>
/usr/share/osinfo/os/fedoraproject.org/fedora-41.xml:        <volume-id>Fedora-S-dvd-s390x-41</volume-id>
/usr/share/osinfo/os/fedoraproject.org/fedora-41.xml:        <volume-id>Fedora-E-dvd-x86_64-41</volume-id>
/usr/share/osinfo/os/fedoraproject.org/fedora-41.xml:        <volume-id>Fedora-E-dvd-aarch64-41</volume-id>
/usr/share/osinfo/os/fedoraproject.org/fedora-41.xml:        <volume-id>Fedora-E-dvd-s390x-41</volume-id>

The libosinfo library makes a heuristic guess of the OS if the label does not match exactly, but the Fedora-44-Unknown-x86_64 does not work as it probably does not know if this is Everything or Server.

Therefore I suggest to update our ISO labels to align with the official ISO labels so that the test is passing. Alternatively, we can find our own label that will pass the heuristic check as Fedora.

@supakeen
Copy link
Member

supakeen commented Dec 4, 2025

The only ISO images that fail the test are those which are minimal-installer which is because the ISO label is set to "Unknown":

iso_label: "Unknown"

Actually, our ISO label is in the form of Fedora-44-XXX-x86_64 where XXX is one of Everything, Workstation, IoT, or Unknown. This does not match the official Fedora media ISO labels which are in the form of:

$ grep volume-id /usr/share/osinfo/os/fedoraproject.org/* | grep fedora-41
/usr/share/osinfo/os/fedoraproject.org/fedora-41.xml:        <volume-id>Fedora-WS-Live-41.*</volume-id>
/usr/share/osinfo/os/fedoraproject.org/fedora-41.xml:        <volume-id>Fedora-S-dvd-x86_64-41</volume-id>
/usr/share/osinfo/os/fedoraproject.org/fedora-41.xml:        <volume-id>Fedora-S-dvd-x86_64-41</volume-id>
/usr/share/osinfo/os/fedoraproject.org/fedora-41.xml:        <volume-id>Fedora-S-dvd-aarch64-41</volume-id>
/usr/share/osinfo/os/fedoraproject.org/fedora-41.xml:        <volume-id>Fedora-S-dvd-aarch64-41</volume-id>
/usr/share/osinfo/os/fedoraproject.org/fedora-41.xml:        <volume-id>Fedora-S-dvd-s390x-41</volume-id>
/usr/share/osinfo/os/fedoraproject.org/fedora-41.xml:        <volume-id>Fedora-S-dvd-s390x-41</volume-id>
/usr/share/osinfo/os/fedoraproject.org/fedora-41.xml:        <volume-id>Fedora-E-dvd-x86_64-41</volume-id>
/usr/share/osinfo/os/fedoraproject.org/fedora-41.xml:        <volume-id>Fedora-E-dvd-aarch64-41</volume-id>
/usr/share/osinfo/os/fedoraproject.org/fedora-41.xml:        <volume-id>Fedora-E-dvd-s390x-41</volume-id>

The libosinfo library makes a heuristic guess of the OS if the label does not match exactly, but the Fedora-44-Unknown-x86_64 does not work as it probably does not know if this is Everything or Server.

Therefore I suggest to update our ISO labels to align with the official ISO labels so that the test is passing. Alternatively, we can find our own label that will pass the heuristic check as Fedora.

The problem is that we do, indeed, not know what is in the ISO (in the case of image-installer). It could be called Everything or Server; but both would be wrong.

Looking at that list I assume it also doesn't really know the Fedora KDE, or any Fedora spins ISOs or how does that work? Is it just about the ordering of the fields or do we need to match those exactly?

@lzap lzap force-pushed the libosinfo1-HMS-9801 branch from a13ca29 to 881f162 Compare December 4, 2025 12:56
@lzap
Copy link
Contributor Author

lzap commented Dec 4, 2025

The problem is that we do, indeed, not know what is in the ISO (in the case of image-installer). It could be called Everything or Server; but both would be wrong.

Yeah but does it matter for the ISO label and detected OS for virtualization? Typically, this is to pickup correct drivers and find kernel location, which is always the same for all variants. Let me know to set Everything instead of Unknown to see if this fix the tests.

Looking at that list I assume it also doesn't really know the Fedora KDE, or any Fedora spins ISOs or how does that work? Is it just about the ordering of the fields or do we need to match those exactly?

The heuristic behavior is a bit cryptic, I could not figure out how exactly it works from the code.

@supakeen
Copy link
Member

supakeen commented Dec 4, 2025

The problem is that we do, indeed, not know what is in the ISO (in the case of image-installer). It could be called Everything or Server; but both would be wrong.

Yeah but does it matter for the ISO label and detected OS for virtualization? Typically, this is to pickup correct drivers and find kernel location, which is always the same for all variants. Let me know to set Everything instead of Unknown to see if this fix the tests.

What do you mean by this? I think we've already established that when using virt-install one should use the --cdrom option (and not --location), in the former case I don't think the kernel location matters?

Looking at that list I assume it also doesn't really know the Fedora KDE, or any Fedora spins ISOs or how does that work? Is it just about the ordering of the fields or do we need to match those exactly?

The heuristic behavior is a bit cryptic, I could not figure out how exactly it works from the code.

I'll try out some things :)

@supakeen
Copy link
Member

supakeen commented Dec 4, 2025

This doesn't seem to function based on volume id or application ID, e.g. if I take a minimal-installer ISO and set them to the same values as Fedora-KDE-Desktop-Live-43-1.6.x86_64.iso.

sudo xorriso -dev ./fedora-43-minimal-installer-x86_64/fedora-43-minimal-installer-x86_64.iso \
  -volid 'Fedora-KDE-Live-43' \
  -application_id 'FEDORA-KDE_DESKTOP-LIVE-43'

Then osinfo-detect doesn't detect it as Fedora:

€ isoinfo -d -i fedora-43-minimal-installer-x86_64/fedora-43-minimal-installer-x86_64.iso
CD-ROM is in ISO 9660 format
System id: LINUX
Volume id: Fedora-KDE-Live-43
Volume set id: 
Publisher id: 
Data preparer id: XORRISO-1.5.6 2023.06.07.180001, LIBISOBURN-1.5.6, LIBISOFS-1.5.6, LIBBURN-1.5.6
Application id: FEDORA-KDE_DESKTOP-LIVE-43
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: 1340850
NO Joliet present
Rock Ridge signatures version 1 found

and

€ osinfo-detect fedora-43-minimal-installer-x86_64/fedora-43-minimal-installer-x86_64.iso
Media is not bootable.

Since it's now entirely seen as unbootable perhaps I fiddled up my xorriso command so I'll tinker more.

I've also fiddled with the publisher ID and some other fields.

@supakeen
Copy link
Member

supakeen commented Dec 4, 2025

Ok, my previous comment was wrong because I was holding xorrisofs wrong and overwriting the boot image. It does seem to indeed be based on the volume label only.

@supakeen
Copy link
Member

supakeen commented Dec 4, 2025

Right, so we're actually matching fedora-unknown.xml since there are no specifics for 42 or 43. In that case we can use a volume ID of: Fedora-.*-dvd-x86_64-(4[2-9]|[5-9][0-9]) (for example: Fedora-Unknown-dvd-x86_64-43) which will detect it as Media is an installer for OS 'Fedora (x86_64)'.

Alternatively we can set the id to something that matches Fedora-.*-Live-(4[2-9]|[5-9][0-9]).* but that wouldn't be applicable here.

Note that all of this only works for x86_64, here's (for example) the output on an official Fedora aarch64 ISO:

€ osinfo-detect ~/tmp/Fedora-Server-netinst-aarch64-43-1.6.iso
Media is bootable.

And Fedora Server's x86 network installer 'lies' and labels itself as Fedora-S-dvd-x86_64-43 maybe also to confuse libosinfo?

This is messy stuff.

It also detects the aarch64 live installer as x86_64:

€ osinfo-detect ~/tmp/Fedora-Workstation-Live-43-1.6.aarch64.iso 
Media is bootable.
Media is an installer for OS 'Fedora (x86_64)'
Media is live media for OS 'Fedora (x86_64)'

@lzap
Copy link
Contributor Author

lzap commented Dec 4, 2025

I like the idea of relying on fedora-unknown.xml but it really seems it does not have any entry for aarch64 for some reason. Maybe I can send them a patch?

<?xml version="1.0"?>
<libosinfo version="0.0.1">
  <!-- Licensed under the GNU General Public License version 2 or later.
     See http://www.gnu.org/licenses/ for a copy of the license text -->
  <os id="http://fedoraproject.org/fedora/unknown">
    <short-id>fedora-unknown</short-id>
    <name>Fedora</name>
    <family>linux</family>
    <distro>fedora</distro>
    <upgrades id="http://fedoraproject.org/fedora/rawhide"/>
    <derives-from id="http://fedoraproject.org/fedora/rawhide"/>
    <release-status>prerelease</release-status>
    <media arch="x86_64">
      <iso>
        <volume-id>Fedora-.*-dvd-x86_64-(4[2-9]|[5-9][0-9])</volume-id>
      </iso>
      <kernel>images/pxeboot/vmlinuz</kernel>
      <initrd>images/pxeboot/initrd.img</initrd>
    </media>
    <media arch="x86_64" live="true">
      <iso>
        <volume-id>Fedora-.*-Live-(4[2-9]|[5-9][0-9]).*</volume-id>
      </iso>
      <kernel>images/pxeboot/vmlinuz</kernel>
      <initrd>images/pxeboot/initrd.img</initrd>
    </media>
    <tree arch="x86_64">
      <treeinfo>
        <family>Fedora</family>
        <version>(4[2-9]|[5-9][0-9])</version>
        <arch>x86_64</arch>
      </treeinfo>
    </tree>
    <resources arch="all">
      <minimum>
        <n-cpus>1</n-cpus>
        <cpu>2000000000</cpu>
        <ram>2147483648</ram>
        <storage>16106127360</storage>
      </minimum>
      <recommended>
        <ram>4294967296</ram>
        <storage>21474836480</storage>
      </recommended>
    </resources>
  </os>
</libosinfo>

Edit: Looks really like an oversight on their side because RHEL has all arches. Let me do a patch into the DB.

@lzap
Copy link
Contributor Author

lzap commented Dec 4, 2025

@supakeen
Copy link
Member

supakeen commented Dec 4, 2025

I like the idea of relying on fedora-unknown.xml but it really seems it does not have any entry for aarch64 for some reason. Maybe I can send them a patch?

<?xml version="1.0"?>
<libosinfo version="0.0.1">
  <!-- Licensed under the GNU General Public License version 2 or later.
     See http://www.gnu.org/licenses/ for a copy of the license text -->
  <os id="http://fedoraproject.org/fedora/unknown">
    <short-id>fedora-unknown</short-id>
    <name>Fedora</name>
    <family>linux</family>
    <distro>fedora</distro>
    <upgrades id="http://fedoraproject.org/fedora/rawhide"/>
    <derives-from id="http://fedoraproject.org/fedora/rawhide"/>
    <release-status>prerelease</release-status>
    <media arch="x86_64">
      <iso>
        <volume-id>Fedora-.*-dvd-x86_64-(4[2-9]|[5-9][0-9])</volume-id>
      </iso>
      <kernel>images/pxeboot/vmlinuz</kernel>
      <initrd>images/pxeboot/initrd.img</initrd>
    </media>
    <media arch="x86_64" live="true">
      <iso>
        <volume-id>Fedora-.*-Live-(4[2-9]|[5-9][0-9]).*</volume-id>
      </iso>
      <kernel>images/pxeboot/vmlinuz</kernel>
      <initrd>images/pxeboot/initrd.img</initrd>
    </media>
    <tree arch="x86_64">
      <treeinfo>
        <family>Fedora</family>
        <version>(4[2-9]|[5-9][0-9])</version>
        <arch>x86_64</arch>
      </treeinfo>
    </tree>
    <resources arch="all">
      <minimum>
        <n-cpus>1</n-cpus>
        <cpu>2000000000</cpu>
        <ram>2147483648</ram>
        <storage>16106127360</storage>
      </minimum>
      <recommended>
        <ram>4294967296</ram>
        <storage>21474836480</storage>
      </recommended>
    </resources>
  </os>
</libosinfo>

Edit: Looks really like an oversight on their side because RHEL has all arches. Let me do a patch into the DB.

We'd also need to get new version in Fedora, CentOS and RHEL as they all have versions of about a year or two old which don't know any other things otherwise the end result for users is the same (but not for our tests?).

@lzap
Copy link
Contributor Author

lzap commented Dec 4, 2025

We'd also need to get new version in Fedora, CentOS and RHEL

Let's backport this into CentOS Stream 9 and 10 perhaps? I can do that. Maybe this database is subject of regular rebasing even.

Let me try to use the proposed XML change and update our labels to match it to see if that actually works.

@lzap lzap force-pushed the libosinfo1-HMS-9801 branch from 881f162 to 3dc8293 Compare December 5, 2025 08:58
@lzap
Copy link
Contributor Author

lzap commented Dec 5, 2025

How about this, reworded the commit message, simplified it quite a bit. Let's just do this for intel and add a patch that will land later to fix this on all arches.

Copy link
Member

@supakeen supakeen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The change to ISO labels here will need to be approved by the respective owners of those artifacts and perhaps QA and releng (I don't know if they use ISO labels anywhere for the compose or to identify media; hopefully not) since we produce these in Fedora's compose process before this can be merged. I'll request changes based on that and then you can reach out to them.

I'd much prefer this to be the other way around and to teach libosinfo (or I guess osinfo-db) to understand our labels but that might be excessively hard.

@lzap
Copy link
Contributor Author

lzap commented Dec 5, 2025

I'll request changes based on that and then you can reach out to them.

Can you elaborate on this? Not sure what you mean by requesting changes.

@supakeen
Copy link
Member

supakeen commented Dec 5, 2025

I'll request changes based on that and then you can reach out to them.

Can you elaborate on this? Not sure what you mean by requesting changes.

I set my review status on this PR to 'request changes' which means it can't be merged without dismissing my comment which hopefully makes sure we don't accidentally change ISO labels on Fedora artifacts without informing/asking the people who own/test these iamges :)

When using virt-install --location disk.iso the libosinfo library is
used to detect operating system and path to kernel and initramdisk on
the ISO image. This is done by comparing disk label against its database
of known OSes.

While most of the images I tested do work, to fully ensure this is the
case and to prevent regressions, let's run this tool after image is
built in case it is an ISO.

For unknown OS versions, the database contains "unknown" entries which
are still recognized as unreleased versions, so this should work even if
our runners will have older version of the library. This works for RHEL,
but not for Fedora where we must use "dvd" suffix. It also does not work
for non-x86_64 architectures so added a workaround until this is fixed
in the libosdb.

Signed-off-by: Lukas Zapletal <[email protected]>
@lzap lzap force-pushed the libosinfo1-HMS-9801 branch from 3dc8293 to 385a9bb Compare December 8, 2025 08:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants