Issues when updating from GRUB to GRUB2

Hi,

I think I messed up the boot loaders. I tried to keep up with the new world and got stuck…
Grub 2 doesn’t detect anymore my Mac partition.
I tried to add it as a customs entry in Yast GUI but it didn’t work. I reverted to Grub legacy and now if I select the Mac entry it shows only the map partitions, rootnoverify, chaninloader+1 and GRUB right below and nothing else… I double checked the entry in menu.lst, it is just the way it was before playing with it.
can you please help?

You mean there is no entry in the boot menu for MacOS X?
Verify that “Probe for foreign OS” is enabled in YaST->System->Boot Loader->Boot Loader Options.

If that doesn’t help, mount your MacOS partition (to be sure), run “sudo os-prober” manually and psot the output.

I tried to add it as a customs entry in Yast GUI but it didn’t work.

???
There is no way to enter a custom entry in YaST GUI when GRUB2 is selected.
How did you do that?

I reverted to Grub legacy and now if I select the Mac entry it shows only the map partitions, rootnoverify, chaninloader+1 and GRUB right below and nothing else… I double checked the entry in menu.lst, it is just the way it was before playing with it.

Maybe there’s something wrong with the partition/MacOS installation itself? Would explain why GRUB2 doesn’t show an entry…

And please specify which openSUSE version you are using.

Mixing MBR and EFI booting can cause such a problem a MBR installed OS may not see a EFI installed OS.

I’m very sure I checked the Probe for foreign OS option…
I’ll run the prober thanks.

I did it from “boot from mbr, boot from boot partition and custom partition” options, I put the respective partition there, I didn’t say it right.
I don’t think it could be smth related to the mac partition because it worked very well under grub legacy.

I’m using openSUSE 13.1.

Can you please tell me also how can I change entries name and add also the USB entry (I had it in the original configuration as I edited menu.lst, now it seems incredible complicated) if it’s possible?

This specifies where the bootloader should be installed. It does not add an entry to the menu.

I don’t think it could be smth related to the mac partition because it worked very well under grub legacy.

Well, it doesn’t work with grub legacy now either, correct?
Maybe installing the bootloader to the Mac partition broke something? (I have no experience with MacOS X)

Can you please tell me also how can I change entries name and add also the USB entry (I had it in the original configuration as I edited menu.lst, now it seems incredible complicated) if it’s possible?

The configuration is created automatically, and cannot be easily changed.

For renaming entries, you’d have to modify the scripts in /etc/grub.d accordingly, those create the grub.cfg.

Adding new entries is easier, just put them into /boot/grub2/custom.cfg, or /etc/grub.d/40_custom, or you could even add them in /boot/grub2/grub.cfg directly between the lines “### BEGIN /etc/grub.d/90_persistent ###” and “### END /etc/grub.d/90_persistent ###” at the end.
(everything else in grub.cfg will be lost if it is re-generated by the system)

If you’re using KDE maybe have a look at openSUSE Software
Probably something similar exists for other desktops as well.

PS: I don’t remember ever having had an “USB entry”, not even with grub legacy…

Wow they look very promising, can’t wait to test them.
Regarding USB, it was very simple, I added /dev/sdc (or hd2 i.e.) as other bootable OS entry in menu.lst…

I thought of what you said gogalthorp… But wasn’t it also the case of grub legacy?

I wouldn’t have updated grub but a friend told me to keep up with the new world. :slight_smile:

I tried to mount a mac partition from partitioner: if I select do not format and I leave the mount options by default, I receive 2 errors, 'mount point must no be empty 'and ‘it is not allowed to assign a mount point to a device with nonexistent or unknown file system’.
The filesystem is HFS+.

sudo os-prober
root’s password:
WARNING: Ignoring unsupported value for expected.
WARNING: Ignoring unsupported value for expected.
/dev/cdrom: read failed after 0 of 2048 at 0: Input/output error
No volume groups found
/dev/sda1:Windows 7 (loader):Windows:chain
/dev/sdb1:Windows 7 (loader):Windows1:chain
/dev/sdb2:Windows 7 (loader):Windows2:chain

I don’t think HFS is supported

but boot legacy could see and boot it…

Did you specify a mount point? The 1st error would suggest you didn’t.
And what did you specify exactly as mount point?

Anyway, try to mount the partition like this:

sudo mount /dev/sda1 /mnt

(replace /dev/sda1 with the actual device name of course)

Does this work?

os-prober apparently does not recognize your MacOS X.
Maybe related to those “WARNING: Ignoring unsupported value for expected.”, I don’t know.

Maybe it would see it if you mounted it, so try again afterwards (but it shouldn’t be necessary normally).

But if you can’t even boot MacOS X with the unchanged grub legacy entry, I really thing something got broken there.
Unfortunately I cannot help you at all with rescuing your MacOS X installation, nor with getting it to boot with grub2. I know next to nothing about MacOS.

The standard kernel package contains a hfs and a hfs+ file system, so you should be able to mount it.
And os-prober does contain a prober for MacOS.
And grub2 contains a hfs.mod and a hfsplus.mod.

So I do think it should be supported… :wink:

I mounted the partition as /mnt but prober is still saying:

sudo os-prober
No volume groups found
/dev/sda1:Windows 7 (loader):Windows:chain
/dev/sdb1:Windows 7 (loader):Windows1:chain
/dev/sdb2:Windows 7 (loader):Windows2:chain

First time I didn’t specify any mount point… there were /srv, /tmp and /user/local… I didn’t know what to choose and i left it by default.
now they are mounted as /mnt.
it definetely got broken when i played with the boot loader locations, custom boot partition. that was when it didn’t work anymore.
I could try to write again the mbr with the mac info, but i’ll have to install grub again.

thanks a lot for the very quick replies.

You could have a look to the system log (/var/log/messages or “journalctl”), os-prober will print some debug output there.

But here’s how os-prober checks for MacOS:

  1. it has to be a hfsplus partition
  2. there has to be a file mach_kernel in the root directory

See also /usr/lib/os-probes/mounted/20macosx.
So, does /mnt/mach_kernel exist (when you mount the partition to /mnt)?

tones of info in messages, cannot copy, it’s too much.
in /usr/lib/os-probes/mounted/20macosx:

 	 	 	   #!/bin/sh -e

Detects Mac OS X. I don’t yet know how Mac OS <= 9 fits into this.

. /usr/share/os-prober/common.sh

partition="$1"
mpoint="$2"
type="$3"

debug() {
logger -t macosx-prober “debug: $@”
}

Weed out stuff that doesn’t apply to us

case “$type” in
hfsplus) debug “$1 is an HFS+ partition” ;;
*) debug “$1 is not an HFS+ partition: exiting”; exit 1 ;;
esac

Could use a better test than this.

/System/Library/CoreServices/SystemVersion.plist has version information,

but I don’t think it exists on Mac OS <= 9, and it’s XML so parsing in

shell will be nasty.

if -e “$2/mach_kernel” ]; then
label="$(count_next_label MacOSX)"
result “$1:Mac OS X:$label:macosx”
exit 0
else
exit 1
fi

Run os-prober and then inspect the last lines with “tail -20 /var/log/messages” (use different values for 20, that’s the number of lines)
Or open the file in a text editor or with less, scroll to the end, then scroll back to the start of os-prober’s output.
And os-prober marks its output with “os-prober:”, so a grep should be ok too:

sudo grep os-prober /var/log/messages

But this will of course give the debug output from all runs that are in the log.

in /usr/lib/os-probes/mounted/20macosx:

Yes, that’s the script that checks for MacOS X.
I have the same here, I know how it looks like… No need to post it. :wink:

Well I made grub legacy boot mac again, I needed only to write the MBR by means of clover.

Now I remember mac wasn’t detected in grub legacy either and I had to add it manually in menu.lst.
The problem is I don’t know how to add it in grub2. I’ll try your editor tomorrow morning.

By the way, the 2 mac partitions are not mounted now. :wink:

Ok, so only the PBR was overwritten I suppose.
Makes sense as you use chainloader in your grub legacy entry.

Now I remember mac wasn’t detected in grub legacy either and I had to add it manually in menu.lst.
The problem is I don’t know how to add it in grub2. I’ll try your editor tomorrow morning.

Put something like this into /boot/grub2/custom.cfg (or any of the other places I mentioned):

menuentry "MacOS" {
insmod chain
insmod hfsplus
set root=(hd0,1)
chainloader +1
}

Not really much more complicated than with grub legacy, is it? :wink:

I haven’t tested this myself with MacOS though.
See also here for the device syntax: GNU GRUB Manual 2.12: Device syntax
But note, that grub2 counts partitions starting with 1, in contrast to grub legacy which starts at 0. So (hd0,1) is the first partition on the first drive, whereas it was the *second *partition on the first drive with grub legacy.

There’s also the “drivemap” command if you need to map/swap the drives, e.g.:

drivemap -s (hd0) (hd1)

Still I wonder why your MacOS isn’t detected automatically. Might be worth a bug report maybe?

os-prober has code to detect OS/X; though resulting menu entry is known to work only in CSM mode.

Did you actually test it? grub2 contains special EFI emulation code just to be able to load OS/X kernel; I doubt anyone would waste time writing it if it were as simple.

No, as I wrote I don’t have MacOS.

grub2 contains special EFI emulation code just to be able to load OS/X kernel; I doubt anyone would waste time writing it if it were as simple.

Well, in the OP’s case, using chainloader to boot MacOS worked/works fine with grub legacy, so it should work with grub2 as well, I’d suppose.