Tuesday, November 2, 2010

How to remove extra menu items in grub boot loader

When I have installed updates for my ubuntu linux, the kernel image also updated so I found several images of linux kernel at my machine and also many menu items at the boot loader depending on the number of versions linux kernels in my machine. This was annoying for me.
Then I prefer to have only two menu items at boot loader: one for the current version of linux and the other for windows.

Procedure:
--Write down the menu items you do not like to see in grub. At my case "Ubuntu, with Linux 2.6.32-25-generic (recovery mode)" and "Ubuntu, with Linux 2.6.32-25-generic".
--Delete the following from file /boot/grub/grub.cfg

menuentry 'Ubuntu, with Linux 2.6.32-25-generic' --class ubuntu --class gnu-linux --class gnu --class os {
recordfail
insmod ext2
set root='(hd0,2)'
search --no-floppy --fs-uuid --set 039c3fcd-6448-4da2-9a2c-4ce29e4f7926
linux /boot/vmlinuz-2.6.32-25-generic root=UUID=039c3fcd-6448-4da2-9a2c-4ce29e4f7926 ro quiet splash
initrd /boot/initrd.img-2.6.32-25-generic
echo Abuselim
}
menuentry 'Ubuntu, with Linux 2.6.32-25-generic (recovery mode)' --class ubuntu --class gnu-linux --class gnu --class os {
recordfail
insmod ext2
set root='(hd0,2)'
search --no-floppy --fs-uuid --set 039c3fcd-6448-4da2-9a2c-4ce29e4f7926
echo 'Loading Linux 2.6.32-25-generic ...'
linux /boot/vmlinuz-2.6.32-25-generic root=UUID=039c3fcd-6448-4da2-9a2c-4ce29e4f7926 ro single
echo 'Loading initial ramdisk ...'
initrd /boot/initrd.img-2.6.32-25-generic
}

3. Go to /boot and delete files with "2.6.32-25" string
4. reboot and find results ;-)

By aselims

No comments: