Lxc VM - question on image library kernel options

Hi:

Running lxd 5.0. on ubuntu servers (AMD and Intel based - I tried three different metal servers and they ALL do this). If I execute:-

lxc launch ubunut:20.04 vm --vm
lxc exec vm bash
root@vm:~# apt install nfs-kernel-server

I get this:

Apr 15 14:14:28 tx systemd[1]: Dependency failed for NFS server and services.
Apr 15 14:14:28 tx systemd[1]: nfs-server.service: Job nfs-server.service/start failed with result ‘dependency’.
Apr 15 14:14:28 tx systemd[1]: Dependency failed for NFS server and services.
Apr 15 14:14:28 tx systemd[1]: nfs-server.service: Job nfs-server.service/start failed with result ‘dependency’.

I was surprised to get this in a VM since out of the box it works in e.g. an Ubuntu 20.04 install via kvm VM. So I explored some with my trusty assistant (google), and I found a simple fix:

root@vm:~# apt install linux-modules-5.11.0-37-generic
root@vm:~# reboot

(I can’t figure out how to avoid a reboot, but no biggie)

lxc exec vm bash

root@vm:~# systemctl status nfs-server.service

● nfs-server.service - NFS server and services
Loaded: loaded (/lib/systemd/system/nfs-server.service; enabled; vendor preset: enabled)
Active: active (exited) since Fri 2022-04-15 14:20:33 UTC; 538ms ago
Process: 593 ExecStartPre=/usr/sbin/exportfs -r (code=exited, status=0/SUCCESS)
Process: 594 ExecStart=/usr/sbin/rpc.nfsd $RPCNFSDARGS (code=exited, status=0/SUCCESS)
Main PID: 594 (code=exited, status=0/SUCCESS)

i.e. it WORKS. So I guess it’s just missing some kernel modules (I am not smart enough to know which ones :-)).

It occured to me that this type of not-immediately-obviously-fixable error might put folks off of trying the VM option of lxc (which I think is a brilliant addition!) - they might try this, see it fail and go back to using Virt-manager/kvm etc. Which works, but I think does lxc a disservice?

A trivial suggestion/question if I may: is there a way of finding out if there are cloud images that have “different kernels” that one can use to create a vm for e.g. 20.04? And/or to provide options that can allow a preloading of “up to date” kernels (likely the wrong phrase, so forgive me please).

Thank you for the excellent LXD :slight_smile:

Andrew

You could try ‘images:ubuntu/focal’ which is made by LXD team rather than from Ubuntu. It may have the module you need.

1 Like

Also ubuntu focal comes with 5.4 kernel by default so surprised you are installing modules for 5.11

Hmm. I only did this to get nfs to work on the vm as I was launching it. I shall do more googling on lxd vms as it’s not intuitive to my old brain. THANK YOU.

Using images:ubuntu/focal it works out of the box without the kernel install (and the vm launch is much faster). So even bigger thank you for that. :slight_smile:

1 Like