KVM inside LXC container

aodtorusan

Member
May 10, 2019
3
0
6
34
I would like to use plain kvm virtualization inside a container created in proxmox.
Using plain LXC/LXD this is possible by running (see github.com/lxc/lxd/issues/2718):

Code:
lxc config device add CONTAINER kvm unix-char path=/dev/kvm

I noticed that in my unprivileged container, the device /dev/kvm is missing. Would it be possible to create a similar device in LXC under proxmox.
 
After adding to /etc/pve/lxc/{vmid}.conf the correct cgroups rule, it qemu was able to start correctly;
Code:
# /dev/kvm
lxc.cgroup.devices.allow = c 10:232 rwm
The container did have the be a privileged one.
 
Just out of curiosity, why would you want to run KVM in a CT, when you can just create a VM on Proxmox?
What kind of advantages or use case does this have?
 
  • Like
Reactions: BobhWasatch
In this case it’s for running gns3. It spins up its own managed VM's for simulating network devices and topologies.
Running it in a container separates the GNS3 managed instances in a dedicated context.
I was previously running in a dedicated VM, so it uses nested virtualization for the vm's it creates. However, its simulated devices seem to be running faster launched directly from the container and not using nested virtualization.
 
Hi, I have Proxmox installed on my VPS and my Hostingprovider disabled intel_kvm. So far I am only using LXC containers. Would it be possible to create a LXC continer for KVM Virtualisation purposes or would that require intel_kvm on my host? Would be awesome if this was somehow possible
 
I mean I'd give it a shot an just try it, but I'm afraid my VPS Provider gives me a big Ohnono or my VPS does. If someone could tell me what could possibly go wrong, I'd consider to give it a shot
 
KVM Virtualisation purposes or would that require intel_kvm on my host
KVM needs processor instructions enabled with intel_kvm(or the equivalent for amd ) in order to work.
You can in theory disable the KVM hardware virtualization (even via GUI), which should make a Qemu guest run without those instructions, but the performance in this case is rather slow!

if you run PVE on a virtualized guest at your hosting provider I'd suggest to stick with containers (or change to a dedicated bare-metal box)

I hope this helps!
 
  • Like
Reactions: tinfoil-hat
KVM needs processor instructions enabled with intel_kvm(or the equivalent for amd ) in order to work.
You can in theory disable the KVM hardware virtualization (even via GUI), which should make a Qemu guest run without those instructions, but the performance in this case is rather slow!

if you run PVE on a virtualized guest at your hosting provider I'd suggest to stick with containers (or change to a dedicated bare-metal box)

I hope this helps!
Thank You, How bad is bad, when it comes to, lets say a tiny linux Windowmanager environment or a small server which saves only a single purpose? Would a Windowsserver be an option, when it's only for lab purposes?
 
Hm - I personally would not do it - but you can just try :) - If it's fast enough for you - then fine - else - stick with LXC

Hope this helps!
 
Hm - I personally would not do it - but you can just try :) - If it's fast enough for you - then fine - else - stick with LXC

Hope this helps!

I'll try a VM with disabled KVM, if this is what you ment, and report. Should I forget to report, PM please a small remider!
 
KVM needs processor instructions enabled with intel_kvm(or the equivalent for amd ) in order to work.
You can in theory disable the KVM hardware virtualization (even via GUI), which should make a Qemu guest run without those instructions, but the performance in this case is rather slow!

if you run PVE on a virtualized guest at your hosting provider I'd suggest to stick with containers (or change to a dedicated bare-metal box)

I hope this helps!
Do you have any tips for performace tweaking with disabled KVM-Hardwarevirtualsisation?
 

About

The Proxmox community has been around for many years and offers help and support for Proxmox VE, Proxmox Backup Server, and Proxmox Mail Gateway.
We think our community is one of the best thanks to people like you!

Get your subscription!

The Proxmox team works very hard to make sure you are running the best software and getting stable updates and security enhancements, as well as quick enterprise support. Tens of thousands of happy customers have a Proxmox subscription. Get yours easily in our online shop.

Buy now!