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
On Fri, Dec 14, 2012 at 12:32 PM, Stephen Harris <lists at spuddy.org> wrote:> 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).Even if it is possible to get everything right that way, is it really worth the trouble compared to a VM? -- Les Mikesell lesmikesell at gmail.com
Stephen Harris wrote:> 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!perhaps if you kept the rpms that were installed by yum, you could rpm -i --justdb *.rpm within your chroot. If necessary first remove the rpm database and rpm --initdb or some such. not sure, but it might work
On 12/14/2012 10:32 AM, Stephen Harris wrote:> Something similar to "mock" but using lvm snapshots and some > local config specific stuff.If you're not using mock, you'll have to re-engineer basically everything that it does. My advice would be to try to get mock to work for you. It'll be less work than trying to re-engineer mock and then get that result to work for your needs.
Reasonably Related Threads
- Mock on 5.5 x86_64 failing with Could not find useradd in chroot, maybe the install failed?
- problems installing parted tool
- can't install software, "not using ftp, http[s], or file for repos, skipping - 5 is not a valid release or hasnt been released yet"
- CentOS 5.6 and php53 packages
- Centos 5 Repo errors