You are not logged in.

#1 2011-11-21 04:02:36

David Batson
Member
Registered: 2011-10-13
Posts: 640

[SOLVED] Shoulda read the fine print first - GRUB2

I was getting bored, so I decided to install GRUB2 with pacman on my existing hard drive with 4 OS's installed.  Previous GRUB 0.97 was using my arch menu.lst to boot everything.  So I install GRUB2 and reboot, and what do I get?  The: GRUB > prompt!

Now what?

Tried a couple of things, but no dice so far.  Arch is installed on sda7 and my boot partition (Windows 7) is sda1.
Tried to run configfile (sda7,msdos1) /grub/grub.cfg
Not real sure I even have a grub.cfg file at the moment in arch.

[root@localhost ~]# fdisk -l

Disk /dev/sda: 320.1 GB, 320072933376 bytes
255 heads, 63 sectors/track, 38913 cylinders, total 625142448 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: 0xf587e0dc

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *        2048     2457599     1227776    7  HPFS/NTFS
/dev/sda2         2457600   297459711   147501056    7  HPFS/NTFS
/dev/sda3       297475605   604661759   153593077+   f  W95 Ext'd (LBA)
/dev/sda4       604661760   625139711    10238976    7  HPFS/NTFS
/dev/sda5       297475668   389608379    46066356   83  Linux
/dev/sda6       399863808   502263807    51200000   83  Linux
/dev/sda7       502265856   604661759    51197952   83  Linux
/dev/sda8       389608443   399857849     5124703+  82  Linux swap / Solaris

Partition table entries are not in disk order
[root@localhost ~]# blkid
/dev/sda1: LABEL="SYSTEM_DRV" UUID="D622A89922A87FDB" TYPE="ntfs"
/dev/sda2: LABEL="Windows7_OS" UUID="DE22B43B22B41A8B" TYPE="ntfs"
/dev/sda4: LABEL="Lenovo_Recovery" UUID="822EBF872EBF72B1" TYPE="ntfs"
/dev/sda5: UUID="2ea1aa54-4294-45c7-a639-938e42bfce16" TYPE="ext4"
/dev/sda6: UUID="f53287f7-1aa5-487f-946a-9c71c98266f1" TYPE="ext4"
/dev/sda8: UUID="05a22f85-131a-487e-bc4b-2fea1679f943" TYPE="swap" LABEL="SWAP"
/dev/sda7: LABEL="Archlinux" UUID="94a77b65-aeec-47bf-8583-469ff30a2a98" TYPE="ext4"

I tried this from the GRUB2 Archwiki and it doesn't seem to recognize the command.

If you forgot to create a GRUB2 /boot/grub/grub.cfg configfile and simply rebooted into GRUB2 Command Shell, type:

sh:grub> insmod legacycfg
sh:grub> legacy_configfile ${prefix}/menu.lst

Newbies! roll

Last edited by David Batson (2011-11-22 02:22:06)

Offline

#2 2011-11-21 12:36:01

David Batson
Member
Registered: 2011-10-13
Posts: 640

Re: [SOLVED] Shoulda read the fine print first - GRUB2

I got as far as booting my Fedora partition using the chainloader command and boot command from the GRUB prompt.  This will not work with the Arch or Mageia partitions for some reason.  I might have installed GRUB2 on Mageia awhile back - don't remember for sure.

grub > chainloader (hd0,5)+1
grub > boot

Partial menu.lst from Mageia to boot Mageia

title linux
kernel (hd0,4)/boot/vmlinuz BOOT_IMAGE=linux root=UUID=b23a0247-dd1b-4bc5-9fcc-03c690b0075c nokmsboot resume=UUID=aae0a754-f328-496c-8677-8ce603eb71d3 splash=silent vga=788
initrd (hd0,4)/boot/initrd.img

Partial menu.lst from Fedora to boot Fedora

title Fedora (2.6.41.1-1.fc15.x86_64)
	root (hd0,5)
	kernel /boot/vmlinuz-2.6.41.1-1.fc15.x86_64 ro root=UUID=79aac96f-04c3-4b9b-a350-d22f1395d460 rd_NO_LUKS rd_NO_LVM rd_NO_MD rd_NO_DM LANG=en_US.UTF-8 SYSFONT=latarcyrheb-sun16 KEYTABLE=us rhgb quiet i915.i915_enable_rc6=1
	initrd /boot/initramfs-2.6.41.1-1.fc15.x86_64.img

Current /boot/grub/grub.cfg from Arch

#
# 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 ###
insmod part_gpt
insmod part_msdos
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 vbe
  insmod vga
  insmod video_bochs
  insmod video_cirrus
}

insmod part_msdos
insmod ext2
set root='(hd0,msdos3)'
search --no-floppy --fs-uuid --set=root fb70f55b-e58a-4ac6-af45-19d19cc24d60
if loadfont /usr/share/grub/unicode.pf2 ; then
  set gfxmode=auto
  load_video
  insmod gfxterm
  insmod part_msdos
  insmod ext2
  set root='(hd0,msdos3)'
  search --no-floppy --fs-uuid --set=root fb70f55b-e58a-4ac6-af45-19d19cc24d60
  set locale_dir=($root)/boot/grub/locale
  set lang=en_US
  insmod gettext
fi
terminal_input console
terminal_output gfxterm
set timeout=5
### END /etc/grub.d/00_header ###

### BEGIN /etc/grub.d/10_linux ###
menuentry 'Arch Linux, with Linux vmlinuz26-lts' --class archlinux --class gnu-linux --class gnu --class os {
	load_video
	set gfxpayload=keep
	insmod part_msdos
	insmod ext2
	set root='(hd0,msdos3)'
	search --no-floppy --fs-uuid --set=root fb70f55b-e58a-4ac6-af45-19d19cc24d60
	echo	'Loading Linux vmlinuz26-lts ...'
	linux	/boot/vmlinuz26-lts root=/dev/disk/by-uuid/fb70f55b-e58a-4ac6-af45-19d19cc24d60 ro  quiet
	echo	'Loading initial ramdisk ...'
	initrd	/boot/kernel26-lts.img
}
menuentry 'Arch Linux, with Linux vmlinuz26-lts Fallback' --class archlinux --class gnu-linux --class gnu --class os {
	load_video
	set gfxpayload=keep
	insmod part_msdos
	insmod ext2
	set root='(hd0,msdos3)'
	search --no-floppy --fs-uuid --set=root fb70f55b-e58a-4ac6-af45-19d19cc24d60
	echo	'Loading Linux vmlinuz26-lts ...Loading Linux Fallback ...'
	linux	/boot/vmlinuz26-lts root=/dev/disk/by-uuid/fb70f55b-e58a-4ac6-af45-19d19cc24d60 ro  quiet
	echo	'Loading initial ramdisk ...'
	initrd	/boot/kernel26-lts-fallback.img
}
menuentry 'Arch Linux, with Linux vmlinuz26' --class archlinux --class gnu-linux --class gnu --class os {
	load_video
	set gfxpayload=keep
	insmod part_msdos
	insmod ext2
	set root='(hd0,msdos3)'
	search --no-floppy --fs-uuid --set=root fb70f55b-e58a-4ac6-af45-19d19cc24d60
	echo	'Loading Linux vmlinuz26 ...'
	linux	/boot/vmlinuz26 root=/dev/disk/by-uuid/fb70f55b-e58a-4ac6-af45-19d19cc24d60 ro  quiet
	echo	'Loading initial ramdisk ...'
	initrd	/boot/kernel26.img
}
menuentry 'Arch Linux, with Linux vmlinuz26 Fallback' --class archlinux --class gnu-linux --class gnu --class os {
	load_video
	set gfxpayload=keep
	insmod part_msdos
	insmod ext2
	set root='(hd0,msdos3)'
	search --no-floppy --fs-uuid --set=root fb70f55b-e58a-4ac6-af45-19d19cc24d60
	echo	'Loading Linux vmlinuz26 ...Loading Linux Fallback ...'
	linux	/boot/vmlinuz26 root=/dev/disk/by-uuid/fb70f55b-e58a-4ac6-af45-19d19cc24d60 ro  quiet
	echo	'Loading initial ramdisk ...'
	initrd	/boot/kernel26-fallback.img
}
### END /etc/grub.d/10_linux ###

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

### BEGIN /etc/grub.d/20_memtest86+ ###
menuentry "Memory test (memtest86+)" --class memtest86 --class gnu --class tool {
  insmod part_msdos
  insmod ext2
  set root='(hd0,msdos3)'
  search --no-floppy --fs-uuid --set=root fb70f55b-e58a-4ac6-af45-19d19cc24d60
  linux16 ($root)/boot/memtest86+/memtest.bin
}
### END /etc/grub.d/20_memtest86+ ###

### 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 ###

Offline

#3 2011-11-21 23:36:38

David Batson
Member
Registered: 2011-10-13
Posts: 640

Re: [SOLVED] Shoulda read the fine print first - GRUB2

Making a little progress.  Found I could boot Arch by copying the lines from /boot/grub/menu.lst.pacsave

grub > root (hd0,6)
grub > kernel /boot/vmlinuz-linux root=/dev/sda7
grub > initrd /boot/initramfs-linux.img
grub > boot

Now to finish the GRUB2 setup...

Offline

#4 2011-11-22 02:21:32

David Batson
Member
Registered: 2011-10-13
Posts: 640

Re: [SOLVED] Shoulda read the fine print first - GRUB2

I've got it! smile

Once I was able to boot Arch (see previous post) I followed the instructions on the Arch Linux GRUB2 wiki to finish the GRUB2 setup. https://wiki.archlinux.org/index.php/GRUB2

This got me to a working grub with Arch and Windows 7.  To get everything to boot (Mageia 1 and Fedora 15) I modified my original /boot/grub/menu.lst file from Arch's previous grub with the new GRUB2 syntax.  I put this in /etc/grub.d/40_custom, deleted /boot/grub/grub.cfg, then reran # grub-mkconfig -o /boot/grub/grub.cfg

Here is the relevant portion of my previous /boot/grub/menu.lst file that I used for reference:

# (1) Mageia 1
title Mageia 1
kernel (hd0,4)/boot/vmlinuz BOOT_IMAGE=linux root=/dev/sda5 resume=/dev/sda8  splash=silent vga=788
initrd (hd0,4)/boot/initrd.img

# (2) Mageia 1-nonfb
title Mageia1-nonfb
kernel (hd0,4)/boot/vmlinuz BOOT_IMAGE=linux-nonfb root=/sda5 resume=/dev/sda8
initrd (hd0,4)/boot/initrd.img

# (3) Mageia 1 failsafe
title Mageia1 failsafe
kernel (hd0,4)/boot/vmlinuz BOOT_IMAGE=failsafe root=/dev/sda5  failsafe
initrd (hd0,4)/boot/initrd.img

# (4) Fedora 15 (2.6.41.1)
title Fedora (2.6.41.1-1.fc15.x86_64)
root (hd0,5)
kernel /boot/vmlinuz-2.6.41.1-1.fc15.x86_64 ro root=/dev/sda6 rd_NO_LUKS rd_NO_LVM rd_NO_MD rd_NO_DM LANG=en_US.UTF-8 SYSFONT=latarcyrheb-sun16 KEYTABLE=us rhgb quiet  i915.i915_enable_rc6=1
initrd /boot/initramfs-2.6.41.1-1.fc15.x86_64.img

# (5) Fedora 15 (2.6.40.6)
title Fedora (2.6.40.6-0.fc15.x86_64)
root (hd0,5)
kernel /boot/vmlinuz-2.6.40.6-0.fc15.x86_64 ro root=/dev/sda6 rd_NO_LUKS rd_NO_LVM rd_NO_MD rd_NO_DM LANG=en_US.UTF-8 SYSFONT=latarcyrheb-sun16 KEYTABLE=us rhgb quiet
initrd /boot/initramfs-2.6.40.6-0.fc15.x86_64.img

Here is the resultant /etc/grub.d/40_custom file in its entirety:

#!/bin/sh
exec tail -n +3 $0
# 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.
menuentry "Microsoft Windows 7 BIOS-MBR" {
    insmod part_msdos
    insmod ntfs
    insmod search_fs_uuid
    insmod ntldr     
    search --fs-uuid --no-floppy --set=root 44EAEFD5EAEFC172
    ntldr (${root})/bootmgr
}
# (1) Mageia 1
menuentry "Mageia 1" {
	load_video
	set gfxpayload=keep
	insmod gzio
	insmod part_msdos
	insmod ext2
	set root='(hd0,msdos5)'
	search --no-floppy --fs-uuid --set=root b23a0247-dd1b-4bc5-9fcc-03c690b0075c
	linux /boot/vmlinuz BOOT_IMAGE=linux root=/dev/sda5 resume=/dev/sda8  splash=silent vga=788
	initrd /boot/initrd.img
}
# (2) Mageia 1-nonfb
menuentry "Mageia1-nonfb" {
	load_video
	set gfxpayload=keep
	insmod gzio
	insmod part_msdos
	insmod ext2
	set root='(hd0,msdos5)'
	search --no-floppy --fs-uuid --set=root b23a0247-dd1b-4bc5-9fcc-03c690b0075c
	linux /boot/vmlinuz BOOT_IMAGE=linux-nonfb root=/sda5 resume=/dev/sda8
	initrd /boot/initrd.img
}
# (3) Mageia 1 failsafe
menuentry "Mageia1 failsafe" {
	load_video
	set gfxpayload=keep
	insmod gzio
	insmod part_msdos
	insmod ext2
	set root='(hd0,msdos5)'
	search --no-floppy --fs-uuid --set=root b23a0247-dd1b-4bc5-9fcc-03c690b0075c
	linux /boot/vmlinuz BOOT_IMAGE=failsafe root=/dev/sda5  failsafe
	initrd /boot/initrd.img
}
# (4) Fedora 15 (2.6.41.1)
menuentry "Fedora (2.6.41.1-1.fc15.x86_64)" {
	load_video
	set gfxpayload=keep
	insmod gzio
	insmod part_msdos
	insmod ext2
	set root='(hd0,msdos6)'
	search --no-floppy --fs-uuid --set=root 79aac96f-04c3-4b9b-a350-d22f1395d460
	linux /boot/vmlinuz-2.6.41.1-1.fc15.x86_64 ro root=/dev/sda6 rd_NO_LUKS rd_NO_LVM rd_NO_MD rd_NO_DM LANG=en_US.UTF-8 SYSFONT=latarcyrheb-sun16 KEYTABLE=us rhgb quiet  i915.i915_enable_rc6=1
	initrd /boot/initramfs-2.6.41.1-1.fc15.x86_64.img
}
# (5) Fedora 15 (2.6.40.6)
menuentry "Fedora (2.6.40.6-0.fc15.x86_64)" {
	load_video
	set gfxpayload=keep
	insmod gzio
	insmod part_msdos
	insmod ext2
	set root='(hd0,msdos6)'
	search --no-floppy --fs-uuid --set=root 79aac96f-04c3-4b9b-a350-d22f1395d460
	linux /boot/vmlinuz-2.6.40.6-0.fc15.x86_64 ro root=/dev/sda6 rd_NO_LUKS rd_NO_LVM rd_NO_MD rd_NO_DM LANG=en_US.UTF-8 SYSFONT=latarcyrheb-sun16 KEYTABLE=us rhgb quiet
	initrd /boot/initramfs-2.6.40.6-0.fc15.x86_64.img
}

Notice in menu.lst that root (hd0,5) becomes set root='(hd0,msdos6)' in 40_custom.
Notice that kernel xxxxxxx becomes linux xxxxxxx.

Offline

Board footer

Powered by FluxBB