Bug#597538: grub-ieee1275: grub-install needs to pass a --prefix option to grub-mkimage

Daniel Kahn Gillmor dkg at fifthhorseman.net
Mon Sep 20 16:33:00 UTC 2010


Package: grub-ieee1275
Version: 1.98+20100804-4
Severity: important
Tags: patch

a standard powerpc mac mini is unable to boot with grub after running

  grub-install /dev/hda

(the machine's only disk uses an apple partitioning scheme, with an HFS 
volume as (hd,apple2) mounted at /boot/grub)

during boot drops into an emergency rescue, saying:

Welcome to GRUB!
error: no device is set.
Entering rescue mode...


If i say:

set prefix=(hd,apple2)/
insmod normal
normal

then everything boots as expected.

it looks like grub-install isn't passing a --prefix option to 
grub-mkimage.

Re-running /usr/sbin/grub-install /dev/hda with the attached patch 
applied makes it so that this ugly workaround is no longer necessary.

Thanks for keeping grub in debian!

	--dkg

 
-- Package-specific info:

*********************** BEGIN /proc/mounts
/dev/mapper/vg_faith0-root / ext3 rw,relatime,errors=remount-ro,commit=5,data=ordered 0 0
/dev/mapper/vg_faith0-home /home ext3 rw,relatime,errors=continue,commit=5,data=ordered 0 0
/dev/mapper/vg_faith0-tmp /tmp ext3 rw,relatime,errors=continue,commit=5,data=ordered 0 0
/dev/mapper/vg_faith0-usr /usr ext3 rw,relatime,errors=continue,commit=5,data=ordered 0 0
/dev/mapper/vg_faith0-var /var ext3 rw,relatime,errors=continue,commit=5,data=ordered 0 0
/dev/hda3 /boot ext3 rw,nosuid,nodev,noexec,relatime,errors=continue,commit=5,data=ordered 0 0
/dev/hda2 /boot/grub hfs rw,nosuid,nodev,noexec,relatime,uid=0,gid=0 0 0
*********************** END /proc/mounts

*********************** BEGIN /boot/grub/device.map
(hd)	/dev/disk/by-id/ata-ST940110A_3KW5FGZX
*********************** END /boot/grub/device.map

*********************** BEGIN /boot/grub/grub.cfg
#
# DO NOT EDIT THIS FILE
#
# It is automatically generated by grub-mkconfig using templates
# from /etc/grub.d and settings from /etc/default/grub
#

### BEGIN /etc/grub.d/00_header ###
if [ -s $prefix/grubenv ]; then
  load_env
fi
set default="0"
if [ "${prev_saved_entry}" ]; then
  set saved_entry="${prev_saved_entry}"
  save_env saved_entry
  set prev_saved_entry=
  save_env prev_saved_entry
  set boot_once=true
fi

function savedefault {
  if [ -z "${boot_once}" ]; then
    saved_entry="${chosen}"
    save_env saved_entry
  fi
}

function load_video {
  insmod ieee1275_fb
}

insmod lvm
insmod part_apple
insmod ext2
set root='(vg_faith0-usr)'
search --no-floppy --fs-uuid --set 5944e2ad-2ea9-4c59-a058-9b9fe5ff4d57
if loadfont /share/grub/unicode.pf2 ; then
  set gfxmode=640x480
  load_video
  insmod gfxterm
fi
terminal_output gfxterm
set timeout=5
### END /etc/grub.d/00_header ###

### BEGIN /etc/grub.d/05_debian_theme ###
insmod lvm
insmod part_apple
insmod ext2
set root='(vg_faith0-usr)'
search --no-floppy --fs-uuid --set 5944e2ad-2ea9-4c59-a058-9b9fe5ff4d57
insmod png
if background_image /share/images/desktop-base/moreblue-orbit-grub.png ; then
  set color_normal=black/black
  set color_highlight=magenta/black
else
  set menu_color_normal=cyan/blue
  set menu_color_highlight=white/blue
fi
### END /etc/grub.d/05_debian_theme ###

### BEGIN /etc/grub.d/10_linux ###
menuentry 'Debian GNU/Linux, with Linux 2.6.32-5-powerpc' --class debian --class gnu-linux --class gnu --class os {
	insmod part_apple
	insmod ext2
	set root='(hd,apple3)'
	search --no-floppy --fs-uuid --set 217d06ca-b92e-4b8b-9519-efed0b1368f0
	echo	'Loading Linux 2.6.32-5-powerpc ...'
	linux	/vmlinux-2.6.32-5-powerpc root=/dev/mapper/vg_faith0-root ro  quiet
	echo	'Loading initial ramdisk ...'
	initrd	/initrd.img-2.6.32-5-powerpc
}
menuentry 'Debian GNU/Linux, with Linux 2.6.32-5-powerpc (recovery mode)' --class debian --class gnu-linux --class gnu --class os {
	insmod part_apple
	insmod ext2
	set root='(hd,apple3)'
	search --no-floppy --fs-uuid --set 217d06ca-b92e-4b8b-9519-efed0b1368f0
	echo	'Loading Linux 2.6.32-5-powerpc ...'
	linux	/vmlinux-2.6.32-5-powerpc root=/dev/mapper/vg_faith0-root ro single 
	echo	'Loading initial ramdisk ...'
	initrd	/initrd.img-2.6.32-5-powerpc
}
### END /etc/grub.d/10_linux ###

### BEGIN /etc/grub.d/20_linux_xen ###
### END /etc/grub.d/20_linux_xen ###

### BEGIN /etc/grub.d/30_os-prober ###
### END /etc/grub.d/30_os-prober ###

### BEGIN /etc/grub.d/40_custom ###
# This file provides an easy way to add custom menu entries.  Simply type the
# menu entries you want to add after this comment.  Be careful not to change
# the 'exec tail' line above.
### END /etc/grub.d/40_custom ###

### BEGIN /etc/grub.d/41_custom ###
if [ -f  $prefix/custom.cfg ]; then
  source $prefix/custom.cfg;
fi
### END /etc/grub.d/41_custom ###
*********************** END /boot/grub/grub.cfg

-- System Information:
Debian Release: squeeze/sid
  APT prefers testing
  APT policy: (500, 'testing')
Architecture: powerpc (ppc)

Kernel: Linux 2.6.32-5-powerpc
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash

Versions of packages grub-ieee1275 depends on:
ii  bc                       1.06.95-2       The GNU bc arbitrary precision cal
ii  debconf [debconf-2.0]    1.5.35          Debian configuration management sy
ii  grub-common              1.98+20100804-4 GRand Unified Bootloader, version 
ii  powerpc-ibm-utils        1.1.0-1         utilities for maintenance of IBM P
ii  powerpc-utils            1.1.3-24        Various utilities for Linux/PowerP
ii  ucf                      3.0025+nmu1     Update Configuration File: preserv

grub-ieee1275 recommends no packages.

Versions of packages grub-ieee1275 suggests:
ii  genisoimage                   9:1.1.10-1 Creates ISO-9660 CD-ROM filesystem
ii  os-prober                     1.39       utility to detect other OSes on a 

-- debconf information excluded
-------------- next part --------------
--- /usr/sbin/grub-install	2010-08-23 08:23:50.000000000 -0400
+++ /usr/sbin/grub-install.new	2010-09-20 11:47:30.000000000 -0400
@@ -222,7 +222,7 @@
 modules="$modules $fs_module $partmap_module $devabstraction_module"
 
 # Now perform the installation.
-"$grub_mkimage" -O ${target_cpu}-ieee1275 --directory=${pkglibdir} --output=${grubdir}/grub $modules || exit 1
+"$grub_mkimage" -O ${target_cpu}-ieee1275 --directory=${pkglibdir} --output=${grubdir}/grub --prefix=${prefix_drive}${relative_grubdir} $modules || exit 1
 
 if test $update_nvram = yes; then
     set $ofpathname dummy


More information about the Pkg-grub-devel mailing list