How to create chainloader entries for grub2?
wilberfan
Status: New User - Welcome
Joined: 15 Apr 2009
Posts: 3
Reply Quote
I need to turn off os prober, and I need to add an /etc/grub.d/40_custom file that will replace all the probed os stuff with chainloaded boot.

Could I get explicit step by step instructions, as grub 2 is a total and complete mystery to me!

I have multiple OS's on this box: Sidux64, XP, Win7, Sidux32, and Debian Testing. The Sidux64 install is the most recent install--so it's in charge, grub-wise.

Thanks!

Here's my /boot/grub/grub.cfg:

:: Quote ::
#
# DO NOT EDIT THIS FILE
#
# It is automatically generated by /usr/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="6"
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
}
insmod ext2
set root='(hd1,9)'
search --no-floppy --fs-uuid --set e37950d8-2dcf-4cd8-9788-4b31a9e70ab3
if loadfont /usr/share/grub/unicode.pf2 ; then
set gfxmode=640x480
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
fi
insmod ext2
set root='(hd1,9)'
search --no-floppy --fs-uuid --set e37950d8-2dcf-4cd8-9788-4b31a9e70ab3
set locale_dir=($root)/boot/grub/locale
set lang=en
insmod gettext
set timeout=5
### END /etc/grub.d/00_header ###

### BEGIN /etc/grub.d/05_debian_theme ###
set menu_color_normal=cyan/blue
set menu_color_highlight=white/blue
### END /etc/grub.d/05_debian_theme ###

### BEGIN /etc/grub.d/10_linux ###
menuentry "Debian GNU/Linux, with Linux 2.6.33-1.dmz.4-liquorix-amd64" --class debian --class gnu-linux --class gnu --class os {
insmod ext2
set root='(hd1,9)'
search --no-floppy --fs-uuid --set e37950d8-2dcf-4cd8-9788-4b31a9e70ab3
echo Loading Linux 2.6.33-1.dmz.4-liquorix-amd64 ...
linux /boot/vmlinuz-2.6.33-1.dmz.4-liquorix-amd64 root=UUID=e37950d8-2dcf-4cd8-9788-4b31a9e70ab3 ro vga=794 verbose nomodeset
echo Loading initial ramdisk ...
initrd /boot/initrd.img-2.6.33-1.dmz.4-liquorix-amd64
}
menuentry "Debian GNU/Linux, with Linux 2.6.33-1.dmz.4-liquorix-amd64 (recovery mode)" --class debian --class gnu-linux --class gnu --class os {
insmod ext2
set root='(hd1,9)'
search --no-floppy --fs-uuid --set e37950d8-2dcf-4cd8-9788-4b31a9e70ab3
echo Loading Linux 2.6.33-1.dmz.4-liquorix-amd64 ...
linux /boot/vmlinuz-2.6.33-1.dmz.4-liquorix-amd64 root=UUID=e37950d8-2dcf-4cd8-9788-4b31a9e70ab3 ro single vga=794
echo Loading initial ramdisk ...
initrd /boot/initrd.img-2.6.33-1.dmz.4-liquorix-amd64
}
menuentry "Debian GNU/Linux, with Linux 2.6.33-0.dmz.1-liquorix-amd64" --class debian --class gnu-linux --class gnu --class os {
insmod ext2
set root='(hd1,9)'
search --no-floppy --fs-uuid --set e37950d8-2dcf-4cd8-9788-4b31a9e70ab3
echo Loading Linux 2.6.33-0.dmz.1-liquorix-amd64 ...
linux /boot/vmlinuz-2.6.33-0.dmz.1-liquorix-amd64 root=UUID=e37950d8-2dcf-4cd8-9788-4b31a9e70ab3 ro vga=794 verbose nomodeset
echo Loading initial ramdisk ...
initrd /boot/initrd.img-2.6.33-0.dmz.1-liquorix-amd64
}
menuentry "Debian GNU/Linux, with Linux 2.6.33-0.dmz.1-liquorix-amd64 (recovery mode)" --class debian --class gnu-linux --class gnu --class os {
insmod ext2
set root='(hd1,9)'
search --no-floppy --fs-uuid --set e37950d8-2dcf-4cd8-9788-4b31a9e70ab3
echo Loading Linux 2.6.33-0.dmz.1-liquorix-amd64 ...
linux /boot/vmlinuz-2.6.33-0.dmz.1-liquorix-amd64 root=UUID=e37950d8-2dcf-4cd8-9788-4b31a9e70ab3 ro single vga=794
echo Loading initial ramdisk ...
initrd /boot/initrd.img-2.6.33-0.dmz.1-liquorix-amd64
}
### END /etc/grub.d/10_linux ###

### BEGIN /etc/grub.d/20_memtest86+ ###
menuentry "Memory test (memtest86+)" {
insmod ext2
set root='(hd1,9)'
search --no-floppy --fs-uuid --set e37950d8-2dcf-4cd8-9788-4b31a9e70ab3
multiboot /boot/memtest86+_multiboot.bin
}
menuentry "Memory test (memtest86+, serial console 115200)" {
insmod ext2
set root='(hd1,9)'
search --no-floppy --fs-uuid --set e37950d8-2dcf-4cd8-9788-4b31a9e70ab3
multiboot /boot/memtest86+_multiboot.bin console=ttyS0,115200n8
}
### END /etc/grub.d/20_memtest86+ ###

### BEGIN /etc/grub.d/30_os-prober ###
menuentry "Windows 7 (loader) (on /dev/sda1)" {
insmod ntfs
set root='(hd0,1)'
search --no-floppy --fs-uuid --set 80284763284756f6
chainloader +1
}
menuentry "Debian GNU/Linux, kernel 2.6.33-2.dmz.1-liquorix-686 (on /dev/sda5)" {
insmod ext2
set root='(hd0,5)'
search --no-floppy --fs-uuid --set 49e56170-c81d-4813-b292-db9c38283fde
linux /boot/vmlinuz-2.6.33-2.dmz.1-liquorix-686 root=UUID=49e56170-c81d-4813-b292-db9c38283fde ro vga=794 nomodeset quiet
initrd /boot/initrd.img-2.6.33-2.dmz.1-liquorix-686
}
menuentry "Debian GNU/Linux, kernel 2.6.33-2.dmz.1-liquorix-686 (single-user mode) (on /dev/sda5)" {
insmod ext2
set root='(hd0,5)'
search --no-floppy --fs-uuid --set 49e56170-c81d-4813-b292-db9c38283fde
linux /boot/vmlinuz-2.6.33-2.dmz.1-liquorix-686 root=UUID=49e56170-c81d-4813-b292-db9c38283fde ro vga=794 nomodeset single
initrd /boot/initrd.img-2.6.33-2.dmz.1-liquorix-686
}
menuentry "Debian GNU/Linux, kernel 2.6.33-1.dmz.4-liquorix-686 (on /dev/sda5)" {
insmod ext2
set root='(hd0,5)'
search --no-floppy --fs-uuid --set 49e56170-c81d-4813-b292-db9c38283fde
linux /boot/vmlinuz-2.6.33-1.dmz.4-liquorix-686 root=UUID=49e56170-c81d-4813-b292-db9c38283fde ro vga=794 nomodeset quiet
initrd /boot/initrd.img-2.6.33-1.dmz.4-liquorix-686
}
menuentry "Debian GNU/Linux, kernel 2.6.33-1.dmz.4-liquorix-686 (single-user mode) (on /dev/sda5)" {
insmod ext2
set root='(hd0,5)'
search --no-floppy --fs-uuid --set 49e56170-c81d-4813-b292-db9c38283fde
linux /boot/vmlinuz-2.6.33-1.dmz.4-liquorix-686 root=UUID=49e56170-c81d-4813-b292-db9c38283fde ro vga=794 nomodeset single
initrd /boot/initrd.img-2.6.33-1.dmz.4-liquorix-686
}
menuentry "Debian GNU/Linux, kernel 2.6.33-0.dmz.1-liquorix-686 (on /dev/sda5)" {
insmod ext2
set root='(hd0,5)'
search --no-floppy --fs-uuid --set 49e56170-c81d-4813-b292-db9c38283fde
linux /boot/vmlinuz-2.6.33-0.dmz.1-liquorix-686 root=UUID=49e56170-c81d-4813-b292-db9c38283fde ro vga=794 nomodeset quiet
initrd /boot/initrd.img-2.6.33-0.dmz.1-liquorix-686
}
menuentry "Debian GNU/Linux, kernel 2.6.33-0.dmz.1-liquorix-686 (single-user mode) (on /dev/sda5)" {
insmod ext2
set root='(hd0,5)'
search --no-floppy --fs-uuid --set 49e56170-c81d-4813-b292-db9c38283fde
linux /boot/vmlinuz-2.6.33-0.dmz.1-liquorix-686 root=UUID=49e56170-c81d-4813-b292-db9c38283fde ro vga=794 nomodeset single
initrd /boot/initrd.img-2.6.33-0.dmz.1-liquorix-686
}
menuentry "Debian GNU/Linux, kernel 2.6.32-7.slh.1-sidux-686 (on /dev/sdb6)" {
insmod ext2
set root='(hd1,6)'
search --no-floppy --fs-uuid --set 14f5b801-8e81-4173-8cc3-b5c11448bd7d
linux /boot/vmlinuz-2.6.32-7.slh.1-sidux-686 root=UUID=14f5b801-8e81-4173-8cc3-b5c11448bd7d ro quiet vga=794
initrd /boot/initrd.img-2.6.32-7.slh.1-sidux-686
}
menuentry "Debian GNU/Linux, kernel 2.6.32-3.dmz.4-liquorix-686 (on /dev/sdb6)" {
insmod ext2
set root='(hd1,6)'
search --no-floppy --fs-uuid --set 14f5b801-8e81-4173-8cc3-b5c11448bd7d
linux /boot/vmlinuz-2.6.32-3.dmz.4-liquorix-686 root=UUID=14f5b801-8e81-4173-8cc3-b5c11448bd7d ro quiet vga=794
initrd /boot/initrd.img-2.6.32-3.dmz.4-liquorix-686
}
menuentry "Debian GNU/Linux, kernel memtest86+ (on /dev/sdb6)" {
insmod ext2
set root='(hd1,6)'
search --no-floppy --fs-uuid --set 14f5b801-8e81-4173-8cc3-b5c11448bd7d
linux /boot/memtest86+.bin
}
### 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 ###
[/quote]
Back to top
aus9
Status: Assistant
Joined: 21 Sep 2008
Posts: 358
Location: Australia
Reply Quote
hi

you don't want os-prober?
then disable it with root powers

1) Boot into sidux64 if that is the true grub in charge...then open a terminal and

:: Code ::

sux
chmod 000 /etc/grub.d/30_os-prober


2) Chainloader try and test the following

while root terminal is open

issue text command like
kwrite
mousepad
leafpad

So that you can APPEND = add to ( with root powers) /etc/grub.d/40_custom

put in a code box for space reason
:: Code ::

menuentry "Windows 7 /dev/sda1" {
insmod ntfs
set root=(hd0,1)
chainloader +1
}

menuentry "Debian GNU/Linux, kernel 2.6.33-2.dmz.1-liquorix-686 (on /dev/sda5)" {
insmod ext2
set root='(hd0,5)'
search --no-floppy --fs-uuid --set 49e56170-c81d-4813-b292-db9c38283fde
linux /boot/vmlinuz-2.6.33-2.dmz.1-liquorix-686 root=UUID=49e56170-c81d-4813-b292-db9c38283fde ro vga=794 nomodeset quiet
initrd /boot/initrd.img-2.6.33-2.dmz.1-liquorix-686
}

menuentry "Debian GNU/Linux, kernel 2.6.33-2.dmz.1-liquorix-686 (single-user mode) (on /dev/sda5)" {
insmod ext2
set root='(hd0,5)'
search --no-floppy --fs-uuid --set 49e56170-c81d-4813-b292-db9c38283fde
linux /boot/vmlinuz-2.6.33-2.dmz.1-liquorix-686 root=UUID=49e56170-c81d-4813-b292-db9c38283fde ro vga=794 nomodeset single
initrd /boot/initrd.img-2.6.33-2.dmz.1-liquorix-686
}

menuentry "Debian GNU/Linux, kernel 2.6.33-1.dmz.4-liquorix-686 (on /dev/sda5)" {
insmod ext2
set root='(hd0,5)'
search --no-floppy --fs-uuid --set 49e56170-c81d-4813-b292-db9c38283fde
linux /boot/vmlinuz-2.6.33-1.dmz.4-liquorix-686 root=UUID=49e56170-c81d-4813-b292-db9c38283fde ro vga=794 nomodeset quiet
initrd /boot/initrd.img-2.6.33-1.dmz.4-liquorix-686
}

menuentry "Debian GNU/Linux, kernel 2.6.33-1.dmz.4-liquorix-686 (single-user mode) (on /dev/sda5)" {
insmod ext2
set root='(hd0,5)'
search --no-floppy --fs-uuid --set 49e56170-c81d-4813-b292-db9c38283fde
linux /boot/vmlinuz-2.6.33-1.dmz.4-liquorix-686 root=UUID=49e56170-c81d-4813-b292-db9c38283fde ro vga=794 nomodeset single
initrd /boot/initrd.img-2.6.33-1.dmz.4-liquorix-686
}

menuentry "Debian GNU/Linux, kernel 2.6.33-0.dmz.1-liquorix-686 (on /dev/sda5)" {
insmod ext2
set root='(hd0,5)'
search --no-floppy --fs-uuid --set 49e56170-c81d-4813-b292-db9c38283fde
linux /boot/vmlinuz-2.6.33-0.dmz.1-liquorix-686 root=UUID=49e56170-c81d-4813-b292-db9c38283fde ro vga=794 nomodeset quiet
initrd /boot/initrd.img-2.6.33-0.dmz.1-liquorix-686
}

menuentry "Debian GNU/Linux, kernel 2.6.33-0.dmz.1-liquorix-686 (single-user mode) (on /dev/sda5)" {
insmod ext2
set root='(hd0,5)'
search --no-floppy --fs-uuid --set 49e56170-c81d-4813-b292-db9c38283fde
linux /boot/vmlinuz-2.6.33-0.dmz.1-liquorix-686 root=UUID=49e56170-c81d-4813-b292-db9c38283fde ro vga=794 nomodeset single
initrd /boot/initrd.img-2.6.33-0.dmz.1-liquorix-686
}

menuentry "Debian GNU/Linux, kernel 2.6.32-7.slh.1-sidux-686 (on /dev/sdb6)" {
insmod ext2
set root='(hd1,6)'
search --no-floppy --fs-uuid --set 14f5b801-8e81-4173-8cc3-b5c11448bd7d
linux /boot/vmlinuz-2.6.32-7.slh.1-sidux-686 root=UUID=14f5b801-8e81-4173-8cc3-b5c11448bd7d ro quiet vga=794
initrd /boot/initrd.img-2.6.32-7.slh.1-sidux-686
}

menuentry "Debian GNU/Linux, kernel 2.6.32-3.dmz.4-liquorix-686 (on /dev/sdb6)" {
insmod ext2
set root='(hd1,6)'
search --no-floppy --fs-uuid --set 14f5b801-8e81-4173-8cc3-b5c11448bd7d
linux /boot/vmlinuz-2.6.32-3.dmz.4-liquorix-686 root=UUID=14f5b801-8e81-4173-8cc3-b5c11448bd7d ro quiet vga=794
initrd /boot/initrd.img-2.6.32-3.dmz.4-liquorix-686
}

3) then close down the text editor and run

:: Code ::

update-grub


copy and paste all output into a text file and post it inside a code box if you ...your /boot/grub/grub.cfg looks wrong AND you can not boot into each entry

good luck

< Edited by aus9 :: Apr 4, 10, 15:41 >

Back to top
aus9
Status: Assistant
Joined: 21 Sep 2008
Posts: 358
Location: Australia
Reply Quote
wilberfan

This is suggestion only ok? if you do not want to use os-prober...that above custom script is just a waste.

so this is more advanced...but may save you a bit in the long run as you appear to have multiple tests.

PART 1.......study all of my suggestion before agreeing to trying

a) you really need my rescue cd...based on TC...its designed for users just like you

www.sendspace.com/file/08262g


b) if you refuse to download it here is the help file in doc format but its a webpage on my cd
stashbox.org/846265/helpv5.doc

ACTION******boot into each system and redo their bootloader (except ms) so their grub2 bootloader is in the /boot partition....sometimes called the root partition.

eg

:: Code ::

grub-install --force /dev/sda5


boot into sdb6 and do similar command but use sdb6

c) you need to know how to check its truly installed as per help file

d) then instead of that complicated 40_custom junk above.
you use a chainloader for each partition

AND the chainloaded menu eg on sda5 gives you its options

WHY ....to save you editting the 40_custom each time to make a kernel change in those parttitions
---------------------------------------------------------
PART 2 sidux64 becomes--in a code box for space reasons-------
:: Code ::

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

menuentry "Debian liquorix-686 sda5" {
insmod ext2
set root=(hd0,5)
chainloader +1
}

menuentry "Debian slh 686 sdb6" {
insmod ext2
set root=(hd1,6)
chainloader +1
}

Back to top
techAdmin
Status: Site Admin
Joined: 26 Sep 2003
Posts: 4127
Location: East Coast, West Coast? I know it's one of them.
Reply Quote
But where do you put the chainloader stuff in the main grub system? Assuming it's grub 2, that is, ie, which file do you use? The way Debian has all those files thrown together confuses me at least, and I have no idea where to put each part.

The chainloader code itself you gave samples of is a good example though, but where do you put it so it ends up in the dynamically generated /boot/grub/grub.cfg ? file?

I'll have to give your iso a spin sooner than later though.
Back to top
aus9
Status: Assistant
Joined: 21 Sep 2008
Posts: 358
Location: Australia
Reply Quote
hi

you edit the 40_custom script then run update-grub
Back to top
Display posts from previous:   

All times are GMT - 8 Hours