What is the purpose of LXD installed on Ubuntu LXD containers?

As per title, if I create a Ubuntu 18.04/20.04 container, it comes preinstalled with the following packages:
lxcfs liblxc1 liblxc-common lxd lxd-client

What is the use for these within the container? They seem to be safe to remove.

They’re effectively here just because the Ubuntu images that LXD consumes aren’t special LXD images, they are the exact same images as are used in cloud instances.

You can use the preinstalled LXD to run nested containers, but otherwise, it’s certainly safe to remove.

1 Like

The 18.04 container image (ubuntu:18.04) does indeed come with LXD 3.0.x (deb package).

The 20.04 container image (ubuntu:20.04) comes with LXD 4.0.x as a snap package. Being a snap package, the container also gets the snapd snap, and the core18 image.

1 Like

Thanks to both of you for helpful information,
what I ended up doing is:

18.04: apt-get remove -y lxcfs liblxc1 liblxc-common lxd lxd-client
20.04: snap remove lxd && snap remove core18 && snap remove snapd && apt-get remove -y snapd