Results 1 to 1 of 1

Thread: Can not add menu entry to grub

  1. #1
    Join Date
    Jun 2006
    Location
    Sweden
    Beans
    19
    Distro
    Ubuntu 9.10 Karmic Koala

    [SOLVED] Can not add menu entry to grub

    Hello all,

    I have been googling, searching the forums, fiddling with stuff and whatnot the whole day but for some reason i can't add a custom entry to the grub menu.

    I'm using karmic which comes with grub2 as the default bootloader. I wanted to try out gentoo, so i followed their install guide through except the part that concerns the boot part since i wanted to add a entry in the boot menu i got when i installed ubuntu.

    Gentoo is installed on /dev/sda7 and ubuntu is installed to /dev/sda5.

    I have added a custom entry to /etc/grub.d/40_custom that looks like this:
    Code:
    menuentry "Gentoo 2.6.31" { 
    	set root=(hd0,7) 
    	linux /boot/kernel-genkernel-x86_64-2.6.31-gentoo-r6 root=/dev/sda7
    	initrd /boot/initramfs-genkernel-x86_64-2.6.31-gentoo-r6
    }
    and after running update-grub2 my /boot/grub/grub.cfg looks like this:
    Code:
    #
    # 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 /boot/grub/grubenv ]; then
      have_grubenv=true
      load_env
    fi
    set default="${saved_entry}"
    if [ ${prev_saved_entry} ]; then
      saved_entry=${prev_saved_entry}
      save_env saved_entry
      prev_saved_entry=
      save_env prev_saved_entry
    fi
    insmod ext2
    set root=(hd0,5)
    search --no-floppy --fs-uuid --set 92edf599-d12b-4abf-ba35-b15764f38154
    if loadfont /usr/share/grub/unicode.pf2 ; then
      set gfxmode=1280x1024
      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
    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 ###
    insmod ext2
    set root=(hd0,5)
    search --no-floppy --fs-uuid --set 92edf599-d12b-4abf-ba35-b15764f38154
    insmod tga
    if background_image /usr/share/images/grub/2006-02-15_Piping.tga ; then
      set color_normal=black/black
      set color_highlight=magenta/black
    else
      set menu_color_normal=white/black
      set menu_color_highlight=black/white
    fi
    ### END /etc/grub.d/05_debian_theme ###
    
    ### BEGIN /etc/grub.d/10_linux ###
    menuentry "Ubuntu, Linux 2.6.31-20-generic-pae" {
            recordfail=1
            if [ -n ${have_grubenv} ]; then save_env recordfail; fi
    	set quiet=1
    	saved_entry=${chosen}
    	save_env saved_entry
    	insmod ext2
    	set root=(hd0,5)
    	search --no-floppy --fs-uuid --set 92edf599-d12b-4abf-ba35-b15764f38154
    	linux	/boot/vmlinuz-2.6.31-20-generic-pae root=/dev/sda5 ro  splash  ipv6.disable=1 quiet splash
    	initrd	/boot/initrd.img-2.6.31-20-generic-pae
    }
    menuentry "Ubuntu, Linux 2.6.31-20-generic-pae (recovery mode)" {
            recordfail=1
            if [ -n ${have_grubenv} ]; then save_env recordfail; fi
    	saved_entry=${chosen}
    	save_env saved_entry
    	insmod ext2
    	set root=(hd0,5)
    	search --no-floppy --fs-uuid --set 92edf599-d12b-4abf-ba35-b15764f38154
    	linux	/boot/vmlinuz-2.6.31-20-generic-pae root=/dev/sda5 ro single  splash
    	initrd	/boot/initrd.img-2.6.31-20-generic-pae
    }
    menuentry "Ubuntu, Linux 2.6.31-19-generic-pae" {
            recordfail=1
            if [ -n ${have_grubenv} ]; then save_env recordfail; fi
    	set quiet=1
    	saved_entry=${chosen}
    	save_env saved_entry
    	insmod ext2
    	set root=(hd0,5)
    	search --no-floppy --fs-uuid --set 92edf599-d12b-4abf-ba35-b15764f38154
    	linux	/boot/vmlinuz-2.6.31-19-generic-pae root=/dev/sda5 ro  splash  ipv6.disable=1 quiet splash
    	initrd	/boot/initrd.img-2.6.31-19-generic-pae
    }
    menuentry "Ubuntu, Linux 2.6.31-19-generic-pae (recovery mode)" {
            recordfail=1
            if [ -n ${have_grubenv} ]; then save_env recordfail; fi
    	saved_entry=${chosen}
    	save_env saved_entry
    	insmod ext2
    	set root=(hd0,5)
    	search --no-floppy --fs-uuid --set 92edf599-d12b-4abf-ba35-b15764f38154
    	linux	/boot/vmlinuz-2.6.31-19-generic-pae root=/dev/sda5 ro single  splash
    	initrd	/boot/initrd.img-2.6.31-19-generic-pae
    }
    ### END /etc/grub.d/10_linux ###
    
    ### BEGIN /etc/grub.d/30_os-prober ###
    menuentry "Windows 7 (loader) (on /dev/sda1)" {
    	saved_entry=${chosen}
    	save_env saved_entry
    	insmod ntfs
    	set root=(hd0,1)
    	search --no-floppy --fs-uuid --set ec90dcca90dc9d00
    	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.
    menuentry "Gentoo 2.6.31" { 
    	set root=(hd0,7) 
    	linux /boot/kernel-genkernel-x86_64-2.6.31-gentoo-r6 root=/dev/sda7
    	initrd /boot/initramfs-genkernel-x86_64-2.6.31-gentoo-r6
    } 
    
    ### END /etc/grub.d/40_custom ###
    and it looks like the gentoo entry should come up in the boot menu when restarting, but it doesnt, it does however show all the other "menuentry" entries in that file.

    So is there anything that i have missed, done in a wrong way or just messed something up?

    EDIT: If i get into the grub console and type:
    Code:
    set root=(hd0,7)
    linux /boot/kernel-genkernel-x86_64-2.6.31-gentoo-r6 root=/dev/sda7
    initrd /boot/initramfs-genkernel-x86_64-2.6.31-gentoo-r6
    boot
    the system will boot into gentoo, so i know the paths/filename are correct.

    EDIT 2:
    The output of sudo update-grub2 is:
    Code:
    sudo update-grub2
    Generating grub.cfg ...
    Found Debian background: 2006-02-15_Piping.tga
    Found linux image: /boot/vmlinuz-2.6.31-20-generic-pae
    Found initrd image: /boot/initrd.img-2.6.31-20-generic-pae
    Found linux image: /boot/vmlinuz-2.6.31-19-generic-pae
    Found initrd image: /boot/initrd.img-2.6.31-19-generic-pae
    Found Windows 7 (loader) on /dev/sda1
    Found Gentoo Base System release 1.12.13 on /dev/sda7
    done
    EDIT 3:
    I solved my problem by using these lines in /etc/grub.d/40_custom
    Code:
    menuentry "Gentoo 2.6.31" {
    	set root=(hd0,7)
    	search --no-floppy --fs-uuid --set 35af694c-0bc4-474d-a9bf-93243297805c
    	linux /boot/kernel-genkernel-x86_64-2.6.31-gentoo-r6 root=/dev/sda7 ro
    	initrd /boot/initramfs-genkernel-x86_64-2.6.31-gentoo-r6
    }
    I just added the line that starts with search and then it popped up in my grub boot menu
    Last edited by Ixzat; February 21st, 2010 at 01:52 AM. Reason: added info about grub console and output of update-grub2 and posted my solution aswell

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •