To boot a virtual machine (VM) in virt-manager from a folder where an ISO was extracted (rather than the ISO file itself), you need to configure the VM to boot from the extracted files. This typically involves setting up a PXE boot or using a kernel and initrd directly. Here's how you can do it:
Method 1: Using Kernel and Initrd (Linux-based ISOs)
If the extracted ISO contains a bootable Linux kernel and initrd (common in live CDs or installation media), you can manually specify them in virt-manager.
-
Locate the Kernel and Initrd Files
- Navigate to the extracted ISO folder and look for files like:
vmlinuz (or similar, the kernel)
initrd.img (or similar, the initial RAM disk)
-
Configure the VM in virt-manager
- Open virt-manager and select your VM.
- Go to Boot Options (or Add Hardware > Boot Options).
- Under Boot Options, select Enable boot menu.
- In the Kernel path, specify the path to the
vmlinuz file.
- In the Initrd path, specify the path to the
initrd.img file.
- Add any necessary Kernel arguments (e.g.,
root=/dev/ram0 or quiet splash).
-
Start the VM
- The VM should now boot using the extracted kernel and initrd.
Method 2: Using a PXE Boot Server (For Network Boot)
If the extracted files are meant to be served via PXE (common in enterprise environments), you can set up a PXE server and configure the VM to boot from the network.
-
Set Up a PXE Server
- Install and configure a PXE server (e.g.,
dnsmasq, tftpd-hpa).
- Place the extracted files in the TFTP root directory.
-
Configure the VM for PXE Boot
- In virt-manager, go to the VM settings.
- Under Boot Options, set the first boot device to Network (PXE).
- Start the VM, and it should fetch the boot files from the PXE server.
Method 3: Creating a Custom Bootable Disk Image
If the extracted files are meant to be used as a disk image, you can create a bootable disk:
-
Create a Disk Image
-
Attach the Disk to the VM
- In virt-manager, add the
bootable.img as a storage device.
- Set the VM to boot from this disk.
Method 4: Using GRUB Configuration (Advanced)
If the extracted ISO has a GRUB configuration, you can manually configure GRUB to boot from the extracted files.
-
Edit the VM's XML Configuration
- Shut down the VM.
- Run:
virsh edit <vm-name>
- Add a
<bootloader> section pointing to the extracted GRUB files.
-
Start the VM
- The VM should now boot using the custom GRUB configuration.
Troubleshooting
- If the VM fails to boot, check:
- The paths to
vmlinuz and initrd.img are correct.
- The kernel arguments are appropriate for the extracted OS.
- The extracted files are complete and not corrupted.
Would you like help with a specific ISO or boot method? Let me know!