How to run Ubuntu KVM host in an unprivileged LXC container

June 26th, 2015 by bostjan

I like things containerized. nice phone cases for iphone 7 It makes migration simple and painless. I also like my containers unprivileged. otterbox case for iphone 7 This of course brings some inconveniences while making huge strides ahead in terms of security. This is one of the reasons for having my KVM hosts containerized. The other is the fact that sometimes getting KVM on LXC host itself is cumbersome. Others have done significant work at bringing ease of VM operation to Linux, and I like to build on top of that work. iphone 7 plus protective phone cases This guide is for using Ubuntu KVM host inside unprivileged LXC container.

What “needed done” to run KVM host in unprivileged LXC container?

Two things:

  1. Add two devices (/dev/kvm and /dev/net/tun)
  2. Install bridge-utils (optional)

If your container is called kvm-host and uidmapshifted to i.e. 401000000-401100000 uids/gids, these are the commands you need to run on LXC host:

That is it. iphone 7 plus case re Now Virtual Machine Manager will stop complaining and your VMs will run with full speed of hardware-assisted virtualization (if it is supported by your hardware).

Installing package bridge-utils

This package is needed if you want to run bridge inside container. There are quirks to running multiple bridges connected together (one on host, another in LXC container) and you might want to test this configuration before diving it.


Leave a Reply

 

*