Just making it run is as simple as I wrote before, just 3 commands:

# apt install wget qemu-kvm

# wget https://cloud-images.ubuntu.com/releases/16.04/release/ubuntu-16.04-server-cloudimg-amd64-disk1.img

# kvm -curses ubuntu-16.04-server-cloudimg-amd64-disk1.img

You should see it booting. I used a script to create fresh privileged LXC container, but there's nothing kvm-specific in that script, just some network configuration and user preferences. You said you use LXD, but I don't think there's big difference.

You'll have to solve more problems to actually make it useful:
* give it more space with qemu-img resize;
* access virtual system: define password or ssh key with cloud-localds;
* share network with VM: -netdev bridge,id=br0 -device virtio-net,netdev=br0,mac="$MAC_ADDRESS"; * configure static IP address: using cloud-localds rewrite file in /etc/network/interfaced.d and reboot the system;
* share local storage with VM: -virtfs and mount with 9p.
* control VM with scripts: -monitor unix:... and socat;
* monitor boot with scripts: -serial unix... and socat;
* start and stop VM with container: systemd;
* ...
(br0 above is a bridge inside the container; you'll need to create it and to forward /dev/net/tun for this to work.)

There's a lot of info about all this scattered throughout the internet, but no single page; I'll think about writing details up somewhere.

--

With Best Regards,
Marat Khalili

On 04/04/17 20:22, Spike wrote:
Marat,

any chance you could share a little more about the steps you took to start kvm manually? that'd be most useful to get things started. If you wrote up that experience somewhere a link would be most welcomed too.

thank you,

Spike

On Mon, Apr 3, 2017 at 11:36 PM Marat Khalili <[email protected] <mailto:[email protected]>> wrote:

    Hello,

    I was able to run kvm in a privileged lxc container without any
    modifications of lxc stock config (well, with some related to network
    bridge). I gave up on libvirt and start containers with
    qemu-system-x86_64 and systemd. You may want to try downloading ubuntu
    cloud image from
    https://cloud-images.ubuntu.com/releases/16.04/release/
    and starting it with kvm -curses to see if it works.

    --

    With Best Regards,
    Marat Khalili

    _______________________________________________
    lxc-users mailing list
    [email protected]
    <mailto:[email protected]>
    http://lists.linuxcontainers.org/listinfo/lxc-users



_______________________________________________
lxc-users mailing list
[email protected]
http://lists.linuxcontainers.org/listinfo/lxc-users

_______________________________________________
lxc-users mailing list
[email protected]
http://lists.linuxcontainers.org/listinfo/lxc-users

Reply via email to