Can't create LXC container

Hello everyone,

Recently I encountered an unexpected error when creating LXC containers. This workflow has been working for a long time, and as far as I know nothing has changed in my environment. So far I haven’t been able to determine how to debug the issue.

Environment:

  • Windows

  • WSL2

  • Ubuntu 22.04.3 LTS

  • LXC 5.0.0

lxc-create --version
5.0.0

Steps to reproduce:

sudo DOWNLOAD_KEYSERVER="hkp://keyserver.ubuntu.com" \
lxc-create -t download -n rocky1

The image index is downloaded successfully and the list of available distributions is displayed.

For example, I select:

Distribution: rockylinux
Release: 8
Architecture: amd64

Then I get the following error:

Downloading the image index
Downloading the rootfs

ERROR: Failed to download https://images.linuxcontainers.org/images/rockylinux/8/amd64/default/20260608_02:06/rootfs.tar.xz

lxc-create: rocky1: lxccontainer.c: create_run_template: 1627 Failed to create container from template
lxc-create: rocky1: tools/lxc_create.c: main: 317 Failed to create container rocky1

The same issue occurs with every distribution I have tested (Rocky Linux, AlmaLinux, Ubuntu, etc.).

Additional information:

curl -I https://images.linuxcontainers.org/images/ubuntu/noble/amd64/default/

returns:

HTTP/1.1 200 OK

and

curl -I https://images.linuxcontainers.org/images/ubuntu/noble/amd64/default/20260608_07:42/rootfs.tar.xz

returns:

HTTP/1.1 302 Moved Temporarily
Location: https://fra1mirror01.do.images.linuxcontainers.org/...

So the image server appears to be reachable.

Has anyone seen a similar issue or can suggest additional debugging steps?

update1:

when I do:

sudo DOWNLOAD_KEYSERVER="hkp://keyserver.ubuntu.com" lxc-create  -n test -t download -l TRACE -o lxc.log -- -d ubuntu -r noble -a amd64                    The cached copy has expired, re-downloading...
Downloading the image index
Downloading the rootfs
ERROR: Failed to download https://images.linuxcontainers.org//images/ubuntu/noble/amd64/default/20260608_07:42//rootfs.tar.xz
lxc-create: test: lxccontainer.c: create_run_template: 1627 Failed to create container from template
lxc-create: test: tools/lxc_create.c: main: 317 Failed to create container test

I get (lxc.log)

sudo cat lxc.log
lxc-create test 20260610130907.229 TRACE    lxccontainer - lxccontainer.c:create_partial:197 - Created "4/partial" to mark container as partially created
lxc-create test 20260610130907.243 TRACE    dir - storage/dir.c:dir_create:87 - Created directory "/var/lib/lxc/test/rootfs"
lxc-create test 20260610130907.245 TRACE    lxccontainer - lxccontainer.c:do_lxcapi_save_config:2672 - Saved config file "/var/lib/lxc/test/config"
lxc-create test 20260610130907.247 TRACE    utils - utils.c:wait_exited:349 - Reaped child process 24600
lxc-create test 20260610130907.252 DEBUG    storage - storage/storage.c:get_storage_by_name:209 - Detected rootfs type "dir"
lxc-create test 20260610131043.927 ERROR    lxccontainer - lxccontainer.c:create_run_template:1627 - Failed to create container from template
lxc-create test 20260610131043.927 TRACE    commands - commands.c:lxc_cmd:513 - Connection refused - Command "get_state" failed to connect command socket
lxc-create test 20260610131043.927 DEBUG    storage - storage/storage.c:get_storage_by_name:209 - Detected rootfs type "dir"
lxc-create test 20260610131043.927 INFO     lxccontainer - lxccontainer.c:container_destroy:3009 - Destroyed rootfs for test
lxc-create test 20260610131043.928 INFO     lxccontainer - lxccontainer.c:container_destroy:3074 - Destroyed directory "/var/lib/lxc/test" for "test"
lxc-create test 20260610131043.928 ERROR    lxc_create - tools/lxc_create.c:main:317 - Failed to create container test

We have an option to disable GPG validation I believe and in newer LXC it’s what’s always done as the GPG key network has proved itself to be very unreliable over the years.

But you’re running a rather old version of LXC here (5.x when current is 7.x) so the version you’re using may not support that.

Thanks!

That’s interesting. I am explicitly setting:

DOWNLOAD_KEYSERVER="hkp://keyserver.ubuntu.com"

Is there a way to disable GPG validation completely in LXC 5.0.0 or to verify whether the failure happens during GPG key retrieval rather than while downloading the rootfs itself?

without DOWNLOAD_KEYSERVER I get the same error

I noticed that Ubuntu 22.04 only provides LXC 5.0.0:

sudo apt update
sudo apt list --installed | grep lxc

liblxc-common/jammy-updates,now 1:5.0.0~git2209-g5a7b9ce67-0ubuntu1.1 amd64 [installed,automatic]
liblxc1/jammy-updates,now 1:5.0.0~git2209-g5a7b9ce67-0ubuntu1.1 amd64 [installed,automatic]
lxc-utils/jammy-updates,now 1:5.0.0~git2209-g5a7b9ce67-0ubuntu1.1 amd64 [installed,automatic]
lxc/jammy-updates,now 1:5.0.0~git2209-g5a7b9ce67-0ubuntu1.1 all [installed]
lxcfs/jammy,now 5.0.0-0ubuntu2 amd64 [installed,automatic]

Since you mentioned that current LXC is 7.x, what is the recommended way to upgrade on Ubuntu 22.04?

Is there an official repository or should LXC be built from source?

In a fresh Ubuntu 22.04 VM I’m not encountering any issue creating containers:

root@suited-jennet:~# lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description:    Ubuntu 22.04.5 LTS
Release:        22.04
Codename:       jammy
root@suited-jennet:~# lxc-create -t download -n rocky -- -d rockylinux -r 8 -a amd64
Using image from local cache
Unpacking the rootfs

---
You just created a Rockylinux 8 x86_64 (20260608_02:06) container.
root@suited-jennet:~# lxc-create -t download -n noble -- -d ubuntu -r noble -a amd64
Downloading the image index
Downloading the rootfs
Downloading the metadata
The image cache is now ready
Unpacking the rootfs

---
You just created an Ubuntu noble amd64 (20260608_07:42) container.

To enable SSH, run: apt install openssh-server
No default root or user password are set by LXC.
root@suited-jennet:~# lxc-ls --fancy
NAME  STATE   AUTOSTART GROUPS IPV4 IPV6 UNPRIVILEGED
noble STOPPED 0         -      -    -    false
rocky STOPPED 0         -      -    -    false

You do report your Ubuntu system is a bit out of date (22.04.3 vs 22.04.5); have you tried doing an apt update && apt upgrade?

The error

Failed to download https://images.linuxcontainers.org/images/rockylinux/8/amd64/default/20260608_02:06/rootfs.tar.xz

points to a network and/or TLS certificate issue, not a GPG signature issue.

1 Like

Thanks!

yes, I did it today:

lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description:    Ubuntu 22.04.5 LTS
Release:        22.04
Codename:       jammy

nothing changed

points to a network and/or TLS certificate issue

I suspect that as well. To rule out WSL-specific issues, I tested the same procedure inside an Oracle VirtualBox VM running Ubuntu 20.04 (Focal), and the result was identical. I received the same error when attempting to create containers.