All of lore.kernel.org
 help / color / mirror / Atom feed
From: Kashyap Chamarthy <kchamart@redhat.com>
To: Jacob Abraham Graff <jag2302@columbia.edu>
Cc: Andrew McMahon Grant <amg2215@columbia.edu>,
	Jintack Lim <jintack@cs.columbia.edu>,
	kvm@vger.kernel.org
Subject: Re: Booting Nested KVM
Date: Fri, 25 Mar 2016 08:33:40 +0100	[thread overview]
Message-ID: <20160325073340.GB32063@tesla.redhat.com> (raw)
In-Reply-To: <CANQOSYLDOatzwqJFpgLc6WuqWd6TTQ1c=hJrYNuSKikRfyP0hA@mail.gmail.com>

On Thu, Mar 24, 2016 at 11:21:32AM -0400, Jacob Abraham Graff wrote:
> Hello,
> 
> I am a student at Columbia University. My research partner Andy (CC'd)
> and I are working on booting a nested KVM virtual machine on x86.
> However, we have run into a problem that we have not been able to fix.
> 
> The host machine, L0, has the 'kvm-intel.nested=1'  flag set in it's
> grub config file, and the guest operating system, L1, does not
> complain when attempting to start a VM using virt-install.
> 
> When we attempt to actually install, we run into a couple of issues.
> When we run virt-install, using the command:
> 
> virt-install -r 1024 --accelerate -n Ubu \
> -f /var/lib/libvirt/images/guest.img \
> --cdrom /root/ubuntu-14.04.2-server-amd64.iso

> 
> We receive the error message
> 
> Could not start virtual network default

It seems like you don't have the default libvirt network active.  If it
were active, you'd see something like:

    $ virsh net-list
     Name                 State      Autostart     Persistent
    ----------------------------------------------------------
     default              active     yes           yes

If you don't, you can start the 'default' libvirt network manually:

    $ virsh net-start default
    $ virsh net-autostart default
    $ virsh net-list # Here the 'default' network should be active

Then, re-run your `virt-install` invocation.

Once you are inside L1, check if you have KVM character device exposed
in it, by doing `file /dev/kvm`.  If it is not present, then you should
expose the virtualization extensions to your L1 guest, by doing:

    $ virt-xml L1VM --edit --cpu host-passthrough,clearxml=yes

Reboot the guest, and check again if the KVM char device is present.

* * *

Speaking of installing VMs, for what it's worth, I prefer this  approach
for installing VMs quickly (I'm using Fedora-based distribution as an
example) using the 'virt-builder'[1] utility.

  (1) Build the VM template.
  
    # Install the tools
    $ sudo dnf install libguestfs-tools-c

    # Build the template
    $ virt-builder fedora-23 --size 40G

  (2) Import the image into libvirt

    $ virt-install --name f21vm --ram 2048 \
        --disk path=./fedora-23.img,format=raw \
        --nographics --import --os-variant fedora22

Then you can manipulate it using `virt-manager` (or from command-line,
if you prefer that way).


[1] http://libguestfs.org/virt-builder.1.html

Some related notes:

https://kashyapc.fedorapeople.org/virt/procedure-to-enable-nested-virt-on-intel-machines.txt

> In order to get around this error message, we run pass the nonetworks flag:
> 
> virt-install -r 1024 --accelerate --nonetworks -n Ubu \
> -f /var/lib/libvirt/images/guest.img \
> --cdrom /root/ubuntu-14.04.2-server-amd64.iso
> 
> At this point, the install seems to succeed, and the nested VM starts
> to boot. However, we cannot see any output at all - the console hangs,
> and we cannot type anything into the console at this point. If we open
> a new console, and run virt-viewer, we get what appears to be an
> ubuntu login screen, but the text is unreadable (blurry and pixelated)
> and again, we cannot type anything into this window. The virt-manager
> gui seems to indicate that this guest does have activity, which makes
> it seem strange that we are unable to communicate with it in any way.
> 
> Is there something we have missed? Do we have to specify IO in some
> special way?
> 

-- 
/kashyap

  reply	other threads:[~2016-03-25  7:33 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-03-24 15:21 Booting Nested KVM Jacob Abraham Graff
2016-03-25  7:33 ` Kashyap Chamarthy [this message]
2016-03-25 10:05   ` Paolo Bonzini
2016-03-26 17:26     ` Jacob Abraham Graff
2016-04-06 13:42       ` Kashyap Chamarthy

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20160325073340.GB32063@tesla.redhat.com \
    --to=kchamart@redhat.com \
    --cc=amg2215@columbia.edu \
    --cc=jag2302@columbia.edu \
    --cc=jintack@cs.columbia.edu \
    --cc=kvm@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.