[CentOS] Building a C5 chroot on a C6 machine

Stephen Harris

lists at spuddy.org
Fri Dec 14 18:32:45 UTC 2012


I'm trying to do something slightly silly; rather than having a C5 machine
and a C6 machine around for compiling and testing, I want to create a C5
chroot area.  Something similar to "mock" but using lvm snapshots and some
local config specific stuff.

(Potentially even using Linux Containers to enter the chroot environment).

So I thought I'd build out the chroot...

  % cat /etc/yum.repos.d/c5.repo
  [c5]
  name=CentOS-$releasever - Media
  baseurl=http://repo/CentOS/DVD/CentOS-5-x86_64/
  gpgcheck=0
  gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-5
  enabled=0


  [c5-update]
  name=CentOS-$releasever - Updates local
  baseurl=http://repo/CentOS/updates/centos5/x86_64/
  gpgcheck=0
  gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-5
  enabled=0


Now I can do
  yum --disablerepo=* --enablerepo=c5* -y --installroot=$ROOT install $rpms

(where $rpms is derived from what anaconda left behind on an old install)

So far so... "ok".  Some issues with post-install scripts breaking, but
it mostly works.

  Verifying  : 3:traceroute-2.0.1-6.el5.x86_64                          235/237
  Verifying  : setup-2.5.58-9.el5.noarch                                236/237
  Verifying  : at-3.1.8-84.el5.x86_64                                   237/237

Installed:
  MAKEDEV.x86_64 0:3.23-1.2
  SysVinit.x86_64 0:2.86-17.el5
  acl.x86_64 0:2.2.39-8.el5
[etc etc]

EXCEPT...

  test2.pts/0% chroot /mnt5 /bin/sh
  sh-3.2# ls
  bin   dev  home  lib64       media  opt   root  selinux  sys  usr
  boot  etc  lib   lost+found  mnt    proc  sbin  srv      tmp  var
  sh-3.2# rpm -qa
  rpmdb: /var/lib/rpm/Packages: unsupported hash version: 9
  error: cannot open Packages index using db3 - Invalid argument (22)
  error: cannot open Packages database in /var/lib/rpm

The rpm database is in the format of C6, so the C5 programs can't
read it!

Anyone have any ideas on how I can work around this problem?  It's
a little annoying!

Thanks,

-- 

rgds
Stephen



More information about the CentOS mailing list