Ubuntu doesnt install lxc CentOS template

sudo lxc-create -n centos_lxc -t centos
[sudo] password for ubuntu:
Host CPE ID from /etc/os-release:
‘yum’ command is missing
lxc-create: centos_lxc: lxccontainer.c: create_run_template: 1616 Failed to create container from template
lxc-create: centos_lxc: tools/lxc_create.c: main: 319 Failed to create container centos_lxc

sudo lxc-create -n centos_lxc -t centos
[sudo] password for ubuntu:
Host CPE ID from /etc/os-release:
‘yum’ command is missing
lxc-create: centos_lxc: lxccontainer.c: create_run_template: 1616 Failed to create container from template
lxc-create: centos_lxc: tools/lxc_create.c: main: 319 Failed to create container centos_lxc

ubuntu@primary:~$ ls /usr/share/lxc/templates/
lxc-alpine lxc-cirros lxc-gentoo lxc-oracle lxc-sparclinux
lxc-altlinux lxc-debian lxc-local lxc-plamo lxc-sshd
lxc-archlinux lxc-download lxc-oci lxc-pld lxc-ubuntu
lxc-busybox lxc-fedora lxc-openmandriva lxc-sabayon lxc-ubuntu-cloud
lxc-centos lxc-fedora-legacy lxc-opensuse lxc-slackware lxc-voidlinux

ubuntu@primary:~$ apt list | grep lxc

WARNING: apt does not have a stable CLI interface. Use with caution in scripts.

golang-gopkg-lxc-go-lxc.v2-dev/focal,focal 0.0+git20190625.f4822c6-1ubuntu1 all
libclxclient-dev/focal 3.9.2-1 amd64
libclxclient3/focal 3.9.2-1 amd64
liblxc-common/focal-updates,now 1:4.0.6-0ubuntu1~20.04.1 amd64 [installed,automatic]
liblxc-dev/focal-updates 1:4.0.6-0ubuntu1~20.04.1 amd64
liblxc1/focal-updates,now 1:4.0.6-0ubuntu1~20.04.1 amd64 [installed,automatic]
libvirt-daemon-driver-lxc/focal-updates 6.0.0-0ubuntu8.14 amd64
lua-lxc/focal 1:3.0.2-1ubuntu2 amd64
lxc-dev/focal-updates,focal-updates 1:4.0.6-0ubuntu1~20.04.1 all
lxc-templates/focal,now 3.0.4-3ubuntu1 amd64 [installed]
lxc-utils/focal-updates,now 1:4.0.6-0ubuntu1~20.04.1 amd64 [installed,automatic]
lxc1/focal-updates,focal-updates 1:4.0.6-0ubuntu1~20.04.1 all
lxc/focal-updates,focal-updates,now 1:4.0.6-0ubuntu1~20.04.1 all [installed]
lxcfs/focal,now 4.0.3-0ubuntu1 amd64 [installed,automatic]
lxctl/focal,focal 0.3.1+debian-4 all
nova-compute-lxc/focal-updates,focal-updates 2:21.2.1-0ubuntu1 all
python3-lxc/focal 1:3.0.4-1ubuntu6 amd64
vagrant-lxc/focal,focal 1.4.3-1 all

Try using the download template of prebuilt images, e.g. lxc-create -n centos_lxc -t download

ubuntu@primary:~$ sudo lxc-create -n centos_lxc -t download
[sudo] password for ubuntu:
Setting up the GPG keyring
ERROR: Unable to fetch GPG key from keyserver
lxc-create: centos_lxc: lxccontainer.c: create_run_template: 1616 Failed to create container from template
lxc-create: centos_lxc: tools/lxc_create.c: main: 319 Failed to create container centos_lxc

You probably need to update your GPG server, see

Either modify your file directly or set the DOWNLOAD_KEYSERVER environment variable to hkp://keyserver.ubuntu.com

with modifying the file has worked out.
Huge thanks to you, Thomas.

1 Like