Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

So basically I have a pretty flooded Grub bootloader, with older linux versions, 3 operating systems and memtests. What I want is to leave the operating systems only. I need to know how to do it manually, and I need someone to tell me what should I be aware of when a new kernel is released. Thanks in advance.

share|improve this question

4 Answers 4

up vote 6 down vote accepted

The blog post GRUB2 revisited will provide you with a blow-by-blow set of instructions on how to manually edit GRUB2's configuration files. If you check the other postings in the series (by filtering on Category = GRUB) you will also find information on removing old kernels and what happens when a new kernel arrives as an update. The postings include references to a number of related web sites.

share|improve this answer
    
This is exactly what I needed. Thanks mate. –  Shahe Tajiryan Nov 22 '11 at 17:59

Using gedit, edit the grub.cfg file located at /boot/grub.

Remove the one which is not working. For example there are two entries located on different partitions /dev/sda3 and /dev/sda4. You would have to delete from menuentry to } (which means close).

Then press save and voila.

### BEGIN /etc/grub.d/30_os-prober ###
menuentry 'Windows 7 (loader) (on /dev/sda4)' --class windows --class os $menuentry_id_option 'osprober-chain-BABCA4EEBCA4A67B' {
    insmod part_msdos
    insmod ntfs
    set root='hd0,msdos4'
    if [ x$feature_platform_search_hint = xy ]; then
      search --no-floppy --fs-uuid --set=root --hint-bios=hd0,msdos4 --hint-efi=hd0,msdos4 --hint-baremetal=ahci0,msdos4  BABCA4EEBCA4A67B
    else
      search --no-floppy --fs-uuid --set=root BABCA4EEBCA4A67B
    fi
    chainloader +1
}
menuentry 'Windows 7 (loader) (on /dev/sda3)' --class windows --class os $menuentry_id_option 'osprober-chain-BABCA4EEBCA4A67B' {
    insmod part_msdos
    insmod ntfs
    set root='hd0,msdos4'
    if [ x$feature_platform_search_hint = xy ]; then
      search --no-floppy --fs-uuid --set=root --hint-bios=hd0,msdos4 --hint-efi=hd0,msdos4 --hint-baremetal=ahci0,msdos4  BABCA4EEBCA4A67B
    else
      search --no-floppy --fs-uuid --set=root BABCA4EEBCA4A67B
    fi
    chainloader +1
}
### END /etc/grub.d/30_os-prober ###

I delete /dev/sda3, after deletion it will look like this

### BEGIN /etc/grub.d/30_os-prober ###
menuentry 'Windows 7 (loader) (on /dev/sda4)' --class windows --class os $menuentry_id_option 'osprober-chain-BABCA4EEBCA4A67B' {
    insmod part_msdos
    insmod ntfs
    set root='hd0,msdos4'
    if [ x$feature_platform_search_hint = xy ]; then
      search --no-floppy --fs-uuid --set=root --hint-bios=hd0,msdos4 --hint-efi=hd0,msdos4 --hint-baremetal=ahci0,msdos4  BABCA4EEBCA4A67B
    else
      search --no-floppy --fs-uuid --set=root BABCA4EEBCA4A67B
    fi
    chainloader +1
}
### END /etc/grub.d/30_os-prober ###
share|improve this answer
1  
The file is automatically created with each upgrade of the kernel or when running update-grub, why should you edit it manually? –  Braiam Mar 23 at 14:02

Rather than edit the grub file directly, you should clean up the kernels you don't want.

Start with this:

dpkg -l | grep linux-image

The update-grub script just makes entries for everything it finds in /boot, as far as I'm aware, so removing old linux-image (and linux-headers) packages via apt-get remove will clean up /boot and therefore clean up your grub config.

This is the "proper" way to do it and hence will require no special action when newer kernels are released in the future, you'll just have to clean up again at some point probably :)

share|improve this answer

Depending on your grub version, you could use the StartUpManager application to maintain your grub menu. Its Advanced Tab settings allow selecting / deselecting a Memtest / Recovery boot entry and also the number of kernel versions. With grub2, "the Appearance and Advanced tabs contain fewer entries at present, and the Security tab does not exist with Grub 2 fully-installed." (see here, "Grub 2 Note").

enter image description here

share|improve this answer
    
In advanced, I get nothing except Resoultion settings. And creating a rescue floppy. –  Shahe Tajiryan Nov 22 '11 at 17:05
    
@ShaheTajiryan: Sorry, my wrong, i didn't cite precisely. Now edited. It seems you're using grub2, so the StartUpManager won't be a big help for you. –  tohuwawohu Nov 22 '11 at 17:12
3  
Start-Up Manager is obsolete, it has been replaced by GRUB-Customizer. –  LovinBuntu Feb 8 '13 at 22:18

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.