Skip to content

--compression should apply to both metadata and data tarballs #948

Description

@stribika

Steps to reproduce:

# using any valid yaml config
sudo sudo distrobuilder build-lxc $distro.yaml $distro --compression=zstd
# this works but creates $distro/meta.tar.xz and $distro/rootfs.tar.zst

sudo lxc-create --name $container --template local -- --metadata $distro/meta.tar.xz --fstree $distro/rootfs.tar.zst

This does not work:

Using local temporary directory /tmp/tmp.EcnkdZdAKI
Using metadata file: devuan/meta.tar.xz
Unpacked metadata file: devuan/meta.tar.xz
Extracted network config to: /var/lib/lxc/velociraptor/config-network
lxc.net.0.type = veth
lxc.net.0.link = lxcbr0
lxc.net.0.flags = up
Extracted additional config to: /var/lib/lxc/velociraptor/config-extra
lxc.apparmor.profile = generated
lxc.apparmor.allow_nesting = 1
lxc.rootfs.path = btrfs:/var/lib/lxc/velociraptor/rootfs
Using rootfs file: devuan/rootfs.tar.zst
xz: (stdin): File format not recognized
tar: Child returned status 1
tar: Error is not recoverable: exiting now
lxc-create: velociraptor: ../src/lxc/lxccontainer.c: create_run_template: 1601 Failed to create container from template
lxc-create: velociraptor: ../src/lxc/tools/lxc_create.c: lxc_create_main: 318 Failed to create container velociraptor

Possibly the local template script is confused by the different compression methods.

distrobuilder version: 3.2
lxc-create version: 6.0.4

Activity

  1. stgraber commented on Oct 13, 2025

    @stgraber
    Member

    The LXC local template only supports XZ.

  2. stgraber commented on Oct 13, 2025

    @stgraber
    Member

    It certainly would still make sense for distrobuilder to be consistent about what it uses for compression across both files, but for use with the LXC local provider, only xz will work.

    I suspect --compression was primarily added for the generation of the Incus images which do support most compression mechanism but where the metadata is typically always shipped as tar.xz regardless of the compression of the rootfs.

  3. changed the title [-]build-lxc's --compression option only affects rootfs, which confuses lxc-create[/-] [+]--compression should apply to both metadata and data tarballs[/+] on Oct 13, 2025
  4. added theissue type on Oct 13, 2025
  5. stribika commented on Oct 13, 2025

    @stribika
    Author

    I modified my lxc-local script to autodetect compression, it just involves using tar -a instead of tar -J, but I'm not sure of the portability implications.

    PR is here: lxc/lxc#4590

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    EasyGood for new contributors

    Type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions