CentOS example for distrobuilder

Host OS: Arch Linux
Installed lxc via pacman. Installed lxd and distrobuilder via AUR (yay).

Trying to use centos.yaml (https://github.com/lxc/lxc-ci/blob/master/images/centos.yaml)

distrobuilder build-lxd centos.yaml

Error: Error while downloading source: Couldn’t get name of iso

I am just trying to get started with LXC/LXD and want to be able to use distrobuilder. Fairly experienced with dockerfiles. But i am failing to understand this issue and how to fix it.

Those yaml files are a bit partial because we use them for a variety of architectures and releases.
So you’ll want to pass -o image.architecture=x86_64 -o image.release=7 for example.

If you want to see exactly what we pass to distrobuilder for a specific image, the Jenkins logs available at https://jenkins.linuxcontainers.org should be of help

distrobuilder build-lxd centos.yaml -o image.architecture=x86_64 -o image.release=7

This works and created

ls -l

total 85280
-rw-r–r-- 1 root root 23353 Nov 12 07:57 centos.yaml
-rw-r–r-- 1 root root 704 Nov 13 05:44 lxd.tar.xz
-rw-r–r-- 1 root root 87298048 Nov 13 05:44 rootfs.squashfs

But the commands shown for creating the

lxc-create -n myContainerImage -t local – --metadata meta.tar.xz --fstree rootfs.tar.xz

Unpacking the rootfs
tar (child): meta.tar.xz: Cannot open: No such file or directory
tar (child): Error is not recoverable: exiting now
tar: Child returned status 2
tar: Error is not recoverable: exiting now
ERROR: Invalid metadata file
lxc-create: myContainerImage: lxccontainer.c: create_run_template: 1648 Failed to create container from template
lxc-create: myContainerImage: tools/lxc_create.c: main: 331 Failed to create container myContainerImage

How do I create the meta.tar.xz?

there is something strange here, you use a command to build a lxd image and use a lxc tool to launch it.

I am trying to follow exactly what is on the git readme for distrobuilder.

Well there is to be a reason for having a ‘build-lxc’ and ‘build-lxd’ commands?
You should use build-lxc if you want to use lxc.
My guess is there is an oversight in the doc at this point.

Wait, it was not clear to me that the LXC step was specific for LXC, but I need lxd. This works…

lxc image import lxd.tar.xz rootfs.squashfs --alias centos7

So now that it is registered i can use it to spawn containers. The docs do not provide a difinitive line between LXC/LXD.

I appreciate your help.