lxc / lxc-templates

Old style template scripts for LXC (prefer distrobuilder)
GNU Lesser General Public License v2.1
53 stars 56 forks source link

failed to create a centos8 LXC container on centos8 #21

Open f18m opened 4 years ago

f18m commented 4 years ago

The template below is mostly useful for bug reports and support questions. Feel free to remove anything which doesn't apply to you and add more information where it makes sense.

Required information

Issue description

I installed LXC3 on Centos8 using: https://copr.fedorainfracloud.org/coprs/ganto/lxc3/

and then tried to run:

root@arkadia ~]# lxc-create -n test2 -t centos -- -R 8 
Host CPE ID from /etc/os-release: cpe:/o:centos:centos:8
Checking cache download in /var/cache/lxc/centos/x86_64/8/rootfs ... 
Downloading CentOS minimal ...
Failed to set locale, defaulting to C
Failed to set locale, defaulting to C
Unable to detect release version (use '--releasever' to specify release version)
CentOS-8 - Base                                                                              36  B/s |  38  B     00:01    
Error: Failed to synchronize cache for repo 'base'
Reinstalling packages ...
mkdir: cannot create directory '/var/cache/lxc/centos/x86_64/8/partial/etc/yum.repos.disabled': File exists
mv: cannot stat '/var/cache/lxc/centos/x86_64/8/partial/etc/yum.repos.d/*.repo': No such file or directory
mknod: /var/cache/lxc/centos/x86_64/8/partial//var/cache/lxc/centos/x86_64/8/partial/dev/null: File exists
mknod: /var/cache/lxc/centos/x86_64/8/partial//var/cache/lxc/centos/x86_64/8/partial/dev/urandom: File exists
cp: cannot stat '/var/cache/lxc/centos/x86_64/8/partial/var/cache/yum/*': No such file or directory
chroot: failed to run command 'yum': No such file or directory
Failed to download the rootfs, aborting.
Failed to download 'CentOS base'
failed to install CentOS
lxc-create: test2: lxccontainer.c: create_run_template: 1648 Failed to create container from template
lxc-create: test2: tools/lxc_create.c: main: 331 Failed to create container test2

Steps to reproduce

  1. Step one: get a centos8 minimal
  2. Step two: install copr and lxc3 from ganto/lxc3 COPR repo
  3. Step three: try to create a centos8 container
f18m commented 4 years ago

From a first debugging the problem looks to be wrong repository names: if I cat the file mentioned by the lxc-create, i.e. /var/cache/lxc/centos/x86_64/8/partial/etc/yum.repos.d/lxc-centos-temp.repo

I find it contains: mirrorlist=http://mirrorlist.centos.org/?release=8&arch=x86_64&repo=os which does not work; the right setting is instead: mirrorlist=http://mirrorlist.centos.org/?release=8&arch=x86_64&repo=BaseOS