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.

packages:
  manager: yum
  update: true
  cleanup: true
  repositories:
  - name: EPEL
    url: |-
      [ol8_developer_EPEL]
      name=Oracle Linux $releasever EPEL Packages for Development ($basearch)
      baseurl=https://yum.oracle.com/repo/OracleLinux/OL8/developer/EPEL/$basearch/
      gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-oracle
      gpgcheck=1
      enabled=1

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

actions:
- trigger: post-packages
  action: |-
    #!/bin/sh
    set -eux

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

- trigger: post-files
  action: |-
    #!/bin/sh
    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.