Disable recovery modes in secondary partitions

Asked by Juan Carlos Chak

Hi all,

I'm using Ubuntu 10.10 on a computer that has a hard disk with four partitions that look like this:

/dev/sda1 - Linux
/dev/sda2 - FAT32
/dev/sda3 - Linux
/dev/sda4 - Linux swap / Solaris

In /dev/sda1 I have the 32 bit version of Ubuntu, and in /dev/sda3 I have the 64 bit version.

My problem is that I want to disable all the recovery entries of the grub2's menu, but I can't because the option GRUB_DISABLE_LINUX_RECOVERY="true" in "/etc/default/grub" just works for the current partition, but not if the Linux OS is installed in another partition. The problem is in the "/etc/grub.d/30_os-prober" script, because it doesn't take into consideration this option, so it generates a recovery menuentry always. For example:

### BEGIN /etc/grub.d/10_linux ###
menuentry 'Ubuntu, with Linux 2.6.35-25-generic' --class ubuntu --class gnu-linux --class gnu --class os {
 recordfail
 insmod part_msdos
 insmod ext2
 set root='(hd0,msdos3)'
 search --no-floppy --fs-uuid --set e1865cdb-...
 linux /boot/vmlinuz-2.6.35-25-generic root=UUID=e1865cdb-... ro quiet splash
 initrd /boot/initrd.img-2.6.35-25-generic
}
### END /etc/grub.d/10_linux ###

### BEGIN /etc/grub.d/20_linux_xen ###
### END /etc/grub.d/20_linux_xen ###

### BEGIN /etc/grub.d/30_os-prober ###
menuentry "Ubuntu, with Linux 2.6.35-25-generic (on /dev/sda1)" {
 insmod part_msdos
 insmod ext2
 set root='(hd0,msdos1)'
 search --no-floppy --fs-uuid --set 09c06bbd-...
 linux /boot/vmlinuz-2.6.35-25-generic root=UUID=09c06bbd-... ro quiet splash
 initrd /boot/initrd.img-2.6.35-25-generic
}
menuentry "Ubuntu, with Linux 2.6.35-25-generic (recovery mode) (on /dev/sda1)" {
 insmod part_msdos
 insmod ext2
 set root='(hd0,msdos1)'
 search --no-floppy --fs-uuid --set 09c06bbd-...
 linux /boot/vmlinuz-2.6.35-25-generic root=UUID=09c06bbd-44c1-... ro single
 initrd /boot/initrd.img-2.6.35-25-generic
}

So, my question is: how can I disable in a "elegant manner" those recovery menuentries? I know I could modify the "/etc/grub.d/30_os-prober" script or edit manually "/boot/grub/grub.cfg", but these solutions are something that I won't like to do at all (because I would have to do that every time that I upgrade the whole OS, or when I run an "update-grub").

Thanks in advance.

Question information

Language:
English Edit question
Status:
Answered
For:
Ubuntu grub2 Edit question
Assignee:
No assignee Edit question
Last query:
Last reply:
Revision history for this message
delance (olivier-delance) said :
#1

Welcome in the club. I'm currently looking in os-prober code to see how to fix such issue. But for the moment I understand nothing.

Revision history for this message
Juan Carlos Chak (jcchak) said :
#2

Hi delance,

Thanks for the welcome!

In brief: if you uncomment in "/etc/default/grub" the line where it says GRUB_DISABLE_LINUX_RECOVERY="true", after an "update-grub" it continues to generate "recovery mode" menuentries if you have another partition with an Ubuntu installed.

I was asking if there is a way to disable also these menuentries, without editing manually "/boot/grub/grub.cfg" or modifying the script that generates those extra menuentries ("/etc/grub.d/30_os-prober").

Thanks in advance!

Revision history for this message
Ubfan (ubfan1) said :
#3

If these other OSes don't change much, you might just copy the edited section 30 (other oses) to 40_custom, and remove execution from 30_os_prober.

Can you help with this problem?

Provide an answer of your own, or ask Juan Carlos Chak for more information if necessary.

To post a message you must log in.