Yum-patch

From Linux-VServer

Revision as of 00:03, 14 September 2007 by Daniel hozac (Talk | contribs)

Jump to: navigation, search

Install Patched vyum

The Issue

If you are getting the following error:-

You are using a version of yum which is insecure and broken in chroot
related operations; either apply the patches shipped in the 'contrib/'
directory of util-vserver, or ask the author of yum to apply them
(preferred).
In the meantime, 'vyum' will continue with dirty hacks which might not
work when the vserver is running and local DOS attacks are possible.
Execution will continue in 5 seconds...

How to solve

Find your Yum version

yum --version

Change directory

cd /usr/src/*/SOURCES/

Next find the correct patch at http://svn.linux-vserver.org/svn/util-vserver/trunk/contrib/ and download it (replace X.X.X with your yum version)

wget http://svn.linux-vserver.org/svn/util-vserver/trunk/contrib/yum-X.X.X-chroot.patch

Now lets create a directory to build all this

cd /root
mkdir yum-chroot
cd yum-chroot

Go to http://rpm.pbone.net/ and search for yum-X.X.X Pick the correct version eg 32 or 64bit, etc Then click the SOURCE file (important, don’t go to the RPM's) Select the right option from the list (eg. Centos or Redhat) Then pick a mirror (replace X.X.X with your yum version)

wget ftp://ftp.nluug.nl/pub/os/Linux/distr/CentOS/5.0/os/SRPMS/yum-X.X.X-1.el5.centos.2.src.rpm
rpm -i yum-X.X.X-1.el5.centos.2.src.rpm

Now we will have 'yum.spc' file to modify, move it to our working directory

cp /usr/src/*/SPECS/yum.spec .

Edit the yum.spec file and find Patch lines as below (yours may be different):-

Patch1: yum.conf.centos
Patch2: yum-fix-install.patch

And add another patch line after last Patch eg.

Patch1: yum.conf.centos
Patch2: yum-fix-install.patch
Patch3: yum-X.X.X-chroot.patch  (replace X with version)

Then find:-

%patch1 -p1
%patch2 -p1

And add another line with the same number you added above:-

%patch1 -p1
%patch2 -p1
%patch3 -p1

Save and exit


Now the build

rpmbuild -ba yum.spec

Now update yum to our patched version

rpm -U /usr/src/*/RPMS/noarch/yum-*

vyum should now be patched, to test

vyum <vserver_name> -- update
Personal tools