Package: fai-doc
Version: 3.2.17
Severity: normal
Tags: patch

I have been trying to understand and learn fai. I have been using the
simple example set in my configurations. It seems that the grub postint
does not work with my setup out of the box. I will include a patch.

My set up is as follows:
My hardware is AMD64, I have two 100G ide drives at /dev/hda and
/dev/hdc. I setup md0 as /dev/hd[ac]1 and md1 as /dev/hd[ac]2. /dev/md0
is formatted as ext2 for /boot and /dev/md1 is used for lvm. Here is the
disk_config file:


#
# <type> <mountpoint> <size>   <fs type> <mount options> <misc options>

disk_config disk1 disklabel:msdos
primary - 100 - -
primary - 0-100% - -

disk_config disk2 disklabel:msdos
primary - 100 - -
primary - 0-100% - -

disk_config raid
raid1 /boot  hda1,hdc1 ext2 rw
raid1 -  hda2,hdc2 - -

disk_config lvm
vg vg00 md1
vg00-root / 512 ext3 rw
vg00-usr /usr 2048 ext3 rw
vg00-var /var 2048 ext3 rw
vg00-home /home 2048 ext3 rw
vg00-swap swap 2048 swap rw

Anyway, at the end of the install grub-install errors out with a
message... I lost it. It complained something about missing
/boot/grub/device.map missing or some such thing. I will enclose the
changes I made to get it working. I can say it works in this case and
the case of a single disk inside virtual box with a similar config (boot
on /hda1 and lvm on /dev/dha2). 

Basicaly the patch causes grub-install to be run chroot into the just
installed system and changed $BOOT_DEVICE to $BOOT_PARTITION.
$BOOT_DEVICE ended being /dev/mapper/vg00-root which didn't really exist
in the chroot environment, presumably because udev does not run.
$BOOT_PARTITION was /dev/hda1. I don't know if these changes will work
in general or not.

James Richardson



############# START OF PATCH ##################################
--- postinst    2009-02-22 10:35:47.000000000 -0500
+++ /srv/fai/config/files/boot/grub/menu.lst/postinst   2009-04-11 
08:36:19.000000000 -0400
@@ -13,7 +13,7 @@
 [ -z "$BOOT_DEVICE" ]    && exit 701
 [ -z "$BOOT_PARTITION" ] && exit 702
 
-grub-install --no-floppy --root-directory=$target $BOOT_DEVICE
+$ROOTCMD grub-install --no-floppy --root-directory=/ $BOOT_PARTITION
 GROOT=$(device2grub $BOOT_PARTITION)
 perl -pi -e 's/#(\w+)#/$ENV{$1}/' $2
 $ROOTCMD /usr/sbin/update-grub

############# END OF PATCH ########################

-- System Information:
Debian Release: squeeze/sid
  APT prefers unstable
  APT policy: (500, 'unstable')
Architecture: amd64 (x86_64)

Kernel: Linux 2.6.26-1-openvz-amd64 (SMP w/2 CPU cores)
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/bash

-- no debconf information
--- postinst    2009-02-22 10:35:47.000000000 -0500
+++ /srv/fai/config/files/boot/grub/menu.lst/postinst   2009-04-11 
08:36:19.000000000 -0400
@@ -13,7 +13,7 @@
 [ -z "$BOOT_DEVICE" ]    && exit 701
 [ -z "$BOOT_PARTITION" ] && exit 702
 
-grub-install --no-floppy --root-directory=$target $BOOT_DEVICE
+$ROOTCMD grub-install --no-floppy --root-directory=/ $BOOT_PARTITION
 GROOT=$(device2grub $BOOT_PARTITION)
 perl -pi -e 's/#(\w+)#/$ENV{$1}/' $2
 $ROOTCMD /usr/sbin/update-grub

Reply via email to