You are not logged in.

#1 2010-11-20 20:16:12

graysky
Member
From: The worse toilet in Scotland
Registered: 2008-12-01
Posts: 8,818
Website

grub2 can't see partition on a MBR drive but can on GPT drives

I have three hdds, the first two are formatted with GPT and the third MBR so as to boot windows when needed.  I have grub2 installed on /dev/sda and I can boot my Arch partitions just fine.  I can't however boot the windows partition (/dev/sdc1).  I can't even see the partition on it via grub2's console.  First, under Linux:

# fdisk -l /dev/sdc

Disk /dev/sdc: 1000.2 GB, 1000204886016 bytes
255 heads, 63 sectors/track, 121601 cylinders, total 1953525168 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x000c14bc

   Device Boot      Start         End      Blocks   Id  System
/dev/sdc1   *        2048   122882047    61440000    7  HPFS/NTFS
/dev/sdc2       122882048  1953523711   915320832   83  Linux

Now in the grub2 console:

grub> ls
(hd0) (hd0,6) (hd0,5) (hd0,4) (hd0,3) (hd0,2) (hd0,1) (hd1) (hd1,2) (hd1,1) (hd2)

Note that there are no entries for (hd2,1) and (hd2,2) for some reason.  Is this because my first two drives are GPT formatted and grub isn't loading a module for MBR... or?

/etc/grub/grub.cfg

#
# DO NOT EDIT THIS FILE
#
# It is automatically generated by /sbin/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
}
set menu_color_normal=light-blue/black
set menu_color_highlight=light-cyan/blue

insmod ext2
set root='(hd1,1)'
search --no-floppy --fs-uuid --set f20eb010-e657-4364-acd0-45ed3f9f20c1
if loadfont /usr/share/grub/unicode.pf2 ; then
  set gfxmode=1024x768x24
  insmod gfxterm
  insmod vbe
  if terminal_output gfxterm ; then true ; else
    # For backward compatibility with versions of terminal.mod that don't
    # understand terminal_output
    terminal gfxterm
  fi
  insmod ext2
  set root='(hd0,5)'
  search --no-floppy --fs-uuid --set 0fc7ed20-0b1e-4e26-860c-6e63dd3a35ea
  insmod png
  background_image ($root)/grub/genesis.png
fi
insmod ext2
set root='(hd0,5)'
search --no-floppy --fs-uuid --set 0fc7ed20-0b1e-4e26-860c-6e63dd3a35ea
set locale_dir=($root)/grub/locale
set lang=en
insmod gettext
set timeout=5
### END /etc/grub.d/00_header ###

### BEGIN /etc/grub.d/10_linux ###
menuentry "Arch Linux, with Linux vmlinuz26-ck" --class archlinux --class gnu-linux --class gnu --class os {
    set gfxpayload=keep
    insmod ext2
    set root='(hd0,5)'
    search --no-floppy --fs-uuid --set 0fc7ed20-0b1e-4e26-860c-6e63dd3a35ea
    echo    Loading Linux vmlinuz26-ck ...
    linux    /vmlinuz26-ck root=/dev/disk/by-uuid/f20eb010-e657-4364-acd0-45ed3f9f20c1 ro  quiet
    echo    Loading initial ramdisk ...
    initrd    /kernel26-ck.img
}
menuentry "Arch Linux, with Linux vmlinuz26-ck Fallback" --class archlinux --class gnu-linux --class gnu --class os {
    set gfxpayload=keep
    insmod ext2
    set root='(hd0,5)'
    search --no-floppy --fs-uuid --set 0fc7ed20-0b1e-4e26-860c-6e63dd3a35ea
    echo    Loading Linux vmlinuz26-ck ...Loading Linux Fallback ...
    linux    /vmlinuz26-ck root=/dev/disk/by-uuid/f20eb010-e657-4364-acd0-45ed3f9f20c1 ro  quiet
    echo    Loading initial ramdisk ...
    initrd    /kernel26-ck-fallback.img
}
menuentry "Arch Linux, with Linux vmlinuz26" --class archlinux --class gnu-linux --class gnu --class os {
    set gfxpayload=keep
    insmod ext2
    set root='(hd0,5)'
    search --no-floppy --fs-uuid --set 0fc7ed20-0b1e-4e26-860c-6e63dd3a35ea
    echo    Loading Linux vmlinuz26 ...
    linux    /vmlinuz26 root=/dev/disk/by-uuid/f20eb010-e657-4364-acd0-45ed3f9f20c1 ro  quiet
    echo    Loading initial ramdisk ...
    initrd    /kernel26.img
}
menuentry "Arch Linux, with Linux vmlinuz26 Fallback" --class archlinux --class gnu-linux --class gnu --class os {
    set gfxpayload=keep
    insmod ext2
    set root='(hd0,5)'
    search --no-floppy --fs-uuid --set 0fc7ed20-0b1e-4e26-860c-6e63dd3a35ea
    echo    Loading Linux vmlinuz26 ...Loading Linux Fallback ...
    linux    /vmlinuz26 root=/dev/disk/by-uuid/f20eb010-e657-4364-acd0-45ed3f9f20c1 ro  quiet
    echo    Loading initial ramdisk ...
    initrd    /kernel26-fallback.img
}
### END /etc/grub.d/10_linux ###

### BEGIN /etc/grub.d/20_memtest86+ ###
menuentry "Memory test (memtest86+)" --class memtest86 --class gnu --class tool {
  insmod ext2
  set root='(hd0,5)'
  search --no-floppy --fs-uuid --set 0fc7ed20-0b1e-4e26-860c-6e63dd3a35ea
  linux16 ($root)/memtest86+/memtest.bin
}
### END /etc/grub.d/20_memtest86+ ###

### BEGIN /etc/grub.d/30_os-prober ###
menuentry "Arch (on /dev/sda4)" {
    insmod ext2
    set root='(hd0,4)'
    search --no-floppy --fs-uuid --set f1c45bf7-5da9-4010-89dc-04d2016a6373
    linux /boot/vmlinuz26 root=/dev/sda4
    initrd /boot/kernel26.img
}
menuentry "Windows 7 (loader) (on /dev/sdc1)" {
    insmod ntfs
    set root='(hd2,1)'
    search --no-floppy --fs-uuid --set 1b03a3fc528a9b6c
    chainloader +1
}
### 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/40_custom.pacsave ###
# 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.pacsave ###

CPU-optimized Linux-ck packages @ Repo-ck  • AUR packagesZsh and other configs

Offline

#2 2010-11-20 22:07:45

graysky
Member
From: The worse toilet in Scotland
Registered: 2008-12-01
Posts: 8,818
Website

Re: grub2 can't see partition on a MBR drive but can on GPT drives

Update: Added a 40 MB partition on /dev/sdc and installed grub there; put grub on the MBR of /dev/sdc; "repaired" the win7 boot info.  I can now do this:

grub2 --> chainload to grub on /dev/sdc --> chainload to win7

Has to be a better way.

FYI - here is the grub2 entry to start the process:

menuentry "Windows 7" {
    insmod ntfs
    set root='(hd2)'
    chainloader +1
}

CPU-optimized Linux-ck packages @ Repo-ck  • AUR packagesZsh and other configs

Offline

#3 2010-11-21 00:34:51

thestinger
Trusted User (TU)
From: Toronto, Canada
Registered: 2010-01-23
Posts: 478

Re: grub2 can't see partition on a MBR drive but can on GPT drives

maybe this?

menuentry "Windows 7" {
    set root='(hd2)'
    chainloader +2
}

(since you added a partition)

Before, I think the problem was that you used (hd2,1) instead of (hd2)

Last edited by thestinger (2010-11-21 00:42:24)

Offline

#4 2010-11-21 01:31:33

graysky
Member
From: The worse toilet in Scotland
Registered: 2008-12-01
Posts: 8,818
Website

Re: grub2 can't see partition on a MBR drive but can on GPT drives

One shouldn't need to chainload to (hd2) - pointing to the partition (hd2,1) should work.  Further, why can't grub2 see the damn partitions... that is the real problem I think.


CPU-optimized Linux-ck packages @ Repo-ck  • AUR packagesZsh and other configs

Offline

#5 2010-11-23 07:04:49

skodabenz
Banned
From: Tamilnadu, India
Registered: 2010-04-11
Posts: 382

Re: grub2 can't see partition on a MBR drive but can on GPT drives

Your problem is that the MBR module of grub2 is not loaded.

Try

menuentry "Windows 7" {
    insmod part_msdos
    insmod ntfs
    set root=(hd2,1)
    chainloader +1
}

Manually in the grub2 prompt try

grub> insmod part_msdos
grub> ls
(hd0) (hd0,6) (hd0,5) (hd0,4) (hd0,3) (hd0,2) (hd0,1) (hd1) (hd1,2) (hd1,1) (hd2) (hd2,2) (hd2,1) # your output should be like this

grub-install when setting up grub2 in the mbr (meaning the 1st 440 bytes boot code region alone) region detected GPT partition map in your system and copied that module alone to the core.img, not MBR (msdos) module. Hope this helps.

Last edited by skodabenz (2010-11-23 13:53:28)


My new forum user/nick name is "the.ridikulus.rat" .

Offline

#6 2010-11-23 13:51:06

skodabenz
Banned
From: Tamilnadu, India
Registered: 2010-04-11
Posts: 382

Re: grub2 can't see partition on a MBR drive but can on GPT drives

Is this topic related to what you mentioned for trying grub2-emu at https://bbs.archlinux.org/viewtopic.php?id=108650 . If so grub2-emu will not help here as this is a problem due to creation and embedding of core.img and the location of grub2 prefix. If you don't mind compiling grub2 manually against using the grub2 package in extra, use this script https://gist.github.com/418438 to compile and setup grub2 (works only with bzr trunk or 1.99~beta0, not 1.98).


My new forum user/nick name is "the.ridikulus.rat" .

Offline

Board footer

Powered by FluxBB