FAI How to build a i386 and x86 64 compatible FAI server on Debian Etch x86 64
Theses procedures have only been validated on Debian Etch with FAI 3.1.8
I was installing an installserver for my company and looking for a way to build and i386 NFSROOT on a amd64 Etch and then build arch specific FAI mirrors and CD images. Here's how I did it.
Important note: this only works if your server runs a amd64 kernel and also only works with amd64 and i386. The reason is simply, because debootstrap installs the packages and then runs the postinst scripts, which in turn (sometimes) run arch-specific binaries, so this only works on amd64, because its possible to execute i386 binaries on amd64. If you want to serve other architecture combinations, you need to create the nfsroot on the target architecture and then copy it to your nfsserver, which can run any OS on any cpu-archtiture :-)
FAI Configuration tuning
All the process described below relies on tuning the FAI configuration space.
Normally, FAI configuration can be found under an unique directory /etc/fai
.
To make FAI work with multi architecture, you have to duplicate the configuration space for every architecture.
Here is an exemple of such a FAI setup :
/etc/fai-i386 /etc/fai-amd64
To be precise, the directories don't have to be really duplicated, only the make-fai-nfsroot.conf
file must. Hard link can be used for the other files or directories under the /etc/fai
tree.
Cross-Architecture NFSROOT
- Step 1 : Create arch specifics FAI configuration direcories
for dir in /etc/fai-i386 /etc/fai-amd64 ; do mkdir $dir cd $dir ln /etc/fai/fai.conf ln /etc/fai/NFSROOT ln -s /etc/fai/apt ln /etc/fai/menu.lst cp /etc/fai/make-fai-nfsroot.conf . done
- Step 2 : Build a local
apt_arch.conf
file inside/etc/fai-i386
or/etc/fai-amd64
- Simply add thoses lines to
/etc/fai-i386/apt_arch.conf
( for/etc/fai-amd64/apt_arch.conf
, replace i386 by amd64)APT { Architecture "i386"; }
- You can create automagicaly those file running the following script
for arch in i386 amd64 ; do CONTENT='APT {\n\tArchitecture "$arch";\n}' echo $CONTENT > /etc/fai-$arch/apt_arch.conf done
- Simply add thoses lines to
- Step 3 : Install fai-kernels packages for the different architectures
- Configure and Run this little script for your different architectures
rm /tmp/fai-kernel* for arch in i386 amd64 ; do echo "Downloading $arch fai-kernels package" echo "--------------------------------------" export APT_CONFIG=/etc/fai-$arch/apt_arch.conf apt-get update apt-cache -f search fai-kernels PACKAGE=$(apt-cache -f search fai-kernels | grep Filename | awk ' { print $2 }') MIRROR=http://ftp.debian.org/debian wget $MIRROR/$PACKAGE -P /tmp done export -n APT_CONFIG apt-get update for file in /tmp/fai-kernels* ; do echo "Unpacking $arch fai-kernels package" echo "--------------------------------------" dpkg-deb -x $file / done
- Configure and Run this little script for your different architectures
- Step 4 : Configure make-fai-nfsroot.conf to be architecture specific
- Add
--arch i386
or--arch amd64
toFAI_DEBOOTSTRAP
- Modidy
KERNELPACKAGE
with the good fai kernel package.
- Add
- Step 5 : Build the arch dependant NFSROOT
- Execute this commands
export APT_CONFIG=/etc/fai-i386/apt_arch.conf make-fai-nfsroot -C /etc/fai-i386 -V vmlinuz-install-i386 -v
- Execute this commands
- Step 6 : Configure network Install for a particular architecture
- Run the command below
FAI_CHBOOT_ARCH=i386 FAI_CHBOOT_OPT="-k \"ip=dhcp FAI_ACTION=install \ nfsroot=/srv/fai/nfsroot-$FAI_CHBOOT_ARCH,v3,tcp,rsize=32768,wsize=32768\" \ -F vmlinuz-install-i386 /dev/nfs" fai-chboot $FAI_CHBOOT_OPT computer
Cross-Architecture FAI Mirrors
This part describe how to make cross architecture fai partial Debian mirrors. This relies on the NFSROOT one described above.
To build a cross architecture fai mirror, you just have to run the following commands :
export FAI_ETC_DIR=/etc/fai-i386 export APT_CONFIG=/etc/fai-i386/apt_arch.conf apt-get update fai-mirror -v /srv/fai/mirror-i386 export -n APT_CONFIG apt-get update
A script can be written to automatize the building of a whole architecture list. Here is an exemple
for arch in i386 amd64 ; do export FAI_ETC_DIR=/etc/fai-$arch export APT_CONFIG=/etc/fai-$arch/apt_arch.conf apt-get update fai-mirror -v /srv/fai/mirror-$arch done export -n APT_CONFIG apt-get update
- Run the command below