FAI for Ubuntu/karmic

Waldemar Brodkorb fai at waldemar-brodkorb.de
Wed Nov 11 19:03:22 CET 2009


Hi Developers,

after a successful workshop with Thomas, I would like to sent some
hints and patches for getting FAI working on Ubuntu/karmic to
install Ubuntu/karmic.

I've checkout the latest subversion of fai:
svn co svn://svn.debian.org/svn/fai/trunk fai-sources

After applying the attached patches (fai-ubuntu-control.patch,
fai-ubuntu-upstart.patch) you can successfully build and install the fai packages:

$ cd fai-sources
$ dpkg-buildpackage
$ cd ..
$ sudo dpkg -i fai-quickstart_3.3_all.deb fai-doc_3.3_all.deb fai-server_3.3_all.deb

In Ubuntu there is no package with the name "syslinux-common", the
package name here is "syslinux". 

Ubuntu switched to upstart as init replacement, so we need to start
the main fai script via upstart.  In the patch I check the
environment variable UPSTART_JOB, if fai is called via upstart init
application.

After that you can create a new /etc/fai-karmic directory and modify
the configuration to match Ubuntu package names. See
fai-ubuntu-NFSROOT.patch as example. Here we have used unionfs-fuse
instead of aufs2. Ubuntu removed the aufs2 binary packages in
Karmic.

After that I've setup a local repository with the fai packages for
the installation and client system:

# mkdir -p /srv/www/fai/
# cp fai-client_3.3_all.deb fai-nfsroot_3.3_all.deb /srv/www/fai/
# cd /srv/www/fai
# dpkg-scanpackages . /dev/null |gzip -v9 > Packages.gz 

My apache DocumentRoot is /srv/www. My /etc/fai/apt/sources.list
contains following line for the local repository:
deb http://10.1.1.1/fai/ ./

The next step is to call fai-setup:

# fai-setup -C /etc/fai-karmic -v

If this successfully creates a nfsroot, you need to manually configure upstart:
(should I create a patch for make-fai-nfsroot?)

# chroot /srv/fai/nfsroot-karmic/live/filesystem.dir
# mkdir /etc/unused
# mv /etc/init/* /etc/unused/
# cp /etc/unused/mountall* /etc/init
# cp /etc/unused/*udev* /etc/init
# cp /etc/unused/hostname.conf /etc/init
# exit
# cp $HOME/fai-sources/upstart/fai.conf /srv/fai/nfsroot-karmic/live/filesystem.dir/etc/init

After that you could use the patch fai-ubuntu-configspace.patch to
create a Ubuntu/karmic compatible configuration including grub2
installation.

Then you can use fai-chboot:
# fai-chboot -F -I -v -C /etc/fai-karmic/ faiclient

After booting Ubuntu we found a small bug in the fstab generation.
The swap entry shouldn't be checked via fsck, this line:
/dev/sda5       none    swap    rw      0       2
Should be generated like this:
/dev/sda5       none    swap    rw      0       0

Attached is a fai.log from the installation. There might be a change
needed in setup-storage, a variable is not initialized.

One open bug is that the keymap while the installation is running
is not set correctly, see:

Executing GERMAN.var
++ KEYMAP=de-latin1-nodeadkeys
Loading keymap(s) de-latin1-nodeadkeys .../usr/bin/ckbcomp: Can not
find file "symbols/de-latin1-nodeadkeys" in any known directory

It would be nice if you could integrate some of the patches.
If you think they are to ugly, you could at least add them to the
enterprise edition ;)

best regards
 Waldemar
-------------- next part --------------
A non-text attachment was scrubbed...
Name: fai.log.gz
Type: application/x-gunzip
Size: 6832 bytes
Desc: not available
Url : http://lists.uni-koeln.de/pipermail/linux-fai-devel/attachments/20091111/26611099/attachment.bin 
-------------- next part --------------
--- /etc/fai/NFSROOT	2009-11-11 15:37:18.000000000 +0100
+++ /etc/fai-karmic/NFSROOT	2009-11-11 15:37:46.206251851 +0100
@@ -2,11 +2,10 @@
 
 PACKAGES aptitude
 nfs-common fai-nfsroot module-init-tools ssh rdate lshw portmap
-rsync lftp less dump reiserfsprogs e2fsprogs usbutils
-hwinfo psmisc pciutils hdparm smartmontools parted mdadm lvm2
+rsync lftp less reiserfsprogs e2fsprogs usbutils
+psmisc pciutils hdparm smartmontools parted mdadm lvm2
 dnsutils ntpdate dosfstools jove xfsprogs xfsdump
-procinfo dialog discover
-console-tools console-common
+procinfo dialog discover dump console-setup
 iproute udev subversion liblinux-lvm-perl
 
 # needed for the simple examples
@@ -17,11 +16,11 @@
 
 PACKAGES aptitude I386
 grub lilo read-edid
-linux-image-486 aufs-modules-2.6-486
+linux-image unionfs-fuse
 
 PACKAGES aptitude AMD64
 grub lilo
-linux-image-2.6-amd64 aufs-modules-2.6-amd64
+linux-image unionfs-fuse
 
 PACKAGES aptitude IA64
 elilo gnu-efi efibootmgr
@@ -33,5 +32,5 @@
 aboot
 
 PACKAGES aptitude POWERPC
-linux-image-2.6-powerpc aufs-modules-2.6-powerpc
+linux-image unionfs-fuse
 yaboot
-------------- next part --------------
diff -Nur /usr/share/doc/fai-doc/examples/simple/class/50-host-classes /srv/fai/config-karmic/class/50-host-classes
--- /usr/share/doc/fai-doc/examples/simple/class/50-host-classes	2009-11-10 18:24:28.000000000 +0100
+++ /srv/fai/config-karmic/class/50-host-classes	2009-11-11 11:42:54.878174377 +0100
@@ -16,9 +16,11 @@
 	echo "FAIBASE DHCPC LVM_XEN_SERVER XEN" ;;
     puma)
 	echo "FAIBASE DHCPC RAID_XEN_VIRTUAL" ;;
+    faiclient)
+	echo "FAIBASE DHCPC GERMAN" ;;
     *)
 	echo "FAIBASE DHCPC" ;;
 esac
 
-(ifclass I386 || ifclass AMD64) && echo GRUB 
+(ifclass I386 || ifclass AMD64) && echo GRUB_PC 
 exit 0
diff -Nur /usr/share/doc/fai-doc/examples/simple/package_config/DEFAULT /srv/fai/config-karmic/package_config/DEFAULT
--- /usr/share/doc/fai-doc/examples/simple/package_config/DEFAULT	2009-11-10 18:24:26.000000000 +0100
+++ /srv/fai/config-karmic/package_config/DEFAULT	2009-11-11 11:42:22.482132312 +0100
@@ -1,23 +1,12 @@
-PACKAGES aptitude I386
-linux-image-486
-memtest86+
-
-PACKAGES aptitude CHROOT
-linux-image-486-
-linux-image-amd64-
-
-PACKAGES aptitude AMD64
-linux-image-amd64
-memtest86+
-
-PACKAGES aptitude XEN
-xen-linux-system-2.6.26-2-xen-amd64
-
 PACKAGES aptitude DHCPC
 dhcp3-client
 
 PACKAGES aptitude GRUB
-grub lilo-
+grub lilo- grub-pc-
 
 PACKAGES aptitude LILO
-lilo grub-
+lilo grub- grub-pc-
+
+PACKAGES aptitude GRUB_PC
+grub-pc grub- lilo-
+
diff -Nur /usr/share/doc/fai-doc/examples/simple/package_config/FAIBASE /srv/fai/config-karmic/package_config/FAIBASE
--- /usr/share/doc/fai-doc/examples/simple/package_config/FAIBASE	2009-11-10 18:24:26.000000000 +0100
+++ /srv/fai/config-karmic/package_config/FAIBASE	2009-11-11 14:44:14.354128326 +0100
@@ -7,7 +7,6 @@
 hdparm
 jove
 less
-linuxlogo
 nfs-common
 nscd
 rdate
@@ -20,6 +19,6 @@
 exim4
 eject
 locales
-console-common
+console-setup
 pciutils usbutils
 lvm2
diff -Nur /usr/share/doc/fai-doc/examples/simple/package_config/faiclient /srv/fai/config-karmic/package_config/faiclient
--- /usr/share/doc/fai-doc/examples/simple/package_config/faiclient	1970-01-01 01:00:00.000000000 +0100
+++ /srv/fai/config-karmic/package_config/faiclient	2009-11-11 14:14:50.170129435 +0100
@@ -0,0 +1,2 @@
+PACKAGES aptitude
+linux-image
diff -Nur /usr/share/doc/fai-doc/examples/simple/scripts/GRUB_PC/10-setup /srv/fai/config-karmic/scripts/GRUB_PC/10-setup
--- /usr/share/doc/fai-doc/examples/simple/scripts/GRUB_PC/10-setup	1970-01-01 01:00:00.000000000 +0100
+++ /srv/fai/config-karmic/scripts/GRUB_PC/10-setup	2009-11-11 14:31:10.598126729 +0100
@@ -0,0 +1,16 @@
+#! /bin/bash
+
+error=0 ; trap "error=$((error|1))" ERR
+
+set -a
+
+# during softupdate use this file
+[ -r $LOGDIR/disk_var.sh ] && . $LOGDIR/disk_var.sh
+
+$ROOTCMD grub-mkdevicemap -n -m /boot/grub/device.map
+$ROOTCMD grub-mkconfig -o /boot/grub/grub.cfg
+$ROOTCMD grub-install --no-floppy "(hd0)"
+
+exit $error
+
+
-------------- next part --------------
Index: debian/control
===================================================================
--- debian/control	(Revision 5655)
+++ debian/control	(Arbeitskopie)
@@ -42,7 +42,7 @@
 Package: fai-server
 Architecture: all
 Depends: fai-client, debootstrap
-Recommends: nfs-kernel-server, dhcp3-server, tftpd-hpa | tftpd, openssh-server, openssh-client, syslinux-common, openbsd-inetd | inet-superserver, iproute
+Recommends: nfs-kernel-server, dhcp3-server, tftpd-hpa | tftpd, openssh-server, openssh-client, syslinux | syslinux-common, openbsd-inetd | inet-superserver, iproute
 Suggests: debmirror, apt-move, genisoimage, grub, aptitude, perl-tk, libproc-daemon-perl
 Conflicts: fai
 Replaces: fai
@@ -63,7 +63,7 @@
 
 Package: fai-quickstart
 Architecture: all
-Depends: fai-server, fai-doc, dhcp3-server, nfs-kernel-server, syslinux-common, tftpd-hpa, apt-move, genisoimage, openbsd-inetd | inet-superserver
+Depends: fai-server, fai-doc, dhcp3-server, nfs-kernel-server, syslinux | syslinux-common, tftpd-hpa, apt-move, genisoimage, openbsd-inetd | inet-superserver
 Description: Fully Automatic Installation quickstart package
  FAI is a non-interactive system to install, customize and manage
  Linux systems and software configurations on computers as well as
-------------- next part --------------
Index: bin/fai
===================================================================
--- bin/fai	(Revision 5655)
+++ bin/fai	(Arbeitskopie)
@@ -94,7 +94,7 @@
 	eval_cmdline
 	mount -t sysfs sysfs /sys
 	# we really need to start udev
-	[ -x /etc/init.d/udev ] && /etc/init.d/udev start
+	[ -x /etc/init.d/udev ] && [ "$UPSTART_JOB" != "fai" ] && /etc/init.d/udev start
 	mkdir -p /var/run/network /dev/shm/network # when using initrd kernels
 	ifup lo
 	[ -x /sbin/portmap ] && /sbin/portmap
@@ -271,7 +271,7 @@
 
 # are we called as an init substitute ?
 export do_init_tasks=0
-[ "$0" = "/etc/init.d/rcS" ] && do_init_tasks=1
+[ "$0" = "/etc/init.d/rcS" ] || [ "$UPSTART_JOB" = "fai" ] && do_init_tasks=1
 if [ $do_init_tasks -eq 1 ]; then
     hostname $HOSTNAME
     renewclass=1 # always renew class list when installing
Index: upstart/fai.conf
===================================================================
--- upstart/fai.conf	(Revision 0)
+++ upstart/fai.conf	(Revision 0)
@@ -0,0 +1,13 @@
+# fai - start fai
+#
+
+description	"start fully automatic installation"
+
+start on (startup
+          and filesystem
+          and started udev)
+
+console output
+
+task
+exec /usr/sbin/fai
Index: bin/make-fai-nfsroot
===================================================================
--- bin/make-fai-nfsroot	(Revision 5655)
+++ bin/make-fai-nfsroot	(Arbeitskopie)
@@ -340,8 +340,8 @@
     echo $timezone > etc/timezone 
     rm -f etc/localtime && ln -sf /usr/share/zoneinfo/$timezone etc/localtime
 
-    rm etc/mtab && ln -s /proc/mounts etc/mtab
-    ln -s /usr/sbin/fai etc/init.d/rcS
+    [ -e etc/mtab ] && rm etc/mtab && ln -s /proc/mounts etc/mtab
+    [ -d etc/init ] || ln -s /usr/sbin/fai etc/init.d/rcS
 
     rm -f etc/udev/rules.d/70-persistent-net.rules 
     # definition for loopback device


More information about the linux-fai-devel mailing list