LinuxQuestions.org
Support LQ: Use code LQ3 and save $3 on Domain Registration
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices

Reply
 
Search this Thread
Old 01-22-2011, 10:29 AM   #1
sheine
Member
 
Registered: Nov 2005
Distribution: pclinuxos
Posts: 184

Rep: Reputation: 31
grub.cfg file in grub2


This is not a question but is being posted to help others make working entries in grub.cfg. This is taken from Ubuntu 10.10 and despite the do not edit warning, I edited it with sudo gedit /boot/grub/cfg. My computer boots into every OS in the list.


# 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 ###
if [ -s $prefix/grubenv ]; then
set have_grubenv=true
load_env
fi
set default="10"
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 recordfail {
set recordfail=1
if [ -n "${have_grubenv}" ]; then if [ -z "${boot_once}" ]; then save_env recordfail; fi; fi
}

function load_video {
insmod vbe
insmod vga
}

insmod part_msdos
insmod ext2
set root='(hd0,msdos6)'
search --no-floppy --fs-uuid --set 9424b2b0-8e1d-4fc6-9627-f57683611b78
if loadfont /usr/share/grub/unicode.pf2 ; then
set gfxmode=640x480
load_video
insmod gfxterm
fi
terminal_output gfxterm
insmod part_msdos
insmod ext2
set root='(hd0,msdos6)'
search --no-floppy --fs-uuid --set 9424b2b0-8e1d-4fc6-9627-f57683611b78
set locale_dir=($root)/boot/grub/locale
set lang=en
insmod gettext
if [ "${recordfail}" = 1 ]; then
set timeout=-1
else
set timeout=10
fi
### END /etc/grub.d/00_header ###

### BEGIN /etc/grub.d/05_debian_theme ###
set menu_color_normal=white/black
set menu_color_highlight=black/light-gray
### END /etc/grub.d/05_debian_theme ###

### BEGIN /etc/grub.d/10_linux ###
menuentry 'Ubuntu, with Linux 2.6.35-22-generic' --class ubuntu --class gnu-linux --class gnu --class os {
recordfail
insmod part_msdos
insmod ext2
set root='(hd0,msdos6)'
search --no-floppy --fs-uuid --set 9424b2b0-8e1d-4fc6-9627-f57683611b78
linux /boot/vmlinuz-2.6.35-22-generic root=UUID=9424b2b0-8e1d-4fc6-9627-f57683611b78 ro quiet splash
initrd /boot/initrd.img-2.6.35-22-generic
}
menuentry 'Ubuntu, with Linux 2.6.35-22-generic (recovery mode)' --class ubuntu --class gnu-linux --class gnu --class os {
recordfail
insmod part_msdos
insmod ext2
set root='(hd0,msdos6)'
search --no-floppy --fs-uuid --set 9424b2b0-8e1d-4fc6-9627-f57683611b78
echo 'Loading Linux 2.6.35-22-generic ...'
linux /boot/vmlinuz-2.6.35-22-generic root=UUID=9424b2b0-8e1d-4fc6-9627-f57683611b78 ro single
echo 'Loading initial ramdisk ...'
initrd /boot/initrd.img-2.6.35-22-generic
}
menuentry 'Ubuntu, with Linux 2.6.32-24-generic' --class ubuntu --class gnu-linux --class gnu --class os {
recordfail
insmod part_msdos
insmod ext2
set root='(hd0,msdos6)'
search --no-floppy --fs-uuid --set 9424b2b0-8e1d-4fc6-9627-f57683611b78
linux /boot/vmlinuz-2.6.32-24-generic root=UUID=9424b2b0-8e1d-4fc6-9627-f57683611b78 ro quiet splash
initrd /boot/initrd.img-2.6.32-24-generic
}
menuentry 'Ubuntu, with Linux 2.6.32-24-generic (recovery mode)' --class ubuntu --class gnu-linux --class gnu --class os {
recordfail
insmod part_msdos
insmod ext2
set root='(hd0,msdos6)'
search --no-floppy --fs-uuid --set 9424b2b0-8e1d-4fc6-9627-f57683611b78
echo 'Loading Linux 2.6.32-24-generic ...'
linux /boot/vmlinuz-2.6.32-24-generic root=UUID=9424b2b0-8e1d-4fc6-9627-f57683611b78 ro single
echo 'Loading initial ramdisk ...'
initrd /boot/initrd.img-2.6.32-24-generic
}
### 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+)" {
insmod part_msdos
insmod ext2
set root='(hd0,msdos6)'
search --no-floppy --fs-uuid --set 9424b2b0-8e1d-4fc6-9627-f57683611b78
linux16 /boot/memtest86+.bin
}
menuentry "Memory test (memtest86+, serial console 115200)" {
insmod part_msdos
insmod ext2
set root='(hd0,msdos6)'
search --no-floppy --fs-uuid --set 9424b2b0-8e1d-4fc6-9627-f57683611b78
linux16 /boot/memtest86+.bin console=ttyS0,115200n8
}
### END /etc/grub.d/20_memtest86+ ###

### BEGIN /etc/grub.d/30_os-prober ###
menuentry "Windows Vista (loader) (on /dev/sde1)" {
insmod part_msdos
insmod ntfs
set root='(hd0,msdos1)'
search --no-floppy --fs-uuid --set 6a1826b818268365
chainloader +1
}
menuentry "Windows Vista (loader) (on /dev/sde2)" {
insmod part_msdos
insmod ntfs
set root='(hd0,msdos2)'
search --no-floppy --fs-uuid --set b0f2294bf22916de
chainloader +1
}
menuentry "LinuxMint GNU/Linux, with Linux 2.6.32-5-amd64 (on /dev/sde5)" {
insmod part_msdos
insmod ext2
set root='(hd0,msdos5)'
search --no-floppy --fs-uuid --set a0016b35-11c0-43e9-85ac-293d77401ceb
linux /boot/vmlinuz-2.6.32-5-amd64 root=UUID=a0016b35-11c0-43e9-85ac-293d77401ceb ro quiet
initrd /boot/initrd.img-2.6.32-5-amd64
}
menuentry "LinuxMint GNU/Linux, with Linux 2.6.32-5-amd64 (recovery mode) (on /dev/sde5)" {
insmod part_msdos
insmod ext2
set root='(hd0,msdos5)'
search --no-floppy --fs-uuid --set a0016b35-11c0-43e9-85ac-293d77401ceb
linux /boot/vmlinuz-2.6.32-5-amd64 root=UUID=a0016b35-11c0-43e9-85ac-293d77401ceb ro single
initrd /boot/initrd.img-2.6.32-5-amd64
}

menuentry "MEPIS at sda7, newest kernel (on /dev/sde7)" {
insmod part_msdos
insmod ext2
set root='(hd0,msdos7)'
search --no-floppy --fs-uuid --set 9817bd73-2aef-444c-932d-ea2ec6571bf7
linux /boot/vmlinuz root=/dev/sda7 nomce quiet splash vga=788
initrd /boot/initrd.img
}
menuentry "MEMTEST (on /dev/sde7)" {
insmod part_msdos
insmod ext2
set root='(hd0,msdos7)'
search --no-floppy --fs-uuid --set 9817bd73-2aef-444c-932d-ea2ec6571bf7
linux /boot/memtest86+.bin
}
menuentry "pclinux (on /dev/sde8)" {
insmod part_msdos
insmod ext2
set root='(hd0,msdos8)'
search --no-floppy --fs-uuid --set ce16f506-f7c1-4c16-a666-e0dc3d703cfe
linux /boot/vmlinuz BOOT_IMAGE=linux root=UUID=ce16f506-f7c1-4c16-a666-e0dc3d703cfe splash=silent vga=788
initrd (hd0,8)/boot/initrd.img
}
menuentry "linux-nonfb (on /dev/sde8)" {
insmod part_msdos
insmod ext2
set root='(hd0,msdos8)'
search --no-floppy --fs-uuid --set ce16f506-f7c1-4c16-a666-e0dc3d703cfe
linux /boot/vmlinuz BOOT_IMAGE=linux-nonfb root=UUID=ce16f506-f7c1-4c16-a666-e0dc3d703cfe
initrd (hd0,6)/boot/initrd.img

}
menuentry "FreeBSD 8.0" {
set root='(hd0,msdos3)'
chainloader +1
}
menuentry "Puppy on sda 10" {
set root='(hd0,msdos10)'
linux /boot/vmlinuz root=/dev/sda10 nomce quiet splash vga initrd /boot/initrd.img
}

### END /etc/grub.d/30_os-prober ###
 
Old 01-22-2011, 11:44 AM   #2
Larry Webb
LQ Veteran
 
Registered: Jul 2006
Location: Crystal Beach, Texas
Distribution: Suse for mail +
Posts: 5,100
Blog Entries: 7

Rep: Reputation: 229Reputation: 229Reputation: 229
I may be wrong but the reason to do edits in the /etc/grub.d/ directory instead of the grub.cfg is that if you do an update-grub all your changes will be lost where if they are in the /etc/grub.d/ they will stay.
 
Old 01-22-2011, 12:06 PM   #3
ronlau9
Senior Member
 
Registered: Dec 2007
Location: In front of my LINUX OR MAC BOX
Distribution: Mandriva 2009 X86_64 suse 11.3 X86_64 Centos X86_64 Debian X86_64 Linux MInt 86_64 OS X
Posts: 2,369

Rep: Reputation: Disabled
Quote:
Originally Posted by Larry Webb View Post
I may be wrong but the reason to do edits in the /etc/grub.d/ directory instead of the grub.cfg is that if you do an update-grub all your changes will be lost where if they are in the /etc/grub.d/ they will stay.
No that is correct if ones edit the grub.cfg the changes is gone when ones do update-grub.
In other words it works until you do a update-grub or the system do a update-grub

Last edited by ronlau9; 01-22-2011 at 12:08 PM.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
GRUB2 doesn't recognize grub.cfg file dragos240 Linux From Scratch 3 07-27-2010 10:16 AM
[SOLVED] How does Grub2 find the grub.cfg file? LenW Linux - Software 8 03-15-2010 03:28 AM
grub2 detects Mac OSX on sdb, but doesn't install it to grub.cfg? JohnLocke Linux - Newbie 16 02-17-2010 05:10 PM
Grub2 questions: need to know grub.cfg syntax for bootable grub_eltorito iso's?? linus72 Linux - General 11 02-11-2010 06:20 PM
Creating a Grub2 boot-cd with a (grub.cfg) menu ..my solution ssenuta Linux - General 3 02-04-2010 06:16 PM


All times are GMT -5. The time now is 12:50 AM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration