5

I would like to create a windows xp guest from the windows xp upgrade cd I have, along with one of a few full versions I have around. However, when I reach the stage in the installer where I am prompted to insert a full version cd, the installer can't find it (update: I checked that this works for a normal install), i.e.:

Setup could not read the CD you inserted, or the CD is not a valid Windows CD..

Is there a work-around for this so I can mount both cd's, or mount a new cd during the install process?

I've tried various combinations of mounting .iso files and specifying disks, such as:

$sudo virt-install --accelerate --connect qemu:///system -n xpsp1 -r 2048 
--disk ./vm/winxp_sp1.iso,device=cdrom  --disk ./vm/windows.qcow2,size=12 
--vnc --noautoconsole --os-type windows --os-variant winxp --vcpus 2 -c /dev/cdrom 
--check-cpu

If I try to specify multiple cdrom drives, I receive an error:

virt-install --accelerate --connect qemu:///system -n xpsp1 -r 2048 
--disk ./vm/winxp_sp1.iso,device=cdrom --disk /dev/cdrom,device=cdrom 
--disk ./vm/windows.qcow2,size=12 --vnc --noautoconsole --os-type windows 
--os-variant winxp --vcpus 2 --check-cpu

Starting install...
ERROR    IDE CDROM must use 'hdc', but target in use.
4
  • in the second command, is there already a mounted disk in /dev/cdrom perhaps? May 31 '10 at 23:05
  • Probably, that was my attempt to mount two drives at once. I only have one physical cdrom drive, I'm not sure if I can mount the 2nd on at hdd etc. May 31 '10 at 23:22
  • so you have the Windows installer CD saved on your system as two iso files?? this is not good news.... Can you merge these two iso's into one iso... there is hope for that if you know what your doing... otherwise I think Microsoft has you beat; they don't get Junior high students to do their programing any more :)
    – Iceking007
    Mar 7 '11 at 23:23
  • I don't own the full install disk for XP, just the upgrade. You can in stall from an upgrade cd, if you have a full install cd from a previous windows version, which is what I was attempting. Mar 8 '11 at 15:42
8

virt-install does not appear to support multiple CD ROMs natively. Fortunately, there is a fairly direct way to get it to do so:

  1. Use virt-install to create the virtual machine with the first CD-ROM, in your case named xpsp1. Behind the scenes, libvirt will create an XML configuration file. Turn off the machine now (virsh destroy xpsp1); you were only interested in the XML file.

  2. Open the XML file, which is located in /etc/libvirt/qemu/ (e.g. /etc/libvirt/qemu/xpsp1.xml). Probably.

  3. Search for the string cdrom. This should lead you to a chunk with these values:

    <disk type='file' device='cdrom'>
      <driver name='qemu' type='raw'/>
      <source file='/path/to/vm/winxp_sp1.iso'/>
      <target dev='hdc' bus='ide'/>
      <readonly/>
      <address type='drive' controller='0' bus='1' target='0' unit='0'/>
    </disk>
    
  4. Copy paste this block and change the settings for your second CD-ROM. Namely, you will need to change <source file=...> (path of your other file), <target dev=...> (to, e.g., hdd) and <address unit=... (to, e.g., 1)

  5. Restart the machine (virsh create /etc/libvirt/qemu/xpsp1.xml) and the two CDs should be recognized.

2
  • Sounds promising. The project I was working on is long gone but I'll keep this in mind. Nov 19 '13 at 15:23
  • 3
    Instead of creating and destroying a VM, you could also use the --print-xml option for virt-install to obtain the configuration it would have generated.
    – Dan
    Jan 7 '15 at 20:35
2

Because you can't use --cdrom twice, you can you --disk ...,device=cdrom,bus=ide instead.

It works for me:

virt-install \
--virt-type=kvm \
--name=win10 \
--ram=4096 \
--cpu=host \
--vcpus=2 \
--os-type=windows \
--os-variant=win10 \
--disk /var/lib/libvirt/boot/win10.iso,device=cdrom,bus=ide \
--disk /var/lib/libvirt/boot/virtio-win.iso,device=cdrom,bus=ide \
--disk /var/lib/libvirt/images/win10.qcow2,size=40,bus=virtio,format=qcow2 \
--network=bridge=br0,model=virtio \
--graphics vnc
2
  • Got an error: An install method must be specified (--location URL, --cdrom CD/ISO, --pxe, --import, --boot hd|cdrom|...)
    – Arvy
    Oct 27 at 16:39
  • Had to inform --boot and remove "ide". Fixed with: virt-install --virt-type=kvm --name windows7 --cpu=host --memory 3072 --vcpus=2 --os-type=windows --os-variant=win7 --disk=/var/lib/libvirt/boot/win7.iso,device=cdrom --disk=/var/lib/libvirt/boot/virtio-win.iso,device=cdrom --network=bridge=virbr0,model=virtio --graphics vnc --disk path=/var/lib/libvirt/images/windows7.qcow2,size=50,bus=virtio,format=qcow2 --boot cdrom
    – Arvy
    Oct 27 at 16:49

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.