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

1 Like

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.

Hello everyone, (and sorry for reviving this old thread, just that it seemed relevant and I did not wish to open up another one)

I have a follow up. I am using the command ( distrobuilder build-lxd centos.yaml -o image.architecture=x86_64 -o image.release=8 or even image.release=7 for that matter ) as mentioned but I get the following error:

Error: files.*.generator must be one of [dump template hostname hosts remove upstart-tty cloud-init]

I saw the .yaml script and I see two places where the generator has type fstab and lxd-agent which is possibly the reason of this error. Can anyone help me fix this? I am not sure if removing these two is alright and if it is so, an explanation would really help.

TIA.

Nevermind, the latest source code has fstab and lxd-agent generators added. Installing using snap with --classic option didn’t help. Had to use --edge also.

Hello, Stéphane!

Jenkins logs with image builds on https://jenkins.linuxcontainers.org/ no longer available?

Right now there is too little text and no information about the builds :frowning:

What do you mean?
Can’t you see: https://jenkins.linuxcontainers.org/job/image-centos/architecture=amd64,release=8,variant=default/882/console

1 Like

oh, you’re right, sorry. it’s my fault.
thanks!