FAI for Ubuntu/karmic

2009-11-11 Thread Waldemar Brodkorb
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   noneswaprw  0   2
Should be generated like this:
/dev/sda5   noneswaprw  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


fai.log.gz
Description: application/gunzip
--- /etc/fai/NFSROOT2009-11-11 15:37:18.0 +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
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.0 +0100
+++ /srv/fai/config-karmic/class/50-host-classes2009-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 

keyboard layout while installing on Ubuntu/FAI

2009-11-16 Thread Waldemar Brodkorb
Hi,

attached patch might be useful to set the keyboard to another
layout while installing. Ubuntu switched to setupcon for keyboard
configuration. 

best regards
Waldemar
Index: lib/load_keymap_consolechars
===
--- lib/load_keymap_consolechars(Revision 5664)
+++ lib/load_keymap_consolechars(Arbeitskopie)
@@ -9,4 +9,14 @@
 [ $KEYMAP ] || exit
 
 echo -n Loading keymap(s) $KEYMAP ...
+[ -x /bin/setupcon ]  (
+   layout=$(echo $KEYMAP|cut -d - -f 1)
+   variant=$(echo $KEYMAP|cut -d - -f 3)
+   sed -e s#^XKBLAYOUT=.*#XKBLAYOUT=\$layout\# \
+   -e s#^XKBVARIANT=.*#XKBVARIANT=\$variant\# \
+   /etc/default/console-setup  /.console-setup
+   setupcon -k --force
+   echo done.
+); exit
+ 
 loadkeys -q $KEYMAP  echo done.


small documentation patch

2009-11-16 Thread Waldemar Brodkorb
Hi developers,

while reading the documentation, I found some minor errors.
Attached is a suggested patch.

bye
 Waldemar
Index: fai-guide.txt
===
--- fai-guide.txt   (Revision 5655)
+++ fai-guide.txt   (Arbeitskopie)
@@ -189,7 +189,7 @@
 * Local file systems, their types, mount points and mount options
 * Software packages
 * Keyboard layout, time zone, NIS, Xorg configuration, remote file
-  systems, user accounts,printers ... 
+  systems, user accounts, printers ... 
 
 nfsroot::
 A file system located on the install server. It's the complete file
@@ -689,7 +689,7 @@
 unique MAC addresses with these commands:
 
 
-faiserver$ perl -ane 'print \U$F[0]\n' /tmp/mac.lis|sort|uniq
+faiserver$ perl -ane 'print \U$F[0]\n' /tmp/mac.list|sort|uniq
 
 
 After that, you only have to assign these MAC addresses to host names
@@ -931,7 +931,7 @@
 You can monitor the installation of all install clients with the
 command `faimond(8)`. All clients check if this daemon is running on
 the install server (or the machine defined by the variable
-+$monserver+. Then, a message is sent when a task starts and ends. The
++$monserver+). Then, a message is sent when a task starts and ends. The
 fai monitor daemon prints this messages to standard output. There's
 also a graphical frontend available, called `faimond-gui(1)`.
 
@@ -973,7 +973,7 @@
 
 Additional parameters are received from the DHCP daemon and
 the configuration space is made available via the configured method
-(an NFS mount by default) from the install server to '$FAI'. The setup
+(a NFS mount by default) from the install server to '$FAI'. The setup
 is finished after additional virtual terminals are created and the
 secure shell daemon for remote access is started on demand.
 
@@ -2001,7 +2001,7 @@
 Output of the partition tool `setup-storage(8)`.
 
 shell.log::
-Output of all shell script, that are used for customization.
+Output of all shell scripts, that are used for customization.
 
 variables.log::
 A list of all shell variables which are available during an
@@ -2642,7 +2642,7 @@
 
 
 - You can also delete the host entry on your install client in your
-_~/.ssh/known_hosts_ file by unsing the _ssh-keygen -R_ command.
+_~/.ssh/known_hosts_ file by using the _ssh-keygen -R_ command.
 
 - In the tasks chboot and savelog, a connection using secure shell is
 opened to the FAI server (see isavelog). To ensure that this works
@@ -2655,11 +2655,11 @@
 
 - You can calculate the IP subnet address by using the
 nice tool ipcalc. Following example gives you the notation for a class
-C network (16) when the server netork interface has the IP address
+C network (24) when the server network interface has the IP address
 123.45.6.123
 
 
-$ ipcalc -nb 123.45.6.123 16|grep Network:
+$ ipcalc -nb 123.45.6.123 24|grep Network:
 
 
 - You can merge two directories which contain configuration information,


Re: recent lvm.conf change in ubuntu/lucid breaks FAI setup-storage

2010-03-02 Thread Waldemar Brodkorb
Hi Michael,
Michael Tautschnig wrote,

  Hi FAI Developers,
  
  recently Ubuntu changed the default lvm.conf file, they now use
  following:
  -
  # Since version 2.02.54, the tools distinguish between powers of
  # 1024 bytes (e.g. KiB, MiB, GiB) and powers of 1000 bytes (e.g.
  # KB, MB, GB).
  # If you have scripts that depend on the old behaviour, set this to 0
  # temporarily until you update them.
  si_unit_consistency = 1
  -
  
  This breaks setup-storage. Attached patch fixed it for me.
  But I think it will be semantical incorrect if someone uses new
  lvm-tools with si_unit_consistency equal 0.
  
  Any idea for a better fix?
  
 
 [...]
 
 This has already been fixed in the experimental builds, see also
 
 http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=568794
 
 The patch does more or less what you proposed to change; I just tried to make 
 it
 slightly easier later on to also distinguish GiB/GB once also parted and all 
 the
 other tools go for correct units handling.

Where can I find the sources to the experimental binary debs? I
haven't seen any branch in the subversion repository nor a deb-src
line works for me. I just want to do some changes on top of the
experimental stuff. (squashfs images as config space)

bye
 Waldemar



swap fsck bug

2010-03-11 Thread Waldemar Brodkorb
Hi FAI developers,

it seems that fstab generation still contains the bug, that 
swap will be checked. Attached patch fixes it for me.

best regards,
Waldemar

Index: lib/setup-storage/Fstab.pm
===
--- lib/setup-storage/Fstab.pm  (revision 5729)
+++ lib/setup-storage/Fstab.pm  (working copy)
@@ -60,7 +60,7 @@
   # order of filesystem checks: the root filesystem gets a 1, the others
   # get 2, swap gets 0
   $fstab_line[-1] = 1 if ($d_ref-{mountpoint} eq /);
-  $fstab_line[-1] = 0 if ($d_ref-{mountpoint} eq swap);
+  $fstab_line[-1] = 0 if ($d_ref-{mountpoint} eq none);
 
   # set the ROOT_PARTITION variable, if this is the mountpoint for /
   $FAI::disk_var{ROOT_PARTITION} = $name


Re: recent lvm.conf change in ubuntu/lucid breaks FAI setup-storage

2010-03-14 Thread Waldemar Brodkorb
Hi Michael,
Michael Tautschnig wrote,

 I'd really appreciate if people started to contribute to
 those experimental builds!!! Don't hesitate to post any further questions!

I started to get my work into the experimental build, but I have
some problems with a simple setup. I checked out the lastest version of
fai-source and fai-experimental onto a Debian/Lenny system.
Then I have done following:
cd /root/fai-sources
export QUILT_PATCHES=/root/fai-experimental/patches/
export QUILT_PC=$(pwd)/debian/.pc
quilt push -a
debuild

I installed the resulting fai packages and created a repository with
the fai packages. These are added to /etc/fai/apt/sources.list.

After that I created as usual the NFS root via make-fai-nfsroot.
I copied over the default config space from
/usr/share/doc/fai-docs/examples/simple to /srv/fai/config

When I try to install a KVM client via:
qemu-img create -f qcow2 /iso/bar.img 10G
virt-install --vnc --noautoconsole --bridge br0 --hvm --accelerate
--pxe -n foo -r 512 -f /iso/bar.img -m 54:52:00:00:00:02

I get following error message from setup-storage:
Partitioning local harddisks using setup-storage
Starting setup-storage 1.2+exp
Can't use string () as an ARRAY ref while strict refs in use at
/usr/share/fai/setup-storage//Volumes.pm line 83, $config_file
line 1.
Using config file: /var/lib/fai/config/disk_config/FAIBASE
Error in task partition. Traceback: task_error task_partition task
task_install task task_action task main
FATAL ERROR. Installation stopped.

Any idea what is wrong here?

bye
 Waldemar

P.s.: the url in the README needs an update:
Index: README
===
--- README  (Revision 5731)
+++ README  (Arbeitskopie)
@@ -1,4 +1,4 @@
-see http://faiwiki.debian.net/index.php/Development_with_quilt for
how to use
+see
http://faiwiki.informatik.uni-koeln.de/index.php/Development_with_quilt
for how to use
 this tree with quilt. 
 - QUILT_PC may be stored wherever you like
 - QUILT_PATCHES must be set to this dir/patches/



config space leftovers, when using own FAI_ACTION

2010-04-13 Thread Waldemar Brodkorb
Hi,

when using some home made FAI actions implemented as hooks, the
config space is not automatically unmounted, when NFS is used.

What about something like the attached patch, to fix this
situations?

bye
 Waldemar
Index: lib/subroutines
===
--- lib/subroutines (revision 5768)
+++ lib/subroutines (working copy)
@@ -86,6 +86,13 @@
 dmesg  $LOGDIR/dmesg.log
 }
 # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+umount_cspace() {
+echo $FAI_CONFIG_SRC | grep -q ^nfs://
+if [ $? -eq 0 ]; then
+   grep -q  $FAI nfs /etc/mtab  umount $FAI
+fi
+}
+# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
 jobsrunning() {
 
 # test if jobs are running
@@ -304,6 +311,7 @@
if [ -f $FAI/hooks/$FAI_ACTION ]; then
echo Calling user defined action: $FAI_ACTION
$FAI/hooks/$FAI_ACTION
+   umount_cspace
else
echo ERROR: User defined action $FAI/hooks/$FAI_ACTION not 
found.
sendmon TASKERROR action 22
@@ -593,10 +601,7 @@
 task savelog
 
 # umount config space if accessed via nfs
-echo $FAI_CONFIG_SRC | grep -q ^nfs://
-if [ $? -eq 0 ]; then
-   grep -q  $FAI nfs /etc/mtab  umount $FAI
-fi
+umount_cspace
 
 if [ -f $stamp ]; then
echo Error while executing commands in subshell.


problem with kernel cmdline

2010-04-21 Thread Waldemar Brodkorb
Hi,

when using following kernel command line to finetune some
NFS options:
append initrd=initrd.img-2.6.32-21-generic ip=dhcp NFSOPTS=-o
nolock,ro,wsize=2048,rsize=2048 root=/dev/nfs
nfsroot=/srv/fai/nfsroot boot=live FAI_FLAGS=verbose,sshd,createvt
FAI_ACTION=install

The function eval_cmdline will fail. Attached patch from 
Thorsten Glaser t...@debian.org fixed it for me.

May be something for 3.4?

bye
 Waldemar


Index: lib/subroutines
===
--- lib/subroutines (revision 5773)
+++ lib/subroutines (working copy)
@@ -633,18 +633,22 @@
 echo -n Kernel currently running: 
 uname -rsmo
 echo -n Kernel parameters: ; cat /proc/cmdline
-for word in $(cat /proc/cmdline) ; do
-   case $word in
-   FAI_CLASSES=*)
-eval $word
-   for class in ${FAI_CLASSES//,/ }; do
-   echo $class /tmp/l
-   done
+eval cmdline=($(/proc/cmdline))
+echo Kernel parameters: ${cmdline[*]}
+for word in ${cmdli...@]}; do
+case $word in
+FAI_CLASSES=*)
+   word=${word#*=}
+   eval classes=(${word//,/ })
+   printf '%s\n' ${class...@]} /tmp/l
unset FAI_CLASSES
;;
 
[a-zA-Z]*=*)
-   eval export $word
+   varname=${word%%=*}
+   word=${word#*=}
+   eval $varname=\$word
+   eval export $varname
;;
esac
 done