osbuild / bootc-image-builder

A container for deploying bootable container images.
https://osbuild.org
Apache License 2.0
84 stars 46 forks source link

ISO install Error using virt-install :Error validating install location: Could not find an installable distribution at URL '/var/lib/libvirt/images/install.iso' #265

Open chunfuwen opened 3 months ago

chunfuwen commented 3 months ago
step 1 : generate iso file:

podman run --rm -it --privileged --pull=newer --security-opt label=type:unconfined_t -v $(pwd)/config.json:/config.json -v $(pwd)/output:/output quay.io/centos-bootc/bootc-image-builder:latest quay.io/centos-bootc/fedora-bootc:eln --type iso --tls-verify  --chown 107:107

step 2:  use virt-install install iso file:

virt-install --connect qemu:///system -n imagevm --hvm --accelerate -r 3096 --vcpus=3 --os-variant rhel9.0 --disk path=/var/lib/libvirt/images/testimgevm.qcow2,bus=virtio,format=qcow2,size=10 --network network=default,model=virtio  --location /var/lib/libvirt/images/install.iso --debug --memballoon model=virtio --cpu host,disable=vmx --graphics vnc --video virtio --machine q35

Result : virt-install throw error and terminate the installation
chunfuwen commented 3 months ago

[root@hp-xx-16 bootc-image-builder]# virt-install --connect qemu:///system -n imagevm --hvm --accelerate -r 3096 --vcpus=3 --os-variant rhel9.0 --disk path=/var/lib/libvirt/images/testimgevm.qcow2,bus=virtio,format=qcow2,size=10 --network network=default,model=virtio --location /var/lib/libvirt/images/install.iso --debug --memballoon model=virtio --cpu host,disable=vmx --graphics vnc --video virtio --machine q35 [Thu, 14 Mar 2024 01:59:01 virt-install 2938534] DEBUG (cli:204) Version 4.1.0 launched with command line: /usr/bin/virt-install --connect qemu:///system -n imagevm --hvm --accelerate -r 3096 --vcpus=3 --os-variant rhel9.0 --disk path=/var/lib/libvirt/images/testimgevm.qcow2,bus=virtio,format=qcow2,size=10 --network network=default,model=virtio --location /var/lib/libvirt/images/install.iso --debug --memballoon model=virtio --cpu host,disable=vmx --graphics vnc --video virtio --machine q35 [Thu, 14 Mar 2024 01:59:01 virt-install 2938534] DEBUG (virtinstall:212) Distilled --network options: ['network=default,model=virtio'] [Thu, 14 Mar 2024 01:59:01 virt-install 2938534] DEBUG (virtinstall:142) Distilled --disk options: ['path=/var/lib/libvirt/images/testimgevm.qcow2,bus=virtio,format=qcow2,size=10'] [Thu, 14 Mar 2024 01:59:01 virt-install 2938534] DEBUG (cli:217) Requesting libvirt URI qemu:///system [Thu, 14 Mar 2024 01:59:02 virt-install 2938534] DEBUG (connection:128) libvirt URI versions library=9.5.0 driver=9.5.0 hypervisor=8.0.0 [Thu, 14 Mar 2024 01:59:02 virt-install 2938534] DEBUG (connection:109) Fetched capabilities for qemu:///system:

34303837-3531-4e43-3735-353130433651 x86_64 Haswell-noTSX-IBRS Intel tcp rdma 16057964 4014491 0 0 16455656 4113914 0 0 selinux 0 system_u:system_r:svirt_t:s0 system_u:system_r:svirt_tcg_t:s0 dac 0 +107:+107 +107:+107 hvm 32 /usr/libexec/qemu-kvm pc-i440fx-rhel7.6.0 pc pc-q35-rhel8.6.0 pc-q35-rhel8.5.0 pc-q35-rhel8.3.0 pc-q35-rhel7.6.0 pc-q35-rhel8.4.0 pc-q35-rhel9.2.0 q35 pc-q35-rhel8.2.0 pc-q35-rhel9.0.0 pc-q35-rhel8.0.0 pc-q35-rhel8.1.0 hvm 64 /usr/libexec/qemu-kvm pc-i440fx-rhel7.6.0 pc pc-q35-rhel8.6.0 pc-q35-rhel8.5.0 pc-q35-rhel8.3.0 pc-q35-rhel7.6.0 pc-q35-rhel8.4.0 pc-q35-rhel9.2.0 q35 pc-q35-rhel8.2.0 pc-q35-rhel9.0.0 pc-q35-rhel8.0.0 pc-q35-rhel8.1.0

[Thu, 14 Mar 2024 01:59:02 virt-install 2938534] DEBUG (cli:220) Received libvirt URI qemu:///system [Thu, 14 Mar 2024 01:59:04 virt-install 2938534] DEBUG (guest:341) Setting Guest osinfo name <_OsVariant name=generic> [Thu, 14 Mar 2024 01:59:04 virt-install 2938534] DEBUG (guest:341) Setting Guest osinfo name <_OsVariant name=rhel9.0> [Thu, 14 Mar 2024 01:59:04 virt-install 2938534] DEBUG (urlfetcher:71) Using scratchdir=/var/lib/libvirt/boot [Thu, 14 Mar 2024 01:59:04 virt-install 2938534] DEBUG (urldetect:285) Finding distro store for location=/var/lib/libvirt/images/install.iso [Thu, 14 Mar 2024 01:59:04 virt-install 2938534] DEBUG (urldetect:875) variant=rhel9.0 has distro=rhel, looking for matching distro store to prioritize [Thu, 14 Mar 2024 01:59:04 virt-install 2938534] DEBUG (urldetect:884) Prioritizing distro store=<class 'virtinst.install.urldetect._RHELDistro'> [Thu, 14 Mar 2024 01:59:04 virt-install 2938534] DEBUG (urlfetcher:34) Generating iso filelist: ['xorriso', '-indev', '/var/lib/libvirt/images/install.iso', '-print', 'VIRTINST_BEGINLIST', '-find'] [Thu, 14 Mar 2024 01:59:04 virt-install 2938534] DEBUG (urldetect:45) Failed to acquire file=.treeinfo: Couldn't acquire file /.treeinfo: iso doesn't have file=/.treeinfo [Thu, 14 Mar 2024 01:59:04 virt-install 2938534] DEBUG (urldetect:45) Failed to acquire file=treeinfo: Couldn't acquire file /treeinfo: iso doesn't have file=/treeinfo [Thu, 14 Mar 2024 01:59:04 virt-install 2938534] DEBUG (urldetect:45) Failed to acquire file=content: Couldn't acquire file /content: iso doesn't have file=/content [Thu, 14 Mar 2024 01:59:04 virt-install 2938534] DEBUG (urldetect:45) Failed to acquire file=current/images/MANIFEST: Couldn't acquire file /current/images/MANIFEST: iso doesn't have file=/current/images/MANIFEST [Thu, 14 Mar 2024 01:59:04 virt-install 2938534] DEBUG (urldetect:45) Failed to acquire file=current/legacy-images/MANIFEST: Couldn't acquire file /current/legacy-images/MANIFEST: iso doesn't have file=/current/legacy-images/MANIFEST [Thu, 14 Mar 2024 01:59:04 virt-install 2938534] DEBUG (urldetect:45) Failed to acquire file=daily/MANIFEST: Couldn't acquire file /daily/MANIFEST: iso doesn't have file=/daily/MANIFEST [Thu, 14 Mar 2024 01:59:04 virt-install 2938534] DEBUG (urldetect:45) Failed to acquire file=.disk/info: Couldn't acquire file /.disk/info: iso doesn't have file=/.disk/info [Thu, 14 Mar 2024 01:59:04 virt-install 2938534] DEBUG (urldetect:45) Failed to acquire file=VERSION: Couldn't acquire file /VERSION: iso doesn't have file=/VERSION [Thu, 14 Mar 2024 01:59:04 virt-install 2938534] DEBUG (cli:256) File "/usr/bin/virt-install", line 8, in virtinstall.runcli() File "/usr/share/virt-manager/virtinst/virtinstall.py", line 1234, in runcli sys.exit(main()) File "/usr/share/virt-manager/virtinst/virtinstall.py", line 1221, in main guest, installer = build_guest_instance(conn, options) File "/usr/share/virt-manager/virtinst/virtinstall.py", line 655, in build_guest_instance installer_detect_distro(guest, installer, osdata) File "/usr/share/virt-manager/virtinst/virtinstall.py", line 557, in installer_detectdistro fail(("Error validating install location: %s") % str(e)) File "/usr/share/virt-manager/virtinst/cli.py", line 256, in fail log.debug("".join(traceback.format_stack()))

[Thu, 14 Mar 2024 01:59:04 virt-install 2938534] ERROR (cli:257) Error validating install location: Could not find an installable distribution at URL '/var/lib/libvirt/images/install.iso'

The location must be the root directory of an install tree. See virt-install man page for various distro examples. [Thu, 14 Mar 2024 01:59:04 virt-install 2938534] DEBUG (cli:259) Traceback (most recent call last): File "/usr/share/virt-manager/virtinst/virtinstall.py", line 552, in installer_detect_distro autodistro = installer.detect_distro(guest) File "/usr/share/virt-manager/virtinst/install/installer.py", line 532, in detect_distro ret = self._treemedia.detect_distro(guest) File "/usr/share/virt-manager/virtinst/install/installertreemedia.py", line 306, in detect_distro cache = self._get_cached_data(guest, fetcher) File "/usr/share/virt-manager/virtinst/install/installertreemedia.py", line 185, in _get_cached_data store = urldetect.getDistroStore(guest, fetcher, File "/usr/share/virt-manager/virtinst/install/urldetect.py", line 320, in getDistroStore raise ValueError(msg) ValueError: Could not find an installable distribution at URL '/var/lib/libvirt/images/install.iso'

The location must be the root directory of an install tree. See virt-install man page for various distro examples.

chunfuwen commented 3 months ago

root@xx bootc-image-builder]# isoinfo -d -i /var/lib/libvirt/images/install.iso CD-ROM is in ISO 9660 format System id: LINUX Volume id: Container-Installer-x86_64 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: 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: 873976 El Torito VD version 1 found, boot catalog is in sector 57 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 Bootoff 3A 58

ondrejbudai commented 3 months ago

Shouldn't --location /var/lib/libvirt/images/install.iso be --cdrom /var/lib/libvirt/images/install.iso?

chunfuwen commented 3 months ago

For general iso such as RHEL ISO, it looks like support both of them : --cdrom, --location. One more information I gotten is that Device Edge Iso support location, see details: https://github.com/openshift/microshift/blob/main/docs/user/getting_started.md

chunfuwen commented 3 months ago

[root@xx images]# virt-install --connect qemu:///system -n imageisovm --hvm --accelerate -r 3096 --vcpus=3 --os-variant rhel9.0 --disk path=/var/lib/libvirt/images/testimgevm2.qcow2,bus=virtio,format=qcow2,size=10 --network network=default,model=virtio --location /var/lib/libvirt/images/fedora.iso --debug --memballoon model=virtio --cpu host,disable=vmx --graphics vnc --video virtio --machine q35 [Fri, 15 Mar 2024 04:27:39 virt-install 1495666] DEBUG (cli:204) Version 4.1.0 launched with command line: /usr/bin/virt-install --connect qemu:///system -n imageisovm --hvm --accelerate -r 3096 --vcpus=3 --os-variant rhel9.0 --disk path=/var/lib/libvirt/images/testimgevm2.qcow2,bus=virtio,format=qcow2,size=10 --network network=default,model=virtio --location /var/lib/libvirt/images/fedora.iso --debug --memballoon model=virtio --cpu host,disable=vmx --graphics vnc --video virtio --machine q35 [Fri, 15 Mar 2024 04:27:39 virt-install 1495666] DEBUG (virtinstall:212) Distilled --network options: ['network=default,model=virtio'] [Fri, 15 Mar 2024 04:27:39 virt-install 1495666] DEBUG (virtinstall:142) Distilled --disk options: ['path=/var/lib/libvirt/images/testimgevm2.qcow2,bus=virtio,format=qcow2,size=10'] [Fri, 15 Mar 2024 04:27:39 virt-install 1495666] DEBUG (cli:217) Requesting libvirt URI qemu:///system [Fri, 15 Mar 2024 04:27:39 virt-install 1495666] DEBUG (connection:128) libvirt URI versions library=9.5.0 driver=9.5.0 hypervisor=8.0.0 [Fri, 15 Mar 2024 04:27:39 virt-install 1495666] DEBUG (connection:109) Fetched capabilities for qemu:///system:

4c4c4544-0056-4610-8031-b9c04f504432 ...
bcl commented 3 months ago

Did you try --cdrom? It looks like you don't really need to use --location in your case (it is required if you are trying to modify the kernel cmdline), IIRC virt-install has some strong opinions about storage location and what it can use for --location. You could also try using qemu-kvm directly.

chunfuwen commented 3 months ago

Yes ,I tried --cdrom, and it worked as expected. But I wonder whether it is a potential issue that we don't support --location option.

ondrejbudai commented 3 months ago

Hmm, so --location is used to install from a "Distribution tree installation source. virt-install can recognize certain distribution trees and fetches a bootable kernel/initrd pair to launch the install.".

I wonder if the ISO that we produce is not recognized as a distribution tree... It's good to know that --cdrom works, though. :) @supakeen Have you ever seen anything like this while dealing with ISOs?

supakeen commented 3 months ago

As far as I'm aware you should use --cdrom for an ISO. --location is for other types of content (distribution trees as @ondrejbudai points out, I don't know what exactly a distribution tree is but the ISO apparently isn't one.

Should it be?

supakeen commented 3 months ago

Note, when trying out the linked documentation with a Fedora Server ISO it also doesn't work, I'll try with a RHEL ISO as well.

€ sudo virt-install --name fedora-server --vcpus 2 --memory 3072 --disk path=fedora-server.qcow2,size=20 --location=./Fedora-Server-dvd-x86_64-39-1.5.iso --wait
ERROR    Error validating install location: Could not find an installable distribution at URL './Fedora-Server-dvd-x86_64-39-1.5.iso'

The location must be the root directory of an install tree.
See virt-install man page for various distro examples.
supakeen commented 3 months ago

So, --location does work with the RHEL 9.3 ISO's but not with Fedora ISOs.

chunfuwen commented 3 months ago

with --location ,I use fedora iso from :https://download.fedoraproject.org/pub/fedora/linux/releases/39/Workstation/x86_64/iso/Fedora-Workstation-Live-x86_64-39-1.5.iso And virt-install can succeed afterwards installing procedure, and there is no output " Error validating install location"

supakeen commented 3 months ago

Right so it might work for a subset of ISOs in the Fedora project as well (not Server, or IoT, which are the ones I had laying around).

chunfuwen commented 3 months ago

I ever has opportunity tried device edge iso, it also support --cdrom. See https://github.com/openshift/microshift/blob/main/docs/user/getting_started.md

bcl commented 3 months ago

Distribution tree usually means something that looks like this: https://dl.fedoraproject.org/pub/fedora/linux/development/rawhide/Everything/x86_64/os/ but I think virt-install also has some code to grab that info from isos that it recognizes, but I'd have to go dig through their code to be sure. So unless you really need to append things to the kernel cmdline the right thing to use is --cdrom or --hda

ggiguash commented 3 months ago

The workaround for this problem is to examine the produced ISO to determine kernel and initrd paths to be passed explicitly in virt-install command line.

--location "/path/to/my-bootc.iso,kernel=images/pxeboot/vmlinuz,initrd=images/pxeboot/initrd.img"
--osinfo detect=on

Nevertheless, this is a limitation that should be fixed, IMO.