FAI How to build a i386 and x86 64 compatible FAI server on Debian Etch x86 64: Difference between revisions
No edit summary |
(General cleanup to work with a recent version.) |
||
Line 26: | Line 26: | ||
== Cross-Architecture NFSROOT == | == Cross-Architecture NFSROOT == | ||
===Create Arch Specific FAI Configuration Direcories=== | |||
These are the directories that will be used for FAI in this | |||
setup. /etc/fai is still there, since several of the files do not | |||
change, but shouldn't actually be used directly. | |||
<pre> | <pre> | ||
for dir in /etc/fai-i386 /etc/fai-amd64 | for dir in /etc/fai-i386 /etc/fai-amd64 | ||
do | do | ||
mkdir $dir | mkdir $dir | ||
cd $dir | cd $dir | ||
ln /etc/fai/fai.conf | ln -s /etc/fai/fai.conf | ||
ln /etc/fai/NFSROOT | ln -s /etc/fai/NFSROOT | ||
mkdir $dir/apt | mkdir $dir/apt | ||
# A hard link will work here too, but not a soft link | |||
ln /etc/fai/menu.lst | cp /etc/fai/apt/sources.list apt/ | ||
ln -s /etc/fai/menu.lst | |||
cp /etc/fai/make-fai-nfsroot.conf . | cp /etc/fai/make-fai-nfsroot.conf . | ||
done | done | ||
</pre> | </pre> | ||
===Build Per-Arch Apt Configs=== | |||
We need to tell apt-get and frineds what's goin on, so we make a | |||
<code>apt_arch.conf</code> file inside <code>/etc/fai-i386</code> | |||
and <code>/etc/fai-amd64</code>. | |||
Simply add thoses lines to <code>/etc/fai-i386/apt_arch.conf</code> ( for <code>/etc/fai-amd64/apt_arch.conf</code>, replace i386 by amd64) | |||
<pre> | <pre> | ||
APT { | APT { | ||
Architecture "i386"; | Architecture "i386"; | ||
} | } | ||
</pre> | </pre> | ||
===Make Per-Arch make-fai-nfsroot.conf=== | |||
Add <code>--arch i386</code> or <code>--arch amd64</code> to | |||
<code>FAI_DEBOOTSTRAP_OPTS</code>. | |||
Set <code>NFSROOT</code> to <code>/srv/fai/nfsroot-i386</code> or | |||
<code>/srv/fai/nfsroot-amd64</code>, as appropriate. | |||
Set <code>APT_CONFIG</code> to | |||
<code>/etc/fai-i386/apt_arch.conf</code> | |||
or | |||
<code>/etc/fai-amd64/apt_arch.conf</code>, as appropriate. | |||
</ | |||
< | |||
</ | |||
< | |||
< | |||
< | |||
< | |||
</ | |||
</ | |||
===Build The Per-Arch NFSROOT=== | |||
Run: | |||
* fai-setup -C /etc/fai-i386 -v | |||
* fai-setup -C /etc/fai-amd64 -v | |||
You can also run make-fai-nfsroot instead of fai-setup; it's | |||
potentially less thorough, but should work. | |||
===Configure Network Installation=== | |||
Run (something like) one of these, depending on what kind of host you are imaging: | |||
== | * fai-chboot -k "initrd=$(ls -rt /srv/tftp/fai/initrd.img*i386* | tail -1 | sed 's;.*/;;') root=/dev/nfs nfsroot=$(host $(uname -n) | grep 'has address' | awk '{ print $4 }' | head -1):/srv/fai/nfsroot boot=live ip=dhcp FAI_FLAGS=verbose,sshd,createvt FAI_ACTION=install nfsroot=/srv/fai/nfsroot-i386" $(ls -rt /srv/tftp/fai/vmlinuz*i386* | tail -1 | sed 's;.*/;;') HOST | ||
* fai-chboot -k "initrd=$(ls -rt /srv/tftp/fai/initrd.img*amd64* | tail -1 | sed 's;.*/;;') root=/dev/nfs nfsroot=$(host $(uname -n) | grep 'has address' | awk '{ print $4 }' | head -1):/srv/fai/nfsroot boot=live ip=dhcp FAI_FLAGS=verbose,sshd,createvt FAI_ACTION=install nfsroot=/srv/fai/nfsroot-amd64" $(ls -rt /srv/tftp/fai/vmlinuz*amd64* | tail -1 | sed 's;.*/;;') HOST | |||
== Per-Architecture FAI Mirrors == | |||
Here's how to make fai partial Debian mirrors for both architectures. | |||
This relies on the NFSROOT changes described above. | |||
<pre> | <pre> | ||
for arch in i386 amd64 ; do | 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 | |||
export -n APT_CONFIG | |||
apt-get update | |||
done | done | ||
</pre> | </pre> |
Revision as of 20:21, 14 February 2009
Theses procedures have only been validated on Debian Etch with FAI 3.1.8. It can only be used for i386 and amd64 arch on an amd64 machine.
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
Create Arch Specific FAI Configuration Direcories
These are the directories that will be used for FAI in this setup. /etc/fai is still there, since several of the files do not change, but shouldn't actually be used directly.
for dir in /etc/fai-i386 /etc/fai-amd64 do mkdir $dir cd $dir ln -s /etc/fai/fai.conf ln -s /etc/fai/NFSROOT mkdir $dir/apt # A hard link will work here too, but not a soft link cp /etc/fai/apt/sources.list apt/ ln -s /etc/fai/menu.lst cp /etc/fai/make-fai-nfsroot.conf . done
Build Per-Arch Apt Configs
We need to tell apt-get and frineds what's goin on, so we make a
apt_arch.conf
file inside /etc/fai-i386
and /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"; }
Make Per-Arch make-fai-nfsroot.conf
Add --arch i386
or --arch amd64
to
FAI_DEBOOTSTRAP_OPTS
.
Set NFSROOT
to /srv/fai/nfsroot-i386
or
/srv/fai/nfsroot-amd64
, as appropriate.
Set APT_CONFIG
to
/etc/fai-i386/apt_arch.conf
or
/etc/fai-amd64/apt_arch.conf
, as appropriate.
Build The Per-Arch NFSROOT
Run:
- fai-setup -C /etc/fai-i386 -v
- fai-setup -C /etc/fai-amd64 -v
You can also run make-fai-nfsroot instead of fai-setup; it's potentially less thorough, but should work.
Configure Network Installation
Run (something like) one of these, depending on what kind of host you are imaging:
- fai-chboot -k "initrd=$(ls -rt /srv/tftp/fai/initrd.img*i386* | tail -1 | sed 's;.*/;;') root=/dev/nfs nfsroot=$(host $(uname -n) | grep 'has address' | awk '{ print $4 }' | head -1):/srv/fai/nfsroot boot=live ip=dhcp FAI_FLAGS=verbose,sshd,createvt FAI_ACTION=install nfsroot=/srv/fai/nfsroot-i386" $(ls -rt /srv/tftp/fai/vmlinuz*i386* | tail -1 | sed 's;.*/;;') HOST
- fai-chboot -k "initrd=$(ls -rt /srv/tftp/fai/initrd.img*amd64* | tail -1 | sed 's;.*/;;') root=/dev/nfs nfsroot=$(host $(uname -n) | grep 'has address' | awk '{ print $4 }' | head -1):/srv/fai/nfsroot boot=live ip=dhcp FAI_FLAGS=verbose,sshd,createvt FAI_ACTION=install nfsroot=/srv/fai/nfsroot-amd64" $(ls -rt /srv/tftp/fai/vmlinuz*amd64* | tail -1 | sed 's;.*/;;') HOST
Per-Architecture FAI Mirrors
Here's how to make fai partial Debian mirrors for both architectures.
This relies on the NFSROOT changes described above.
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 export -n APT_CONFIG apt-get update done