Distobuilder install LXD in an image

Hi everyone,

I am trying to build an LXD image that has LXD installed in it.
I am using distrobuilder to create this image and trying to use snap to install LXD.

But snap is failing with below error as it requires a re-login/reboot so that the respective snap paths are updated correctly. Can LXD be installed in distrobuilder context?

+ snap install lxd
error: cannot communicate with server: Post "http://localhost/v2/snaps/lxd": dial unix /run/snapd.socket: connect: no such file or directory
Error: Failed to run post-files: exit status 1
INFO[2022-09-02T10:01:39+05:30] Removing cache directory 

Below is the excerpt from my distrobuilder YAML file.

  manager: yum
  update: true
  cleanup: true
  - name: EPEL
    url: |-
      name=Oracle Linux $releasever EPEL Packages for Development ($basearch)

  - packages:
    - squashfs-tools
    - squashfuse
    - fuse
    - snapd
    action: install

- trigger: post-packages
  action: |-
    set -eux

    ln -s /var/lib/snapd/snap /snap
    systemctl enable snapd

- trigger: post-files
  action: |-
    set -eux

    snap install lxd

Any ideas @monstermunchkin ?

I have never tried it as we don’t include snapd in any of our images. However, I will look into this.

+1 for figuring out a way to do this. Trying to have a base image that contains as much as possible that is common between servers.