Do we have "how it work" document of data structure?

Do we have “how it work” guide or document of images and meta ?

The mechanism of images and what meta data is, How to create your own ?


That’s too broad, Let me ask one specific question:

I’m docker and k8s user. But I never use any vanilia liunx container except ProxmoxVE

I follow this guide. I create image with debootstrap then start container with systemd-nspawn, So far so good.

First I download the debian rootfs images/debian/bookworm/amd64/default/20240927_05%3A24/rootfs.tar.xz then extract to a folder

Then try to start it with this command systemd-nspawn -D . --machine debian, I got an error
"Failed to read machine ID from container image: Invalid argument"

Meanwhile, I found there is a script lxc-download.in. Then I found a file called meta looks like it’s the key. But after I extract it: What?! What even I’m looking at? :exploding_head:

Let’s say I have a MyOS and need build a lxc image without any tools like lxc-create -t foo bar:

  • Fisrt I need collectt all files into rootfs and ship it
  • Second seems like I need write a meta pack for lxc/incus/nspawn? What step did I miss?

SO Question is: How meta data package works in lxc/incus/nspawn? Any doc?

I am not that familiar with systemd-nspawn. Luckily Incus can do most of the work for you.

I recommend installing Incus on your host and then use the Incus CLI to manage everything for you.

I think the best place to start is with the documentation.

And with Incus’ landing page.

You should be able to avoid the lower level tools.

For more direct information about the image formats you can explore this page in the docs.

1 Like

Welcome!

I’ll talk about Incus.

Incus uses images that are prepared by a tool, distrobuilder. The preparation is somewhat minimal and I think you can easily get the gist of it. Distrobuilder requires a configuration file, and you can get a list of working configuration files at lxc-ci/images at main · lxc/lxc-ci · GitHub
This project (Linux Containers) generates often such updated images and makes them available for you at the images: remote in Incus. It is enabled by default in Incus. If you want to make yourself such images using distrobuilder, you need to use the appropriate parameters (depend on distribution). See Index of /images/ which has the logs of the generation of the images, and in each directory look for the build.log files that reveals the full command line you need to run.

That was the part about generating images, either for Incus or even LXC. Tip: to import in Incus, incus image import.

distrobuilder has a --debug flag that explains what it is doing and how to puts together the rootfs.

You mention meta and I am not sure what you mean here. If it is metadata of an image, then when you generate an image with distrobuilder, it will give you the metadata file of that image as a separate file. The other file is the rootfs.

Here we can help, if possible, with Incus, LXC and peripheral projects. systemd-nspawn is out of scope.

1 Like

Thank you for reply!

I see. I was like:

  • Set root to any rootfs —— That’s chroot
  • Then use clone with that folder —— That’s cgroup.

That make thought “I just need unzip rootfs to any where with any random tool to run it”.

This lxc offical script: https://github.com/lxc/lxc/blob/main/templates/lxc-download.in

From line 450, It metioned the meta tarball and I download it manually

config
config.1
config.2
config.3
config.4
config-user
config-user.1
config-user.2
config-user.3
config-user.4
create-message
excludes-user
expiry
templates

That’s intrduce more question: What is meta tarball and lxc/incus or lxc-download doing with it? Why I can’t extract just rootfs to run a container ( in low level )?