LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - General (https://www.linuxquestions.org/questions/linux-general-1/)
-   -   Adding a menu entry to grub2 (https://www.linuxquestions.org/questions/linux-general-1/adding-a-menu-entry-to-grub2-750961/)

Jeff91 08-28-2009 05:11 PM

Adding a menu entry to grub2
 
I have both Ubuntu 9.10 and Sabayon 4.2 installed on my laptop. Sabayon (along with it's boot loader) resides on sda8 on my hard drive. Ubuntu 9.10 resides on sda6, and grub2 resides on sda1 (Which is mounted as Ubuntu 9.10 /boot directory)

I am trying to add an entry for Sabayon to my grub so I can choose to boot into it when I want to... I ran the grub auto updated and it looked like it had worked...
Code:

jeff@sager-lintop:~$ sudo update-grub2
Generating grub.cfg ...
Found linux image: /boot/vmlinuz-2.6.31-5-generic
Found initrd image: /boot/initrd.img-2.6.31-5-generic
Found memtest86+ image: /memtest86+.bin
Found Gentoo Base System release 2.0.0 on /dev/sda8
done

How ever when I reboot I did not have a new menu entry in my grub entires... So I did some reading here and create a custom.sh (and made it executable) in my /etc/grub.d/ directory. The contents of my custom.sh are:
Code:

echo "Adding Sabayon Linux to the Menu..."
cat << EOF
menuentry "Sabayon Linux - 4.2" {
        set root=(hd0,7)
        linux /boot/kernel-genkernel-x86_64-2.6.29-sabayon  root=/dev/ram0 ramdisk=8192 real_root=UUID=c1cd8123-e519-43bf-b3eb-451423824159 dolvm init=/linuxrc splash=silent,theme:sabayon vga=791 CONSOLE=/dev/tty1 quiet resume=swap:/dev/sda2 real_resume=swap:/dev/sda2
        initrd /boot/initramfs-genkernel-x86_64-2.6.29-sabayon
}
EOF

I ran the update-grub2 command again and get the same results as before (for some reason it failed to show my echo command) - but anywho upon investigating my /boot/grub/grub.cfg it had indeed added the entry for Sabayon this time.

Only once I reboot threw me an error message "you need to load the kernel first" when I selected my Sabayon option. I know I must be missing something but I cannot quiet figure it out... any suggestions?

Thanks,
~Jeff

PS: This is my menu.lst from Sabayon to show that I have the kernels and such right in my custom.sh:
Code:

title Sabayon Linux (kernel-genkernel-x86_64-2.6.29-sabayon)
        root (hd0,7)
        kernel /boot/kernel-genkernel-x86_64-2.6.29-sabayon  root=/dev/ram0 ramdisk=8192 real_root=UUID=c1cd8123-e519-43bf-b3eb-451423824159 dolvm init=/linuxrc splash=silent,theme:sabayon vga=791 CONSOLE=/dev/tty1 quiet resume=swap:/dev/sda2 real_resume=swap:/dev/sda2
        initrd /boot/initramfs-genkernel-x86_64-2.6.29-sabayon
        savedefault


Jeff91 08-28-2009 06:12 PM

Meh nvm, I had mistakenly used hd(0, 7) when I needed to use hd(0, 8)

Works now :D

~Jeff


All times are GMT -5. The time now is 08:59 AM.