1

Possible Duplicate:
Make grub keep its default boot under kernel updates

I've got dual boot system - Ubuntu 9.10 and Windows 7.

Whenever the GRUB loaded, the menu showed lots of options, for example, the past kernels, memory tests, and windows 7.

I want to make this menu smaller, because I need to press downward arrow about 6 times to go to the Windows 7 option. I aware that the GRUB is version 1.97~beta4 and after spending some time on Ubuntu official site I still can't figure out how to change it.

Dean
  • 400

2 Answers2

2

The answer appears to be:

  • Remove old kernels via Synaptic, and their boot entry will be automatically removed
  • You can kill other extraneous entries by making their entries in /etc/grub.d/ non-executable

So to get rid of the memtest entry, you would run:

sudo chmod -x /etc/grub.d/20_memtest86+
  • My reading of /etc/grub.d/README is that Grub determines the order of menu entries based on the leading number of its filename. I don't have any dual-boot systems to verify this on, but Windows should have its own entry file here. So if you wanted to keep the memtest entry, but have the Windows entry display first, you'd rename the files so that the Windows entry had a lower numerical tag on the filename
  • After you make your changes, run update-grub at the CLI to commit them.

Answers pulled from this guide to Grub 2 at the Ubuntu Forums.

jslaker
  • 156
0

Edit the file /boot/grub/menu.lst as root with your favourite text editor. Find the section that looks something like this:

  • title Debian
  • root (hd0,0)
  • kernel /vmlinuz-2.6.26-2-686 root=/dev/sda2 ro
  • initrd /initrd.img-2.6.26-2-686
  • title Debian (single-user mode)
  • root (hd0,0)
  • kernel /vmlinuz-2.6.26-2-686 root=/dev/sda2 ro single
  • initrd /initrd.img-2.6.26-2-686

Every title corresponds to one entry on the boot menu. To disable an entry, simply comment out the appropriate lines. So to remove the entry in my example above named Debian (single user mode) I would edit the file to look like this:

  • title Debian
  • root (hd0,0)
  • kernel /vmlinuz-2.6.26-2-686 root=/dev/sda2 ro
  • initrd /initrd.img-2.6.26-2-686
  • # title Debian (single-user mode)
  • # root (hd0,0)
  • # kernel /vmlinuz-2.6.26-2-686 root=/dev/sda2 ro single
  • # initrd /initrd.img-2.6.26-2-686

Do this for all entries you want hidden from the boot menu. To restore an entry, simply remove the #.

Edit: Only now I realized you were using Grub 2. Sorry about that, the above only applies to Grub 1 (aka Grub Legacy). On the Grub Wiki I found this grub.cfg example config. Interpreting it, you should be able to comment out the appropriate entries much like I showed above.

Editing

  • menuentry "My Linux Kernel on (hd0,1)" {
  • set root=(hd0,1)
  • linux /vmlinuz root=/dev/hda1
  • initrd /initrd
  • }
  • menuentry "Chainload my OS" {
  • set root=(hd0,3)
  • chainloader +1
  • }

into

  • menuentry "Linux" {
  • set root=(hd0,1)
  • linux /vmlinuz root=/dev/hda1
  • initrd /initrd
  • }
  • # menuentry "Other OS" {
  • # set root=(hd0,3)
  • # chainloader +1
  • # }

should work, I think. Be aware that I have no idea if this will work, and might be harmful in some way. Proceed with caution.

Arkenklo
  • 391