Bug 815318 - grub2 fails to set up a correct boot environment on PowerPC (PowerMac)
grub2 fails to set up a correct boot environment on PowerPC (PowerMac)
Status: CLOSED WONTFIX
Product: Fedora
Classification: Fedora
Component: grub2 (Show other bugs)
17
powerpc Linux
high Severity high
: ---
: ---
Assigned To: Peter Jones
Fedora Extras Quality Assurance
: Reopened
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2012-04-23 06:55 EDT by Karsten Hopp
Modified: 2013-08-01 14:15 EDT (History)
6 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2013-08-01 14:15:17 EDT
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)
output of sh -x grub2-install /dev/sda2 (178.65 KB, text/plain)
2012-04-23 12:41 EDT, Karsten Hopp
no flags Details
patch to add support for grub2 on PowerMac HFS partitions (4.41 KB, patch)
2012-04-25 07:53 EDT, Karsten Hopp
no flags Details | Diff
patch to use mkfs (1.65 KB, patch)
2012-05-10 08:24 EDT, Karsten Hopp
no flags Details | Diff

  None (edit)
Description Karsten Hopp 2012-04-23 06:55:33 EDT
Description of problem:
grub2 works fine on IBM PPC systems, but doesn't work out of the box on PowerMac, grub2-install aborts with '/dev/sda2 is not a PReP partition'

These steps were necessary to get it to work on my G5:
mount -t hfs /dev/sda2 /mnt    # HFS partition where the grub image on Apple HW
                               # needs to be installed/copied onto
# rm -f /mnt/*                 # remove yaboot, not enough space
cd /usr/lib/grub/powerpc-ieee1275

cat > /tmp/grub.cfg <<EOT
insmod part_apple
insmod ext2
insmod lvm
insmod boot
insmod hfs
insmod gzio
search --no-floppy --fs-uuid --set=root a99ca62e-2649-465c-a06f-ff9203061198
set prefix=($root)/grub2
configfile /grub2/grub.cfg
EOT
# a99ca62e-2649-465c-a06f-ff9203061198 is the UUID of my /boot partition:
# df /boot| cut -d ' ' -f 1 | xargs blkid

grub2-mkimage -O powerpc-ieee1275 -o /mnt/grub.img -c /tmp/grub.cfg --prefix "(ieee1275/hd,apple2)" {blocklist,boot,bufio,cat,cmp,configfile,cpio_be,cpio,crc64,datehook,date,datetime,dm_nv,echo,elf,ext2,fat,font,fshelp,functional_test,gettext,gptsync,gzio,halt,hello,help,hfs,hfsplus,ieee1275_fb,keylayouts,keystatus,linux,loadenv,loopback,ls,lvm,lzopio,mdraid09,mdraid1x,memdisk,memrw,minicmd,minix2,minix3,minix,msdospart,net,newc,normal,ofnet,part_apple,part_bsd,part_dvh,part_gpt,part_msdos,part_plan,parttool,pbkdf2,priority_queue,probe,raid5rec,raid6rec,read,reboot,regexp,romfs,scsi,search_fs_file,search_fs_uuid,search_label,search,serial,setjmp,sleep,squash4,suspend,terminal,time,trig,true,videotest,xzio}.mod
# We can't install all modules as the HFS partition is only 1048 kb
# We also can't use the *gfx modules as those mess up the display pretty bad


umount /mnt/

# This installs a minimal grub.cfg file on the HFS partition which then searches and loads the real grub config file on the /boot partition. This avoids having to update the files on the HFS partition during each kernel update.

Version-Release number of selected component (if applicable):
grub2-2.0-0.22.fc17.ppc64
Comment 1 Mads Kiilerich 2012-04-23 07:31:43 EDT
It seems like that wasn't the exact error message - was it?

pjones is working on a upgrade to beta4 - please try with a 0.23 build from git which is very close to upstream.

Please try to run grub2-install with bash -x and see why it fails. I guess it fails because grub2-probe returns something else than 41 (PPC PReP Boot)? Isn't that the right thing to do?

grub2-install should automatically only include the necessary modules in the image and it should thus fit on the partition once you get that far.

(Note that 20_ppc_terminfo haven't been upstreamed and might conflict with recent upstream development. It seems strange that it should be priority 20 - It looks more like a 01 thing.)
Comment 2 Karsten Hopp 2012-04-23 12:07:49 EDT
correct, the last few lines of the bash -x output are:

+ '[' -z /dev/sda2 ']'
++ /usr/sbin/grub2-probe -m '' -d /dev/sda2 -t msdos_parttype
+ '[' '' '!=' 41 ']'
+ gettext 'The chosen partition is not a PReP partition.'



> /usr/sbin/grub2-probe -m '' -d /dev/sda2 -t msdos_parttype

> echo $?
0
>


As I said, Apple PowerMacs don't have PReP partitions, they use HFS partitions for their boot files.
Comment 3 Mads Kiilerich 2012-04-23 12:28:25 EDT
So this is a Open Firmware system and it should have ended up in the True branch of the if statement?

What is the previous line of -x output ... or what is "${grub_modinfo_target_cpu}-${grub_modinfo_platform}"? Apparently not "powerpc-ieee1275"?
Comment 4 Karsten Hopp 2012-04-23 12:41:26 EDT
Created attachment 579631 [details]
output of sh -x grub2-install /dev/sda2
Comment 5 Mads Kiilerich 2012-04-23 13:15:36 EDT
(In reply to comment #3)
> "${grub_modinfo_target_cpu}-${grub_modinfo_platform}"? Apparently not
> "powerpc-ieee1275"?

Baaah. Obviously it _is_ "powerpc-ieee1275" and IEEE1275 _is_ Open Firmware.

Anyway: Do the non-PReP branch of the if statement work for your case?

It seems like http://bzr.savannah.gnu.org/lh/grub/trunk/grub/revision/3764 got something wrong. Perhaps "powerpc-ieee1275" in some cases still should reach install_device= .

(http://bzr.savannah.gnu.org/lh/grub/trunk/grub/revision/4146 refactored it but didn't change this aspect.)

Anyway, I guess you as a PPC expert is most qualified to propose and discuss a fix upstream ... unless you can bribe one of the other RH guys to do it.

(The trace shows that it generated a small /boot/grub2/powerpc-ieee1275/core.elf that will look for grub.cfg and modules in (I presume) /boot/grub2. Do that work for you? And the reason the probe fails seems to be that it isn't msdos partitioned at all ... which is one reason it shouldn't end up in that branch.)
Comment 6 Karsten Hopp 2012-04-25 07:53:45 EDT
Created attachment 580140 [details]
patch to add support for grub2 on PowerMac HFS partitions

patch that sets up grub2 on a PowerMac G5 with an HFS partition and hopefully doesn't break anything on the other archs
Comment 7 Mads Kiilerich 2012-04-25 09:04:18 EDT
What grub version do that patch apply to? (It fails everywhere here.)

It also seems like the patch try to fix the strange tab indent at the same time - that makes it hard to review.
Comment 8 Karsten Hopp 2012-04-25 09:56:08 EDT
this is for 2.00~beta4  or better grub2-2.0-0.23.fc17
Comment 9 Mads Kiilerich 2012-04-25 10:20:48 EDT
Right - it apply on top of grub-1.99-Fix-tests-of-zeroed-partition.patch ... which haven't been upstreamed.

Note to self: The patch moves some code around, but the only real change is in cases which otherwise would have ended up in "The chosen partition is not a PReP partition."
Comment 10 Mads Kiilerich 2012-04-30 19:11:03 EDT
grub2-2.0-0.24.beta4.fc17 has been pushed to f17 stable - closing.

- but please send the patch upstream too!
Comment 11 Mads Kiilerich 2012-05-10 06:56:39 EDT
Feedback from phcoder upstream:

grub-2.00~beta4-add-support-for-PowerMac-HFS-partitions.patch: Unsafe if partition is mounted
...
this section writes to the potentially mounted filesystem directly
...
hmount has nothing to do with standard mount. I'm speaking about simultaneous access through htools and standard way
...
htools is like mtools and will not do proper locking
Comment 12 Karsten Hopp 2012-05-10 08:24:28 EDT
Created attachment 583531 [details]
patch to use mkfs
Comment 13 Vladimir Serbinenko 2012-06-01 07:18:43 EDT
Actually this whole thread results from a simple misconception as to how to install GRUB on HFS(+) in the first place. Usual way is to mount it on /boot/grub and use grub-install *without* disk argument
Comment 14 Mads Kiilerich 2012-06-01 20:07:16 EDT
This patch no longer apply on top of beta6.
Comment 15 Fedora End Of Life 2013-07-04 02:39:21 EDT
This message is a reminder that Fedora 17 is nearing its end of life.
Approximately 4 (four) weeks from now Fedora will stop maintaining
and issuing updates for Fedora 17. It is Fedora's policy to close all
bug reports from releases that are no longer maintained. At that time
this bug will be closed as WONTFIX if it remains open with a Fedora 
'version' of '17'.

Package Maintainer: If you wish for this bug to remain open because you
plan to fix it in a currently maintained version, simply change the 'version' 
to a later Fedora version prior to Fedora 17's end of life.

Bug Reporter:  Thank you for reporting this issue and we are sorry that 
we may not be able to fix it before Fedora 17 is end of life. If you 
would still like  to see this bug fixed and are able to reproduce it 
against a later version  of Fedora, you are encouraged  change the 
'version' to a later Fedora version prior to Fedora 17's end of life.

Although we aim to fix as many bugs as possible during every release's 
lifetime, sometimes those efforts are overtaken by events. Often a 
more recent Fedora release includes newer upstream software that fixes 
bugs or makes them obsolete.
Comment 16 Fedora End Of Life 2013-08-01 14:15:22 EDT
Fedora 17 changed to end-of-life (EOL) status on 2013-07-30. Fedora 17 is 
no longer maintained, which means that it will not receive any further 
security or bug fix updates. As a result we are closing this bug.

If you can reproduce this bug against a currently maintained version of 
Fedora please feel free to reopen this bug against that version.

Thank you for reporting this bug and we are sorry it could not be fixed.

Note You need to log in before you can comment on or make changes to this bug.