FAIUbuntuGrubProblems

From FAIWiki
Jump to: navigation, search

Installation of Grub on Ubuntu via FAI

Installation of Ubuntu via FAI is a simple straight forward (see FAI multi-distribution ) task. But there are some pitfalls you have to workaround.

The worst problem is the installation of Grub and the update of the /boot/grub/menu.lst file. Ubuntu patched "UCF" into its /usr/sbin/update-grub tool. So your /boot/grub/menu.lst is under control of UCF, and when you try to fcopy /boot/grub/menu.lst UCF thinks that the file was changed by a user and doesn't add the kernel list automagically to it. This problem is reported to Ubuntu Launchpad Bug #239674

To overcome this problem, the solution is quite simple, but not easy to get:

  1. Do not copy/fcopy/change menu.lst into your installed system
  2. The grub-install call needs to be moved from $FAI_CONFIG/files/boot/grub/menu.lst/postinst to $FAI_CONFIG/scripts/GRUB/10-setup
  3. Add a special $ROOTCMD /usr/sbin/update-grub -y call to this script

update-grub then creates a menu.lst from scratch and your system will work as expected even during kernel upgrades.

Example script for $FAI_CONFIG/scripts/GRUB/10-setup:


#! /bin/bash

error=0 ; trap "error=$((error|1))" ERR

# Eventual source the disk_var.sh just in case 
# the BOOT_DEVICE/BOOT_PARTITION/ROOT_PARTITION 
# variables are overwritten
[ -r /tmp/fai/disk_var.sh ] && . /tmp/fai/disk_var.sh

ifclass NOMBR && BOOT_DEVICE=$BOOT_PARTITION

[ -z "$BOOT_DEVICE" ]    && exit 701
[ -z "$BOOT_PARTITION" ] && exit 702

# call grub-install from ubuntu
$target/usr/sbin/grub-install --no-floppy --root-directory=/$target $BOOT_DEVICE

# call update-grub inside ubuntu chroot with special "no user questions" flag
$ROOTCMD /usr/sbin/update-grub -y

exit $error
Personal tools
Namespaces

Variants
Actions
Navigation
Tools