[Libguestfs] IRC question: How to install a kernel module using virt-customize

Richard W.M. Jones rjones at redhat.com
Fri Oct 23 21:29:04 UTC 2015


21:26 < ibravo> hello. I'm trying to install a kernel module to a VM
Image. How can I do this using virt-customize?

Please stay in the IRC channel after asking questions!

Anyway, the answer depends on the guest and the kernel module.

For example if it was a Debian guest and you wanted to install the ZFS
dkms package, then following the instructions here:

  http://zfsonlinux.org/debian.html

you could do this:

  $ wget http://archive.zfsonlinux.org/debian/pool/main/z/zfsonlinux/zfsonlinux_6_all.deb
  $ virt-customize -a debian-8.img \
      --install lsb-release \
      --upload zfsonlinux_6_all.deb:/tmp \
      --run-command 'dpkg -i /tmp/zfsonlinux_6_all.deb' \
      --update \
      --install debian-zfs
  [   0.0] Examining the guest ...
  [  15.2] Setting a random seed
  [  15.2] Installing packages: lsb-release
  [  26.6] Uploading: zfsonlinux_6_all.deb to /tmp
  [  26.6] Running: dpkg -i /tmp/zfsonlinux_6_all.deb
  [  28.4] Updating core packages
  [ 219.9] Installing packages: debian-zfs
  [ 540.9] Finishing off

(As you can see, it takes ages to run because it actually compiles the
kernel module.)

When booted, this guest has the zfs.ko kmod installed (and the tools).

It's hard to give general instructions since almost any conceivable
kernel module would need to be compiled, and that would inevitably
involve dkms/akmod, which means using an out-of-tree/out-of-distro
install method similar to the one above.

Rich.

-- 
Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones
Read my programming and virtualization blog: http://rwmj.wordpress.com
virt-top is 'top' for virtual machines.  Tiny program with many
powerful monitoring features, net stats, disk stats, logging, etc.
http://people.redhat.com/~rjones/virt-top




More information about the Libguestfs mailing list