10

I have received a .img file of a server which is a Virtual Machine running in a KVM environment. The Virtual Machine was installed with Ubuntu.

I would now like to take this .img file and "emulate" the server within VirtualBox. So I have converted the .img file to a .vdi file using qemu-img from raw to vdi, however the VirtualBox instance starts up and simply states:

FATAL: No bootable medium found! System halted.

I do not know if I would have to install KVM in VirtualBox and then configure it to run the VM in my .img file, or if I would be able to convert the image from KVM to VDI and then just run the server in VirtualBox directly.

What I have tried already is using qemu to convert the .img raw file to a .vdi, but that produced the above errors.

I have also read the answer on this Server Fault question, but this question is slightly different, as it is talking about moving a Windows VM from KVM to VirtualBox.

I have also tried converting from qcow2 to vdi using the qemu-img linux package, however I continually get the following error messages:

#> qemu-img convert -f qcow2 original.img -O vdi converted.vdi
qemu-img: Could not open './duketest.img': Invalid argument
qemu-img: Could not open './duketest.img'

I have also tried converting using the VBoxManage command as shown on this page:

http://funcptr.net/2012/04/01/converting-kvm-virtual-machines-to-virtualbox/

This also provides the error message I mentioned at first:

FATAL: No bootable medium found! System halted.

Thanks in advance!

3
  • @stbonearth don't worry, this is a perfectly appropriate question as currently worded. Hopefully somebody will be able to provide an answer for you soon.
    – nhinkle
    Sep 12, 2014 at 18:03
  • I don't think KVM will install in virtualbox since KVM needs VT-X support to run. I do have copies of both so I'll see if I can test.
    – Journeyman Geek
    Sep 12, 2014 at 23:28
  • Just so I can replicate the environment in case my answer is missing something - what specific distro does this server run?
    – Journeyman Geek
    Sep 13, 2014 at 2:29

1 Answer 1

9

There's a few small issues with your conversion stanza.

qemu-img convert -f qcow2 original.img -O vdi converted.vdi tells you to explicitly convert a qcow2 file to a VDI, and you have an raw image file. You essentially told your computer to translate a french text, using a spanish translator, into english.

You are better off with qemu-img convert -O vdi original.img original.vdi - letting qemu decide what's the format of the input implicitly. If you must, I believe the right input format for a img is raw, not qcow.

I've tested using the command I used in conversion from from qcow2 to VDI and and from a raw file to a VDI it works. (Interestingly qcow2 to raw to VDI dosen't.)

Just to confirm what I did

  1. Create a VM with libvirt-manager with a qcow or img disk image
  2. Install Ubuntu Minimal
  3. Check if the system boots
  4. Use qemu-image with qemu-img convert -O vdi original.ext original.vdi for both files
  5. Move the file over to a windows/virtualbox system
  6. Check to see if it boots.
2
  • 1
    I know this is an old answer but here we are in 2021 and this actually worked for me. I downloaded my raw KVM img file onto Windows 10, ran qemu-img for Windows to convert it to vdi, and opened it in virtualbox on Windows 10. Brilliant!
    – fred
    Nov 6, 2021 at 21:54
  • 1
    Well - at this point, they are fundamental/common tools. No reason to change what's not broken :D
    – Journeyman Geek
    Nov 7, 2021 at 3:15

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .