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,
On Fri, Dec 14, 2012 at 12:32 PM, Stephen Harris lists@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?
On Fri, Dec 14, 2012 at 12:38:18PM -0600, Les Mikesell wrote:
On Fri, Dec 14, 2012 at 12:32 PM, Stephen Harris lists@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?
Yes. I have use cases and constraints that aren't relevant to the technical problem but impact the overall problem. Additional VMs are highly non-optimal.
On Fri, Dec 14, 2012 at 12:46 PM, Stephen Harris lists@spuddy.org wrote:
On Fri, Dec 14, 2012 at 12:38:18PM -0600, Les Mikesell wrote:
On Fri, Dec 14, 2012 at 12:32 PM, Stephen Harris lists@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?
Yes. I have use cases and constraints that aren't relevant to the technical problem but impact the overall problem. Additional VMs are highly non-optimal.
Sure they are non-optimal, but they waste a couple of dollars worth of resources and do near-perfect emulation where you are likely to need a long time to set up something unique and may still have things leaking in and out of the environment you are trying to isolate - especially if you want to automate your compiling and testing with something like jenkins that already knows how to work across platforms.
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 Fri, Dec 14, 2012 at 07:58:17PM +0100, Nicolas Thierry-Mieg wrote:
Stephen Harris wrote:
The rpm database is in the format of C6, so the C5 programs can't read it!
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.
Interesting idea!
yum --setopt=keepcache=1 --disablerepo=* --enablerepo=c5* -y --installroot=$ROOT install $rpms
# Fix up RPM database rm $ROOT/var/lib/rpm/* chroot $ROOT /bin/rpm --initdb chroot $ROOT /bin/rpm -i --justdb '/var/cache/yum/*/packages/*.rpm'
And y'know what? it worked!
Very good idea. Thanks!
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.