Package: fai-server
Version: 4.3.1
Severity: important

When /usr/sbin/fai-cd is creating a bootable FAI Cd, it creates its GRUB 
core.img (/boot/grub/core.img) while referencing a mangled path for the 
modules. This will eventually cause a fatal GRUB error and cause the system to 
drop to grub> rescue on boot since most/all of the images will not be there.

Relevant lines from /usr/sbin/fai-cd are below:


73 # - - - - - - - - - - - - - - - - - - - - - - - - - -
74 create_grub2_image() {
75
 76     mkdir -p $tmp/boot/grub $NFSROOT/boot/grub
77     if [ -f $NFSROOT/boot/grub/core.img ]; then
78         cp $NFSROOT/boot/grub/core.img $tmp/boot/grub
79         MODULEBASE=$NFSROOT/usr/lib/grub/
80     elif [ -f $NFSROOT/usr/lib/grub/i386-pc/cdboot.img ]; then
81         chroot $NFSROOT /usr/bin/grub-mkimage -d /usr/lib/grub/i386-pc -o 
/boot/grub/core.img biosdisk iso9660 --format=i386-pc
82         cp $NFSROOT/boot/grub/core.img $tmp/boot/grub
83         MODULEBASE=$NFSROOT/usr/lib/grub/
84     else
85         echo "no grub2 installation found in NFSROOT, using downloaded 
$grubPackage"
86         apt-get -y -d install --reinstall grub-pc >/dev/null
87         grubPackage=`ls -rt /var/cache/apt/archives/grub-pc*|tail -1`
88         if [ -z "$grubPackage" ]; then
89             die 22 "Downloading grub2 failed."
90         fi
91         GRUBDIR=$tmp/grubPackage
92         mkdir -p $GRUBDIR
93         dpkg -x $grubPackage $GRUBDIR
94         cd $GRUBDIR
95         ./usr/bin/grub-mkimage -d usr/lib/grub/*-pc -o 
$tmp/boot/grub/core.img biosdisk iso9660 --format=i386-pc
96         MODULEBASE=$GRUBDIR/usr/lib/grub/
97     fi


Setting MODULEBASE= with a trailing slash will cause a mangled path when 
referencing it again at line 108:

108     for a in 
$MODULEBASE/*-pc/{*.mod,efiemu??.o,cdboot.img,boot.img,command.lst,moddep.lst,fs.lst,handler.lst,parttool.lst};
 do

For example, this line may expand to /usr/lib/grub//i386-pc/*.mod  ...the 
trailing slash causes the double slash and the path to not be found, which then 
leads to no modules being included in the GRUB image.



Kevin Newman
Linux Systems Administrator
[cid:image001.png@01CC73B0.B05D88E0]
141 W. Jackson Blvd. Suite 500
Chicago, IL  60604


______________________________________________

See http://www.peak6.com/email_disclaimer/ for terms and conditions related to 
this email

Reply via email to