Installing CentOS 6.x on non-PAE or i586 machine

[CentOS 6.7 running on K6-2]

RHEL6/CentOS 6 doesn't boot on CPU without PAE. Using a custom non-PAE kernel will make it install. (2016/01)

Keywords: CentOS 6.x, Red Hat Enterprise Linux 6.x, RHEL6, Linux kernel, non-PAE, without PAE, i586, installation media respin, anaconda, AMD K6-2, VIA C3, CMOV emulation


$Id: dvd.m4,v 1.22 2019/08/18 05:44:32 kabe Exp $


Things you need


Needed RPMS

You only need to replace kernel package if your machine is true i686 (Pentium-III class or after) but just non-PAE.
You may only need to replace kernel and grub packages if you're going to run the installer on i686 work machine, manually replace packages, and swap the disk onto i586 machine. Expect extreme poor performance without glibc.i586.

For native i586 install, you need more quirks:

These are patched to let .i686 packages install on i586 host. (Usually rpm refuses so)

For speed gain, you also want these:


Opcode emulation kernel

The .emu686 kernel above has CMOV, NOPL, FCOMI, FCMOVcc opcode emulation to let .i686 binaries run on i586 CPUs, which lacks "cmov" capability.

Note: opcode emulation is very slow in nature. Recompile for .i586 whenever possible.

Counts of emulated opcodes will be available under /proc/emulated_ops:

# cat /proc/emulated_ops
cmov:   256673435
nopl:   0
fcomi:  0
fucomi: 9450951
fcmov:  811784

Alternate kernel

If the above .emu686 kernel has stability problems, try these kernels (now EOLed):


Step 1. Install anaconda

On the work machine, install anaconda package (anaconda-runtime is merged into it) from official repository or media with your favorite installation method.

	% sudo yum --disablerepo='*' --enablerepo=c6-media install anaconda

Don't skip the dependent packages; you need them all.

/usr/lib/anaconda-runtime/ will be populated.

Patching buildinstall

If work machine is CentOS 6.7 or below, patch /usr/lib/anaconda-runtime/buildinstall to accept --buildarch option. CentOS 6.8 buildinstall already has --buildarch, so skip this part.


--- /usr/lib/anaconda-runtime/buildinstall.dist 2014-05-06 20:15:44.997897238 +0900 +++ /usr/lib/anaconda-runtime/buildinstall 2015-09-25 22:59:40.407821014 +0900 @@ -92,6 +92,10 @@ MIRRORLIST="$MIRRORLIST $2" shift; shift ;; + --buildarch) + BUILDARCH=$2 + shift; shift + ;; *) if [ -z "$REPO" ]; then @@ -200,6 +204,7 @@ BUILDINSTALL="$CWD/buildinstall" else pushd $BUILDINSTDIR + [ -z "$BUILDARCH" ] && \ BUILDARCH=`repoquery -c $yumconf --qf "%{ARCH}\n" anaconda` # lets use rpmutils to make sure we have the canonical basearch # BUILDARCH != BASEARCH (e.g. i586 != i386, sparcv9 != sparc)

Step 2. Copy over the original media

Mount the original CentOS 6 media. Copy over all of the contents as ./DVD1/ . (so that you'll have ./DVD1/.discinfo)
Clean up the TRANS.TBL files as necessary.

	rm -fr ./DVD1
	cp -pr /media/dvd ./DVD1
	chmod -R +w ./DVD1
	find ./DVD1 -name TRANS.TBL -exec rm {} ';'

Also copy the second DVD as ./DVD2 .


Step 3. Modify Packages/

Then, copy the custom kernel and other packages to replace, into ./DVD1/Packages/ directory which holds *.rpm .

	ln kernel-2.6.32-754.3.5.el6.emu686.v40.i586.rpm ./DVD1/Packages/
	...

And, Erase the original .i686 rpm. This is neeeded to prevent installation when using the respun media.

	rm ./DVD1/Packages/kernel-2.6.32-754.el6.i586.rpm
	...

You replaced the *.rpm, so ./DVD1/repodata/ should be regenerated as below.

	mkdir ./tmpb	#big scratch directory ~100MB
	discinfo=`head -1 ./DVD1/.discinfo`
	compsxml=`cd ./DVD1; find repodata -name '*comps.xml'`
	cp ./DVD1/$compsxml ./comps.xml
	rm ./DVD1/repodata/*.bz2 ./DVD1/repodata/*.gz
	cp ./comps.xml ./DVD1/repodata/c6-i386-comps.xml
	TMPDIR=`pwd`/tmpb \
	createrepo -v -u "media://$discinfo" -g repodata/c6-i386-comps.xml --split \
	    ./DVD1 ./DVD2 
createrepo is needed to buildinstall find the new kernel and other packages to build the installer. Regeneration takes significant amount of time (~5 minutes on 3GHz machine) .

To let buildinstall find packages in 2nd DVD, ./DVD2/repodata/ should also be repopulated as below.

	createrepo -v -u "media://$discinfo" ./DVD2


Step 4. Create boot image with buildinstall

/usr/lib/anaconda-runtime/buildinstall is a program to prepare the installer (anaconda) things you see when booting from the install media.

(Mandatory) Begin with a pristine directory to store the boot.iso file;

	rm -fr ./DVD1/images/	# otherwise "ln boot.img" fails in mk-images.x86
	rm -fr ./DVD1/isolinux/	# otherwise mkisofs fails

Then, invoke the buildinstall with some options.

	# mkdir ./tmpb	#big scratch directory ~2GB
	sudo env TMPDIR=`pwd`/tmpb TMP=`pwd`/tmpb \
	sh -x /usr/lib/anaconda-runtime/buildinstall \
	    --version 6.10 \
	    --product CentOS \
	    --release 6.10 \
		--buildarch i586 \
		--debug \
		--output `pwd`/DVD1 \
		`pwd`/DVD1 `pwd`/DVD2 2>&1 | tee /tmp/buildinstall.log
This takes a long time! (about 30 minutes on 3GHz machine) You would like to redirect the output to a logfile as above.

As a result, the ./DVD1/images will be populated with installer boot files, notably ./DVD1/images/boot.iso .

Scratch directories will be lying around in TMPDIR directories. You can safely delete them.

The recreated files are likely owned by root, so you would like to

	sudo chown -R $LOGNAME ./DVD1/images ./DVD1/isolinux
	chmod      -R +w       ./DVD1/images ./DVD1/isolinux

The generated ./DVD1/images/boot.iso of about 190MB should boot as a network installer. (CentOS 5 was around 8MB, BTW) If your target machine has 2 spindles (CD and DVD; external USB okay), burn and boot with this file. It will recognize the CentOS 6 original DVD and installs -- but installed kernel will be stock i686-PAE one, so it won't reboot. You could try it out anyway to see if the installer would work.

If the work directory is on a removable disk, you could boot off from ./DVD1/images/boot.iso, plug the disk into the target machine, and specify "Hard drive" as the installation medium. It should be a lot faster than a DVD.

Discussion

buildinstall does not use the native files of the work machine to build the installer; it unpacks files from the *.rpm in the directory. Thus the work host doesn't have to be i386; working on x86_64 should be okay.

The logic to pick up i586 kernel still lives in buildinstall, but actual fresh install will use the kernel in the Packages/. So, you need to erase and replace the i686-PAE kernel, and respin the media, as below.


Step 5. Respin the media

Respin the media image by mkisofs.

First, isolinux.bin should be writeable to make it bootable, so

	chmod -R +w ./DVD1/isolinux

Build an *.iso image:

	mkisofs -o ./DVD1.iso \
	-b isolinux/isolinux.bin -c isolinux/boot.cat \
	-no-emul-boot -boot-load-size 4 -boot-info-table \
	-R -v -T \
	-J -joliet-long \
	-f \
	-V "CentOS_6.10_i586" \
	./DVD1

Then, embed the MD5 sum of the media you will use for mediacheck:

	implantisomd5 ./DVD1.iso

A simple manpage of implantisomd5

Burn the DVD1.iso and try it out on your favorite non-PAE/i586 machine.


Troubleshooting


Appendix

Source RPMs

Applied Patches


External Links


kabe.sra-tohoku.co.jp