Issues with Containers and Kernel Modules

Sep 19, 2019
24
6
8
United States
First of all this is my Proxmox System Rep:

Code:
# pveversion --verbose
proxmox-ve: 6.3-1 (running kernel: 5.4.78-2-pve)
pve-manager: 6.3-3 (running version: 6.3-3/eee5f901)
pve-kernel-5.4: 6.3-3
pve-kernel-helper: 6.3-3
pve-kernel-5.4.78-2-pve: 5.4.78-2
ceph-fuse: 12.2.11+dfsg1-2.1+b1
corosync: 3.1.0-pve1
criu: 3.11-3
glusterfs-client: 5.5-3
ifupdown: residual config
ifupdown2: 3.0.0-1+pve3
libjs-extjs: 6.0.1-10
libknet1: 1.20-pve1
libproxmox-acme-perl: 1.0.7
libproxmox-backup-qemu0: 1.0.2-1
libpve-access-control: 6.1-3
libpve-apiclient-perl: 3.1-3
libpve-common-perl: 6.3-3
libpve-guest-common-perl: 3.1-4
libpve-http-server-perl: 3.1-1
libpve-storage-perl: 6.3-6
libqb0: 1.0.5-1
libspice-server1: 0.14.2-4~pve6+1
lvm2: 2.03.02-pve4
lxc-pve: 4.0.6-2
lxcfs: 4.0.6-pve1
novnc-pve: 1.1.0-1
proxmox-backup-client: 1.0.8-1
proxmox-mini-journalreader: 1.1-1
proxmox-widget-toolkit: 2.4-5
pve-cluster: 6.2-1
pve-container: 3.3-3
pve-docs: 6.3-1
pve-edk2-firmware: 2.20200531-1
pve-firewall: 4.1-3
pve-firmware: 3.1-3
pve-ha-manager: 3.1-1
pve-i18n: 2.2-2
pve-qemu-kvm: 5.1.0-8
pve-xtermjs: 4.7.0-3
qemu-server: 6.3-5
smartmontools: 7.1-pve2
spiceterm: 3.1-1
vncterm: 1.6-2
zfsutils-linux: 0.8.5-pve1

I'm trying to create a VM running with Libvirt and qemu-kvm inside a container. SVM is enabled on BIOS and all the kernel modules are installed on the host. However whenever I provision a Container it does not have /dev/kvm after installing the following:

apt-get install -y qemu-kvm libvirt-daemon-system libvirt-dev

If I try to use modprobe on the container to add kvm_amd this is what I get:


Code:
root@devel-box01:~# modprobe kvm_amd
modprobe: ERROR: ../libkmod/libkmod.c:586 kmod_search_moddep() could not open moddep file '/lib/modules/5.4.78-2-pve/modules.dep.bin'
modprobe: FATAL: Module kvm_amd not found in directory /lib/modules/5.4.78-2-pve

Although the module is obviously in the PROXMOX host the container cannot see it, I even added the /dev/kvm device manually but that did not help at all. When I try to run a Vagrant Box it obviously fails. It seems that PROXMOX container( I've tested Unprivileged/Plrivileged) cannot access the host Kernel Modules or even see them as the path /usr/lib/modules doesn't even exist in the container.

Code:
root@devel-box01:/usr/lib# ls -l  | grep modules
drwxr-xr-x  2 root root  4096 Oct 24 18:44 modules-load.d

NOTE: This is the output of pct config command:


Code:
root@cl02np206:/etc/pve/nodes/cl02np206/lxc# pct config 101
arch: amd64
cores: 4
features: mknod=1,nesting=1,keyctl=1
hostname: devel-box01
memory: 8192
#Network Config Removed for Privacy
ostype: debian
rootfs: Containers:101/vm-101-disk-0.raw,size=80G
swap: 0

Trying to find the root cause for it.
 
Kernel modules need to be loaded on the host and not inside a container.

But what you try to do will most likely not work anyway. The correct approach would be to create a VM and use nested virtualization.
https://pve.proxmox.com/wiki/Nested_Virtualization

Update: As this has been discussed further in the enterprise support: A lot of VMs need to be started from a template in a short time. One way to tackle that would be to create linked clones from the template.
 
Last edited:
I understand where you come from, however the fact that the container cannot access any kernel module nor can find them is still a concern. I'm troubleshooting this issue through our support plan.

Thanks so much for replying to this thread and provide me with some guidance in regards to this.
 

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!