PDA

View Full Version : [SOLVED] make Grub easier to read



tropdoug
May 15th, 2010, 06:50 AM
Is it possible to have the grub menu display something like

New-Linux
Old-Linux
WinXp

rather than the jabber jabber of Linux images and versions. The reason I ask is that I am not willing to dump Karmic until I have run Lucid for a little while but my wife finds the grub menu confusing, and as with all things marital, make it simple keep the peace -- so I would like to be able to have the above with the actual commands hidden behind.

Can it be done?

dE_logics
May 15th, 2010, 07:31 AM
Open /boot/grub/grub.cfg as root, there should be a title line, (or something like that), after which the quotes represent the title that you menu displays.

oldfred
May 16th, 2010, 12:11 AM
You can create you own menu

Custom menu:
http://sourceforge.net/apps/mediawiki/bootinfoscript/index.php?title=Boot_Problems:Custom_Menu
OR:
I used drs305's command to limit ubuntu entries to two, turned off os_prober so it does not look for other systems and totally customized my 40_custom.
includes line to limit display to two
Grub 2 Title Tweaks Thread -drs305
http://ubuntuforums.org/showpost.php?p=8082954&postcount=1
In /etc/default/grub I added this:
GRUB_DISABLE_OS_PROBER=true

If you put your menu entry in /etc/grub.d/40_custom it will not be over written and will be at the end of your menu. Or you can copy it to 09_custom and make it executable and it will be at the top of your menu.

drs305
May 16th, 2010, 12:27 AM
I absolutely agree with oldfred that a custom menu is the way to most easily accomplish what you want.

The Title Tweaks thread has sections that can teach you how to modify the scripts so the title name(s) are changed automatically but I can almost guarantee it will make your head hurt. The advantages of having a custom menu is the by far the easiest solution unless you really want to get into the nuts and bolts of the Grub2 scripts. ;-)

That being said, if you have any questions just ask.

dE_logics
May 16th, 2010, 05:36 AM
That line starts with the name "menuentry"...seach for that change what's in the quotes.

jocko
May 16th, 2010, 07:25 AM
Open /boot/grub/grub.cfg as root, there should be a title line, (or something like that), after which the quotes represent the title that you menu displays.


That line starts with the name "menuentry"...seach for that change what's in the quotes.

What part of this text is difficult to read?

#
# 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
#
You are NOT supposed to edit grub.cfg directly. In fact it is write protected so not even root can edit it, unless the permissions are changed first. And if you do make any change in grub.cfg it is lost the next time update-grub runs. The correct way to make changes in the boot menu is to edit the file /etc/default/grub and the scripts in /etc/grub.d and then generate a new grub.cfg by running the command "sudo update-grub".

dE_logics
May 16th, 2010, 02:03 PM
What part of this text is difficult to read?

You are NOT supposed to edit grub.cfg directly. In fact it is write protected so not even root can edit it, unless the permissions are changed first. And if you do make any change in grub.cfg it is lost the next time update-grub runs. The correct way to make changes in the boot menu is to edit the file /etc/default/grub and the scripts in /etc/grub.d and then generate a new grub.cfg by running the command "sudo update-grub".

Ok, Ok, I know that, but I though this was easier.

Anyway, the original author appears to have disappeared.

tropdoug
May 17th, 2010, 10:45 AM
I haveńt disappeared, just been following the links and editing various files. I have followed the various suggestions here. and dE_logics your idea of altering the entries within the speech marks works fine, but doesn't answer the whole question.

Then I went down the route of http://sourceforge.net/apps/mediawiki/bootinfoscript/index.php?title=Boot_Problems:Custom_Menu. (http://sourceforge.net/apps/mediawiki/bootinfoscript/index.php?title=Boot_Problems:Custom_Menu)

The custom menu works fine, except the very last step which is supposed to hide the main menu and default to the custom menu but at that point the system just jumps straight to the first entry item, without even showing any menu.

So I am about to make a custom menu for my other computer and see if the same happens, if so, then I will try to find out what is going wrong.

I think one of the great things about Linux is that you CAN do whatever you want, as long as you have the patience to do it slowly and carefully and that is such a refreshing thing after winblows

drs305
May 17th, 2010, 12:02 PM
The custom menu works fine, except the very last step which is supposed to hide the main menu and default to the custom menu but at that point the system just jumps straight to the first entry item, without even showing any menu.

So I am about to make a custom menu for my other computer and see if the same happens, if so, then I will try to find out what is going wrong.

When you say it jumps straight to the first entry, are you seeing the menu at all?

If you post your boot info information we can probably tweak the settings to finalize things and get them to work the way you want.

http://bootinfoscript.sourceforge.net/

tropdoug
May 18th, 2010, 09:20 AM
Wow - there is a lot of information here. Thanks for the link to that script. OK to answer your question, yes the grub menu simply does not appear, i go from ¨boot from CD" to the lucid log in screen.

Looking at all the below I am a little confused. This is the set up that I want

I updated my 9.10 OS on sda1 to 10.04 32 bit My / directory was on the first partition sda1. (I am not sure it still is)

My home directory is on sdb5 for the 32 bit installation,

I then put Lucid 10.04 64 Bit onto sda6 / and /home on sda7

I also have a music partition on sdb1 and a Photo partiton on sdb2

I wanted to try the 64bit sys for a while before committing to it totally.

As I am always looking to increase the usability of the system, I wanted to make the custom menu a way to help the wife and also so itś different. So any help or suggestion greatly appreciated.

The windows entry below is odd, because I didn't think I still had it on. In fact I am sure I don´t but I did have a virtual box set up on sda1 prior to the upgrade, but I haven set it back up yet.


Boot Info Script 0.55 dated February 15th, 2010

============================= Boot Info Summary: ==============================

=> Grub 2 is installed in the MBR of /dev/sda and looks on the same drive in
partition #6 for /boot/grub.
=> Windows is installed in the MBR of /dev/sdb

sda1: __________________________________________________ _______________________

File system: ext3
Boot sector type: Grub 2
Boot sector info: Grub 2 is installed in the boot sector of sda1 and
looks at sector 11288759 of the same hard drive for
core.img, but core.img can not be found at this
location.
Operating System: Ubuntu 10.04 LTS
Boot files/dirs: /boot/grub/grub.cfg /etc/fstab /boot/grub/core.img

sda2: __________________________________________________ _______________________

File system: Extended Partition
Boot sector type: -
Boot sector info:

sda5: __________________________________________________ _______________________

File system:
Boot sector type: -
Boot sector info:
Mounting failed:
mount: unknown filesystem type ''

sda6: __________________________________________________ _______________________

File system: ext4
Boot sector type: -
Boot sector info:
Operating System: Ubuntu 10.04 LTS
Boot files/dirs: /boot/grub/grub.cfg /etc/fstab /boot/grub/core.img

sda7: __________________________________________________ _______________________

File system: ext4
Boot sector type: -
Boot sector info:
Operating System:
Boot files/dirs:

sdb1: __________________________________________________ _______________________

File system: ext3
Boot sector type: -
Boot sector info:
Operating System:
Boot files/dirs:

sdb2: __________________________________________________ _______________________

File system: ext3
Boot sector type: -
Boot sector info:
Operating System:
Boot files/dirs:

sdb3: __________________________________________________ _______________________

File system: Extended Partition
Boot sector type: -
Boot sector info:

sdb5: __________________________________________________ _______________________

File system: ext4
Boot sector type: -
Boot sector info:
Operating System:
Boot files/dirs:

=========================== Drive/Partition Info: =============================

Drive: sda ___________________ __________________________________________________ ___

Disk /dev/sda: 80.0 GB, 80026361856 bytes
255 heads, 63 sectors/track, 9729 cylinders, total 156301488 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes

Partition Boot Start End Size Id System

/dev/sda1 * 63 19,535,039 19,534,977 83 Linux
/dev/sda2 19,535,101 156,296,384 136,761,284 5 Extended
/dev/sda5 19,535,103 21,494,969 1,959,867 82 Linux swap / Solaris
/dev/sda6 21,495,033 46,074,419 24,579,387 83 Linux
/dev/sda7 46,074,483 156,296,384 110,221,902 83 Linux


Drive: sdb ___________________ __________________________________________________ ___

Disk /dev/sdb: 500.1 GB, 500107862016 bytes
255 heads, 63 sectors/track, 60801 cylinders, total 976773168 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes

Partition Boot Start End Size Id System

/dev/sdb1 63 207,077,849 207,077,787 83 Linux
/dev/sdb2 207,077,850 416,581,514 209,503,665 83 Linux
/dev/sdb3 416,581,515 976,768,064 560,186,550 5 Extended
/dev/sdb5 416,581,578 976,768,064 560,186,487 83 Linux


blkid -c /dev/null: __________________________________________________ __________

Device UUID TYPE LABEL

/dev/mapper/cryptswap1 db78e832-1761-45a7-8a7a-2b1dd553370f swap
/dev/sda1 d3a683c3-ba61-4502-8d82-f6cd4177ee6d ext3
/dev/sda2: PTTYPE="dos"
/dev/sda6 8d48c292-706d-44d5-866f-347679d9d8c8 ext4 64BitSys
/dev/sda7 b5e410d4-5201-4afe-8c53-3761f6850a42 ext4 64Home
/dev/sda: PTTYPE="dos"
/dev/sdb1 6875d601-79d5-4418-9876-2e8a12e6e31f ext3 Music
/dev/sdb2 4778f442-6b61-42f2-b30e-07e1abe837c4 ext3 PhotoPart
/dev/sdb3: PTTYPE="dos"
/dev/sdb5 71e7ebbe-634a-4d3c-aa2d-27ef0c76d6b4 ext4 Home
/dev/sdb: PTTYPE="dos"

=============================== "ls -R /dev/mapper/" output: ===============================
/dev/mapper:
control
cryptswap1
cryptswap1_unformatted

============================ "mount | grep ^/dev output: ===========================

Device Mount_Point Type Options

/dev/sda6 / ext4 (rw,errors=remount-ro)
/dev/sda7 /home ext4 (rw)
/dev/sdb1 /mnt/musicpart ext3 (rw)


=========================== sda1/boot/grub/grub.cfg: ===========================

#
# 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="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 recordfail {
set recordfail=1
if [ -n ${have_grubenv} ]; then if [ -z ${boot_once} ]; then save_env recordfail; fi; fi
}
insmod ext2
set root='(hd0,1)'
search --no-floppy --fs-uuid --set d3a683c3-ba61-4502-8d82-f6cd4177ee6d
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='(hd0,1)'
search --no-floppy --fs-uuid --set d3a683c3-ba61-4502-8d82-f6cd4177ee6d
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.32-21-generic' --class ubuntu --class gnu-linux --class gnu --class os {
recordfail
insmod ext2
set root='(hd0,1)'
search --no-floppy --fs-uuid --set d3a683c3-ba61-4502-8d82-f6cd4177ee6d
linux /boot/vmlinuz-2.6.32-21-generic root=UUID=d3a683c3-ba61-4502-8d82-f6cd4177ee6d ro quiet splash
initrd /boot/initrd.img-2.6.32-21-generic
}
menuentry 'Ubuntu, with Linux 2.6.32-21-generic (recovery mode)' --class ubuntu --class gnu-linux --class gnu --class os {
recordfail
insmod ext2
set root='(hd0,1)'
search --no-floppy --fs-uuid --set d3a683c3-ba61-4502-8d82-f6cd4177ee6d
echo 'Loading Linux 2.6.32-21-generic ...'
linux /boot/vmlinuz-2.6.32-21-generic root=UUID=d3a683c3-ba61-4502-8d82-f6cd4177ee6d ro single
echo 'Loading initial ramdisk ...'
initrd /boot/initrd.img-2.6.32-21-generic
}
### END /etc/grub.d/10_linux ###

### BEGIN /etc/grub.d/20_memtest86+ ###
menuentry "Memory test (memtest86+)" {
insmod ext2
set root='(hd0,1)'
search --no-floppy --fs-uuid --set d3a683c3-ba61-4502-8d82-f6cd4177ee6d
linux16 /boot/memtest86+.bin
}
menuentry "Memory test (memtest86+, serial console 115200)" {
insmod ext2
set root='(hd0,1)'
search --no-floppy --fs-uuid --set d3a683c3-ba61-4502-8d82-f6cd4177ee6d
linux16 /boot/memtest86+.bin console=ttyS0,115200n8
}
### END /etc/grub.d/20_memtest86+ ###

### BEGIN /etc/grub.d/30_os-prober ###
menuentry "Ubuntu, with Linux 2.6.32-22-generic (on /dev/sda6)" {
insmod ext2
set root='(hd0,6)'
search --no-floppy --fs-uuid --set 8d48c292-706d-44d5-866f-347679d9d8c8
linux /boot/vmlinuz-2.6.32-22-generic root=UUID=8d48c292-706d-44d5-866f-347679d9d8c8 ro quiet splash
initrd /boot/initrd.img-2.6.32-22-generic
}
menuentry "Ubuntu, with Linux 2.6.32-22-generic (recovery mode) (on /dev/sda6)" {
insmod ext2
set root='(hd0,6)'
search --no-floppy --fs-uuid --set 8d48c292-706d-44d5-866f-347679d9d8c8
linux /boot/vmlinuz-2.6.32-22-generic root=UUID=8d48c292-706d-44d5-866f-347679d9d8c8 ro single
initrd /boot/initrd.img-2.6.32-22-generic
}
menuentry "Ubuntu, with Linux 2.6.32-21-generic (on /dev/sda6)" {
insmod ext2
set root='(hd0,6)'
search --no-floppy --fs-uuid --set 8d48c292-706d-44d5-866f-347679d9d8c8
linux /boot/vmlinuz-2.6.32-21-generic root=UUID=8d48c292-706d-44d5-866f-347679d9d8c8 ro quiet splash
initrd /boot/initrd.img-2.6.32-21-generic
}
menuentry "Ubuntu, with Linux 2.6.32-21-generic (recovery mode) (on /dev/sda6)" {
insmod ext2
set root='(hd0,6)'
search --no-floppy --fs-uuid --set 8d48c292-706d-44d5-866f-347679d9d8c8
linux /boot/vmlinuz-2.6.32-21-generic root=UUID=8d48c292-706d-44d5-866f-347679d9d8c8 ro single
initrd /boot/initrd.img-2.6.32-21-generic
}
### 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 ###

=============================== sda1/etc/fstab: ===============================

# /etc/fstab: static file system information.
#
# Use 'blkid -o value -s UUID' to print the universally unique identifier
# for a device; this may be used with UUID= as a more robust way to name
# devices that works even if disks are added and removed. See fstab(5).
#
# <file system> <mount point> <type> <options> <dump> <pass>
proc /proc proc defaults 0 0
# / was on /dev/sda1 during installation
UUID=d3a683c3-ba61-4502-8d82-f6cd4177ee6d / ext3 errors=remount-ro 0 1
# /home was on /dev/sda6 during installation
#UUID=48ff847c-b3a5-4f8c-a2af-30ce17c500d1 /home ext3 defaults 0 2

# /home moved to new partition on /dev/sdb5
UUID=71e7ebbe-634a-4d3c-aa2d-27ef0c76d6b4 /home ext4 defaults 0 2

# swap was on /dev/sda5 during installation
UUID=5623aa05-2a6d-467a-a89c-1871ab5cbe99 none swap sw 0 0
/dev/scd0 /media/cdrom0 udf,iso9660 user,noauto,exec,utf8 0 0
/dev/fd0 /media/floppy0 auto rw,user,noauto,exec,utf8 0 0
# mounts the music drive
UUID=6875d601-79d5-4418-9876-2e8a12e6e31f /mnt/musicpart ext3 defaults 0 2
# Allows mounting of usb devices in Vbox
none /proc/bus/usb usbfs devgid=122,devmode=664 0 0

# mounts the photo partition (sdb2)
UUID=4778f442-6b61-42f2-b30e-07e1abe837c4 /mnt/PhotoPart ext3 defaults 0 2

=================== sda1: Location of files loaded by Grub: ===================


5.8GB: boot/grub/core.img
5.7GB: boot/grub/grub.cfg
5.7GB: boot/initrd.img-2.6.32-21-generic
5.7GB: boot/vmlinuz-2.6.32-21-generic
5.7GB: initrd.img
5.7GB: vmlinuz

=========================== sda6/boot/grub/grub.cfg: ===========================

#
# 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="Custom_Menu"
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
}
insmod ext2
set root='(hd0,6)'
search --no-floppy --fs-uuid --set 8d48c292-706d-44d5-866f-347679d9d8c8
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='(hd0,6)'
search --no-floppy --fs-uuid --set 8d48c292-706d-44d5-866f-347679d9d8c8
set locale_dir=($root)/boot/grub/locale
set lang=en
insmod gettext
if [ ${recordfail} = 1 ]; then
set timeout=-1
else
set timeout=0
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.32-22-generic' --class ubuntu --class gnu-linux --class gnu --class os {
recordfail
insmod ext2
set root='(hd0,6)'
search --no-floppy --fs-uuid --set 8d48c292-706d-44d5-866f-347679d9d8c8
linux /boot/vmlinuz-2.6.32-22-generic root=UUID=8d48c292-706d-44d5-866f-347679d9d8c8 ro quiet splash
initrd /boot/initrd.img-2.6.32-22-generic
}
menuentry 'Ubuntu, with Linux 2.6.32-22-generic (recovery mode)' --class ubuntu --class gnu-linux --class gnu --class os {
recordfail
insmod ext2
set root='(hd0,6)'
search --no-floppy --fs-uuid --set 8d48c292-706d-44d5-866f-347679d9d8c8
echo 'Loading Linux 2.6.32-22-generic ...'
linux /boot/vmlinuz-2.6.32-22-generic root=UUID=8d48c292-706d-44d5-866f-347679d9d8c8 ro single
echo 'Loading initial ramdisk ...'
initrd /boot/initrd.img-2.6.32-22-generic
}
menuentry 'Ubuntu, with Linux 2.6.32-21-generic' --class ubuntu --class gnu-linux --class gnu --class os {
recordfail
insmod ext2
set root='(hd0,6)'
search --no-floppy --fs-uuid --set 8d48c292-706d-44d5-866f-347679d9d8c8
linux /boot/vmlinuz-2.6.32-21-generic root=UUID=8d48c292-706d-44d5-866f-347679d9d8c8 ro quiet splash
initrd /boot/initrd.img-2.6.32-21-generic
}
menuentry 'Ubuntu, with Linux 2.6.32-21-generic (recovery mode)' --class ubuntu --class gnu-linux --class gnu --class os {
recordfail
insmod ext2
set root='(hd0,6)'
search --no-floppy --fs-uuid --set 8d48c292-706d-44d5-866f-347679d9d8c8
echo 'Loading Linux 2.6.32-21-generic ...'
linux /boot/vmlinuz-2.6.32-21-generic root=UUID=8d48c292-706d-44d5-866f-347679d9d8c8 ro single
echo 'Loading initial ramdisk ...'
initrd /boot/initrd.img-2.6.32-21-generic
}
### END /etc/grub.d/10_linux ###

### BEGIN /etc/grub.d/20_memtest86+ ###
menuentry "Memory test (memtest86+)" {
insmod ext2
set root='(hd0,6)'
search --no-floppy --fs-uuid --set 8d48c292-706d-44d5-866f-347679d9d8c8
linux16 /boot/memtest86+.bin
}
menuentry "Memory test (memtest86+, serial console 115200)" {
insmod ext2
set root='(hd0,6)'
search --no-floppy --fs-uuid --set 8d48c292-706d-44d5-866f-347679d9d8c8
linux16 /boot/memtest86+.bin console=ttyS0,115200n8
}
### END /etc/grub.d/20_memtest86+ ###

### BEGIN /etc/grub.d/30_os-prober ###
menuentry "Ubuntu, with Linux 2.6.32-21-generic (on /dev/sda1)" {
insmod ext2
set root='(hd0,1)'
search --no-floppy --fs-uuid --set d3a683c3-ba61-4502-8d82-f6cd4177ee6d
linux /boot/vmlinuz-2.6.32-21-generic root=UUID=d3a683c3-ba61-4502-8d82-f6cd4177ee6d ro quiet splash
initrd /boot/initrd.img-2.6.32-21-generic
}
menuentry "Ubuntu, with Linux 2.6.32-21-generic (recovery mode) (on /dev/sda1)" {
insmod ext2
set root='(hd0,1)'
search --no-floppy --fs-uuid --set d3a683c3-ba61-4502-8d82-f6cd4177ee6d
linux /boot/vmlinuz-2.6.32-21-generic root=UUID=d3a683c3-ba61-4502-8d82-f6cd4177ee6d ro single
initrd /boot/initrd.img-2.6.32-21-generic
}
### 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.

menuentry "Custom Menu"{
set root=(hd0,1)
search --no-floppy --fs-uuid --set e7fee477-6a63-492e-839c-4d27ce99e2cf
configfile /boot/grub/custom_menu.cfg
}


### END /etc/grub.d/40_custom ###

=============================== sda6/etc/fstab: ===============================

# /etc/fstab: static file system information.
#
# Use 'blkid -o value -s UUID' to print the universally unique identifier
# for a device; this may be used with UUID= as a more robust way to name
# devices that works even if disks are added and removed. See fstab(5).
#
# <file system> <mount point> <type> <options> <dump> <pass>
proc /proc proc nodev,noexec,nosuid 0 0
# / was on /dev/sda6 during installation
UUID=8d48c292-706d-44d5-866f-347679d9d8c8 / ext4 errors=remount-ro 0 1
# /home was on /dev/sda7 during installation
UUID=b5e410d4-5201-4afe-8c53-3761f6850a42 /home ext4 defaults 0 2
# swap was on /dev/sda5 during installation
#UUID=5623aa05-2a6d-467a-a89c-1871ab5cbe99 none swap sw 0 0
/dev/fd0 /media/floppy0 auto rw,user,noauto,exec,utf8 0 0
/dev/mapper/cryptswap1 none swap sw 0 0
# mounts the music drive
UUID=6875d601-79d5-4418-9876-2e8a12e6e31f /mnt/musicpart ext3 defaults 0 2

=================== sda6: Location of files loaded by Grub: ===================


13.3GB: boot/grub/core.img
13.4GB: boot/grub/grub.cfg
13.3GB: boot/initrd.img-2.6.32-21-generic
13.3GB: boot/initrd.img-2.6.32-22-generic
17.7GB: boot/vmlinuz-2.6.32-21-generic
11.3GB: boot/vmlinuz-2.6.32-22-generic
13.3GB: initrd.img
13.3GB: initrd.img.old
11.3GB: vmlinuz
17.7GB: vmlinuz.old

drs305
May 18th, 2010, 01:30 PM
We can use this thread as a learning tool and take things step by step to build a customized and simple Grub 2 menu.

Let's create a new custom file. We will name it 06_custom so it appears at the top of your menu. (If you use 40_custom, it will be at the bottom of your menu).

The information after the # symbol is explanatory and need not be copied into the terminal.



sudo cp /etc/grub.d/40_custom /etc/grub.d/06_custom # create new custom menu
gksu gedit /etc/grub.d/06_custom /etc/default/grub # open files as root for editing


In the 06_custom file:
Add the line in bold and then everything in blue:

#!/bin/sh
echo "Adding 06_custom." >&2
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 'Ubuntu 32-bit (on sda1)' --class ubuntu --class gnu-linux --class gnu --class os {
recordfail
insmod ext2
set root='(hd0,1)'
linux /vmlinuz root=UUID=d3a683c3-ba61-4502-8d82-f6cd4177ee6d ro quiet splash
initrd /initrd.img
}

menuentry "Ubuntu 64-bit (on /dev/sda6)" {
insmod ext2
set root='(hd0,6)'
linux /vmlinuz root=UUID=8d48c292-706d-44d5-866f-347679d9d8c8 ro quiet splash
initrd /initrd.img-2.6.32-22-generic
}

menuentry "Automatically Generated Menu Entries:" {
insmod ext2
}




The titles on the menuentry lines (between the ' symbols) can be changed to anything you want. You can change the title, remove the sda reference, etc.

Notice I did not include the kernel version number. This will allow Grub2 to boot the latest kernel, even after an update. In a custom menu that doesn't change, this gives the advantage of always using the latest kernel without having to update the menu. The drawback is that you automatically use the current kernel and if it doesn't work, it will break you boot. If this happened, you would use one of the automatically-generated items from the lower menu, which we have left intact. The other option is to include the full kernel name on the "linux" and "initrd" lines and then manually update to the newer kernel once you are sure it works.

The last menuentry merely presents a textual break between your custom file and the automatically generated menu items you currently have. You can remove it or change the title to something else.

Save the file and run "sudo update-grub". You should see the line "Adding 06_custom" in the terminal as Grub 2 executes. Adding the second line in the file is what gives us this confirmation.

Now you will be presented with a combined custom menu, followed by the menu you started with.

There is one more thing to do, however. Grub 2 is most likely set up to boot the first menu item. In the /etc/default/grub file, find:

GRUB_DEFAULT=0

Since we added menuentries before the existing ones, the default OS has changed - it would now be the first menuentry in your new 06_custom file. Since we haven't tested it yet, it might be better to change this to a menuentry we know works.

Grub 2 can use a variety of methods to identify the menuentry to boot. In this case, we can use an exact title - independent of where that item is in the menu. So for testing, change the line to your existing default entry:


GRUB_DEFAULT="Ubuntu, with Linux 2.6.32-21-generic"

Save the file and update grub once again.
Reboot.

If you aren't seeing the menu, try holding down the SHIFT key during boot so you can inspect the results so far. Then try booting to the first menuentry (which would be from your new custom file). If you can't see the menu at all, we may need to add the keystatus check. Let me know if you can't call up the menu.

Once we know things are working, we can go on to the next step. Tell me what you want to change next.

oldfred
May 18th, 2010, 03:17 PM
You copied meirerfra's UUID not yours. And I would think it would be easier if the custom menu was in sda6 which is your current boot per grub2 in the MBR.

Your entry:

menuentry "Custom Menu"{
set root=(hd0,1)
search --no-floppy --fs-uuid --set e7fee477-6a63-492e-839c-4d27ce99e2cf
configfile /boot/grub/custom_menu.cfg
}

Your partition is (hd0,6) and the UUID for sda6 is

/dev/sda6 8d48c292-706d-44d5-866f-347679d9d8c8 ext4 64BitSys

tropdoug
May 20th, 2010, 10:37 AM
Interesting-er and interesting-er Things are getting more confusing.

OK OldFred thank you for spotting the cut and paste error. I fixed that up, but still no custom menu.

So drs305 - I followed you suggestions meticulously on the 64bit system, which I want to be the default, (hd0,6) but even after watching the terminal report "adding 06_custom"

and then doing the rest of the stuff, when I rebooted there was no difference.

So i sat and thought ------ Hmmm I wonder if because there is essentially only 1 operating system -- 10.04 on both drives, albeit that one is 32 bit and the other 64 bit could that be screwing thing up.

So I booted into (hd0,1) the 32bit system and went through the same procedure with creating a 06_custom file etc. However when I ran "update-grub" I did NOT see any additions to the grub.cfg file. So I opened it with gedit and checked, and sure enough nothing had changed.

So I went into the 05_debian file and changed the colours, so that what I was about to do would most definitely be able to be seen.

Then I manually added the 06_custom entries after the 05_debian entries in /boot/grub/grub.cfg and saved the file

I then rebooted -- aha - a nice cyan/blue screen therefore the boot oepration is being taken from the boot file on (hd0,1) not as we thought on (hd0,6)

and sure enough at the top of the menu were the two entries from 06_custom -- so far so good.

I then selected option 1 -- the 64 bit system and an error came up "Must loaod kernmel first" I escaped form this, and tried option 2 the 32 bit system -- same error - escaped again and tried the original entry from 10_linux - and here I am in the 32 bit system.

Ok so here is grub.cfg file. what next????

Tropdoug



#
# 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="Ubuntu, with Linux 2.6.32-22-generic"
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
}
insmod ext2
set root='(hd0,1)'
search --no-floppy --fs-uuid --set d3a683c3-ba61-4502-8d82-f6cd4177ee6d
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='(hd0,1)'
search --no-floppy --fs-uuid --set d3a683c3-ba61-4502-8d82-f6cd4177ee6d
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=cyan/blue
set menu_color_highlight=black/light-gray
### END /etc/grub.d/05_debian_theme ###

### BEGIN /etc/grub.d/06_custom ###
menuentry "Ubuntu 64-bit (on /dev/sda6)" --class ubuntu --class gnu-linux --class gnu --class os {
recordfail
insmod ext2
set root='(hd0,6)'
linux /boot/vmlinuz root=UUID=8d48c292-706d-44d5-866f-347679d9d8c8 ro quiet splash
initrd /boot/initrd.img-2.6.32-22-generic
}


menuentry 'Ubuntu 32-bit (on sda1)' {
insmod ext2
set root='(hd0,1)'
linux /boot/vmlinuz root=UUID=d3a683c3-ba61-4502-8d82-f6cd4177ee6d ro quiet splash
initrd /boot/initrd.img
}


menuentry "Automatically Generated Menu Entries:" {
insmod ext2
}
### END /etc/grub.d/06_custom ###

### BEGIN /etc/grub.d/10_linux ###
menuentry 'Ubuntu, with Linux 2.6.32-21-generic' --class ubuntu --class gnu-linux --class gnu --class os {
recordfail
insmod ext2
set root='(hd0,1)'
search --no-floppy --fs-uuid --set d3a683c3-ba61-4502-8d82-f6cd4177ee6d
linux /boot/vmlinuz-2.6.32-21-generic root=UUID=d3a683c3-ba61-4502-8d82-f6cd4177ee6d ro quiet splash
initrd /boot/initrd.img-2.6.32-21-generic
}
menuentry 'Ubuntu, with Linux 2.6.32-21-generic (recovery mode)' --class ubuntu --class gnu-linux --class gnu --class os {
recordfail
insmod ext2
set root='(hd0,1)'
search --no-floppy --fs-uuid --set d3a683c3-ba61-4502-8d82-f6cd4177ee6d
echo 'Loading Linux 2.6.32-21-generic ...'
linux /boot/vmlinuz-2.6.32-21-generic root=UUID=d3a683c3-ba61-4502-8d82-f6cd4177ee6d ro single
echo 'Loading initial ramdisk ...'
initrd /boot/initrd.img-2.6.32-21-generic
}
### END /etc/grub.d/10_linux ###

### BEGIN /etc/grub.d/20_memtest86+ ###
menuentry "Memory test (memtest86+)" {
insmod ext2
set root='(hd0,1)'
search --no-floppy --fs-uuid --set d3a683c3-ba61-4502-8d82-f6cd4177ee6d
linux16 /boot/memtest86+.bin
}
menuentry "Memory test (memtest86+, serial console 115200)" {
insmod ext2
set root='(hd0,1)'
search --no-floppy --fs-uuid --set d3a683c3-ba61-4502-8d82-f6cd4177ee6d
linux16 /boot/memtest86+.bin console=ttyS0,115200n8
}
### END /etc/grub.d/20_memtest86+ ###

### BEGIN /etc/grub.d/30_os-prober ###
menuentry "Ubuntu, with Linux 2.6.32-22-generic (on /dev/sda6)" {
insmod ext2
set root='(hd0,6)'
search --no-floppy --fs-uuid --set 8d48c292-706d-44d5-866f-347679d9d8c8
linux /boot/vmlinuz-2.6.32-22-generic root=UUID=8d48c292-706d-44d5-866f-347679d9d8c8 ro quiet splash
initrd /boot/initrd.img-2.6.32-22-generic
}
menuentry "Ubuntu, with Linux 2.6.32-22-generic (recovery mode) (on /dev/sda6)" {
insmod ext2
set root='(hd0,6)'
search --no-floppy --fs-uuid --set 8d48c292-706d-44d5-866f-347679d9d8c8
linux /boot/vmlinuz-2.6.32-22-generic root=UUID=8d48c292-706d-44d5-866f-347679d9d8c8 ro single
initrd /boot/initrd.img-2.6.32-22-generic
}
menuentry "Ubuntu, with Linux 2.6.32-21-generic (on /dev/sda6)" {
insmod ext2
set root='(hd0,6)'
search --no-floppy --fs-uuid --set 8d48c292-706d-44d5-866f-347679d9d8c8
linux /boot/vmlinuz-2.6.32-21-generic root=UUID=8d48c292-706d-44d5-866f-347679d9d8c8 ro quiet splash
initrd /boot/initrd.img-2.6.32-21-generic
}
menuentry "Ubuntu, with Linux 2.6.32-21-generic (recovery mode) (on /dev/sda6)" {
insmod ext2
set root='(hd0,6)'
search --no-floppy --fs-uuid --set 8d48c292-706d-44d5-866f-347679d9d8c8
linux /boot/vmlinuz-2.6.32-21-generic root=UUID=8d48c292-706d-44d5-866f-347679d9d8c8 ro single
initrd /boot/initrd.img-2.6.32-21-generic
}
### 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 ###

drs305
May 20th, 2010, 01:10 PM
troupdog,

You did follow my instructions. I originally pasted an existing menuentry. However, when I decided that the current kernel, whatever it's designation, is better in the custom entries, we don't need to specify "/boot" in the path. I forgot to remove it. I've edited the previous post.

Replace this:

menuentry "Ubuntu 64-bit (on /dev/sda6)" --class ubuntu --class gnu-linux --class gnu --class os {
recordfail
insmod ext2
set root='(hd0,6)'
linux /boot/vmlinuz root=UUID=8d48c292-706d-44d5-866f-347679d9d8c8 ro quiet splash
initrd /boot/initrd.img-2.6.32-22-generic
}


menuentry 'Ubuntu 32-bit (on sda1)' {
insmod ext2
set root='(hd0,1)'
linux /boot/vmlinuz root=UUID=d3a683c3-ba61-4502-8d82-f6cd4177ee6d ro quiet splash
initrd /boot/initrd.img
}


try this:


menuentry "Ubuntu 64-bit (on /dev/sda6)" --class ubuntu --class gnu-linux --class gnu --class os {
recordfail
insmod ext2
set root='(hd0,6)'
linux /vmlinuz root=UUID=8d48c292-706d-44d5-866f-347679d9d8c8 ro quiet splash
initrd /initrd.img-2.6.32-22-generic
}


menuentry 'Ubuntu 32-bit (on sda1)' {
insmod ext2
set root='(hd0,1)'
linux /vmlinuz root=UUID=d3a683c3-ba61-4502-8d82-f6cd4177ee6d ro quiet splash
initrd /boot/initrd.img
}

tropdoug
May 21st, 2010, 09:01 AM
Before I go further, can you tell me, how does the system at boot time pick the boot/grub/grub.cfg file. I thought that if I did alterations whilst in my 63bit partition, and updated grub, then the MBR has those instruction on it. However that doesn't appear to be the case. And when I do update grub with the changes I make while in the 32 bit partition it doesn't update, yet by manually changing the colours of the 05-debian file on the 32 but system I can see that it is that system that is writing to the MBR? so - why doesnt update-grub work on the 32bit sys and why does the 64bit grub.cfg file not appear on boot?

Should I manually remove one systems grub files and only leave the other?

oldfred
May 21st, 2010, 04:52 PM
A MBR can only boot to one system, either the 32 or the 64 install. The sudo update-grub rewrites the grub.cfg of the current system you are boot into but does not write that grub to the MBR. You have to install grub to the MBR for that system to be in charge.

IF you run this from the 32 bit system you will boot the 32 bit system next time. Then if you run it from the 64 bit system you will boot the 64 bit system. Grub2 is good at finding other systems so both will show the other as available to boot.

(not from liveCD but from within the system you have booted to reinstall)
reinstall to sda
sudo apt-get install --reinstall grub-pc
sudo grub-install /dev/sda
sudo grub-install --recheck /dev/sda
sudo update-grub

QLee
May 21st, 2010, 05:06 PM
A MBR can only boot to one system, either the 32 or the 64 install. The sudo update-grub rewrites the grub.cfg of the current system you are boot into but does not write that grub to the MBR. You have to install grub to the MBR for that system to be in charge.

By this I believe you are referring to the GRUB in the MBR only handing off to one partition for the remainder of GRUB during booting, and as far as that goes it is correct. I wonder if the OP has considered using a separate boot partition, and thus being able to leave the MBR static.

QLee
May 21st, 2010, 08:23 PM
I might as well give you the answer to this question too since it might be a while before you come back online.


Before I go further, can you tell me, how does the system at boot time pick the boot/grub/grub.cfg file.

The portion of GRUB that gets written to the MBR contains the location(of the partition) of the rest of GRUB needed to boot the system. (A long time ago the MBR was large enough to hold the whole bootloader, but bootloaders have become more sophisticated and no longer fit in the space reserved for the MBR of a drive, thus they now "hand off" to the next location.)

Oldfred explained the answer to the rest of your question.

tropdoug
May 28th, 2010, 11:16 PM
Sorry I have been absent for a while, the reason is I did something wrong, not sure what, but after one of the update-grub commands I couldn't get into the system at all - either one. Then I found out that the install cd for Lucid no longer has the option to try the system without installing. Using the 'repair a broken system' could not fix it, and then even if I dropped into a shell, I don't have the Linux expertise to know the command line stuff to carry out anything really.

So after scratching my head for a while, I decided to reinstall the 64 bit sys only onto sda1 and then move my /home directory to sdb6 and copy the stuff I wanted from the old 64bit /home to the new one.

Next issue was -- I encrypted the /home directory on original install and now cannot access the data contained within. I have another thread asking if anyone knows how to move an encrypted /home to a new partition, but so far no answers.

I guess that I am very glad that Linux allows one to play, break, and fix with relative ease, and in this case I have not lost anything important. It has been a learning experience.

Thanks for the info on how grub boots I understand that now. So now I have just one system, and one grub cfg but the question now is can I recover the encrypted /home and move it?

tropdoug
June 3rd, 2010, 11:29 AM
Ok I seem to have exhausted this line of questioning. so I am marking it as solved, even though it's not really. I guess that re installing is a solution of sorts. But I am still not sure how to move my encrypted /home