2

I was configuring kvm on my laptop which has ubuntu 14.04 as the host OS. I added a Fedora guest OS using the virt-manager and it worked fine.

However, after I rebooted the virtual machine, the guest OS is not coming up. It gives me an error as,

Booting from hard disk
Boot failed: not a bootable disk
No bootable device

When I searched for this error, the solutions suggested changing the xml configuration file of my guest OS. I tried changing the xml configuration file using the command virsh edit ramesh-guest but no luck.

This is my xml configuration file.

  <disk type='file' device='disk'>
  <driver name='qemu' type='raw'/>
  <source file='/var/lib/libvirt/images/ramesh-guest.img'/>
  <target dev='hda' bus='virtio'/>

I also tried changing the storage type as suggested here but to no luck.

I see the available storage types as,

  • raw
  • qcow2
  • qed
  • vmdk
  • vdi

However, if I set the storage type as something other than raw, I get the error as,

Error starting domain: internal error: process exited while connecting to monitor: qemu-system-x86_64: -drive file=/var/lib/libvirt/images/ramesh-guest.img,if=none,id=drive-virtio-disk0,format=qcow2: could not open disk image /var/lib/libvirt/images/ramesh-guest.img: Image is not in qcow2 format

I installed the Fedora guest OS into my KVM using the network installation method and I got the image from here.

3
  • Did you remember to unmount the CD ISO you used to install the Fedora VM with? I usually do this through virt-manager.
    – slm
    Commented Oct 5, 2014 at 23:20
  • Also can you drop your .xml file on pastebin? I can take a look at it tonight on my KVM sys. Also confirm that the type reported by file <.img> says that it's a GRUB bootloader.....
    – slm
    Commented Oct 5, 2014 at 23:22
  • @slm, I got rid of that guest OS since it did not succeed. I will do it again and paste the xml file to pastebin.
    – Ramesh
    Commented Oct 6, 2014 at 0:06

2 Answers 2

2

Confirm that the command file reports the file has an appropriate bootloader available. You can do it like this:

$ sudo file /path/to/image.img
/path/to.img: x86 boot sector; GRand Unified Bootloader, stage1 version 0x3, boot drive 0x80, 1st sector stage2 0x1b441; partition 1: ID=0x83, active, starthead 1, startsector 63, 208782 sectors; partition 2: ID=0x8e, starthead 0, startsector 208845, 20755980 sectors, code offset 0x48

You can also work with the file using fdisk like so:

$ sudo fdisk -l /path/to/image.img 
You must set cylinders.
You can do this from the extra functions menu.

Disk /path/to/image.img: 0 MB, 0 bytes
255 heads, 63 sectors/track, 0 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x000dac08

            Device Boot      Start         End      Blocks   Id  System
/path/to/image.img1   *           1          13      104391   83  Linux
/path/to/image.img2              14        1305    10377990   8e  Linux LVM
Partition 2 has different physical/logical endings:
     phys=(1023, 254, 63) logical=(1304, 254, 63)

This last one always throws people that you can use the partitioning tools against a file, but remember that this file is special, it's an image file of a disk so these tools will work there too.

2
  • Nice, the QEMU folks should add this to their wiki
    – dyasny
    Commented Oct 6, 2014 at 0:53
  • @dyasny - yeah I can't remember where I found this trick, in some forum. It's hugely valuable and should be made more known within the virtualization communities. I completely forgot to make a Q&A here until I saw this Q and thought I'd mention it.
    – slm
    Commented Oct 6, 2014 at 0:57
1

Start with changing <target dev='hda' bus='virtio'/>

to <target dev='vda' bus='virtio'/>

Show the rest of the domxml and the original VM configuration when you installed it, if this doesn't work.

1
  • I tried changing that but unfortunately it did not work.
    – Ramesh
    Commented Oct 5, 2014 at 17:56

You must log in to answer this question.

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