DKMS modules for qubes kernel

I want to ask if templete vm without kernel set to non (which allow usage of custom kernel) can modify modules in standard qubes kernel. I’m asking since I morphed arch into blackarch and there was some dkms modules added. Are this modules added for kernell and now they affect all my VMs?

Is there some tool to display dkms modules in dom0?

I check content of /lib/modules inside blackacrch template and inside archlinux template and it looks like new modules are present only for blackarch. Does it mean that kernel modules are installed in the vm as overlay over modules.img file?

The simplest way to install DKMS module is to run the same kernel in template VM as in appVM. In this way the command should be straightforward (sudo dkms autoinstall -k $(uname -r)) and the directory to install the DKMS module is auto inferred; otherwise there are some tricks (involving creating the correctly named directory in /lib/module which is error prone) you will not have the header directory structure and cannot compile the module IMHO.

modules.img is a ROM, containing module .ko’s and headers; /lib/modules are mostly overlay of the rom and the root fs (xvda). This technical details should be irrelevant as DKMS module should work out of box, given that the template VM uses the same kernel as appVM.

P.S.
When you run the same kernel, this command will do everything for you.

sudo dkms autoinstall -k $(uname -r)

But the modules are installed only for template and appvms based on it? The original modules.img is intact?

You are correct that modules.img is readonly and shared across every qube using the same kernel and is not expected to be edited. However /lib/modules is a overlayfs, whose lower is the readonly modules.img / xvdd and upper (modifyable part) is xvda. When you dkms install you install on the xvda layer (/lib/modules/kernel_version/extras), changes of which apply to appvm as well.

It is not easy to hack on the .ko in the tree; however Qubes OS qube has no problem installing dkms kernel modules surprisingly.

1 Like