Grubb list menu

Tom H tomh0665 at gmail.com
Sat Oct 27 20:53:18 UTC 2012


On Thu, Oct 25, 2012 at 11:27 PM, NoOp <glgxg at sbcglobal.net> wrote:
>
> Updating a 2 yr old thread for others that may have similar issues.
> Archive is here:
> http://comments.gmane.org/gmane.linux.ubuntu.user/208826
>
> On 02/09/2010 05:44 PM, NoOp wrote:
>> On 02/09/2010 05:09 PM, Tom H wrote:
>>>>> $ sudo update-grub
>>>>> Generating grub.cfg ...
>>>>> Found linux image: /boot/vmlinuz-2.6.31-19-generic
>>>>> Found initrd image: /boot/initrd.img-2.6.31-19-generic
>>>>> Found linux image: /boot/vmlinuz-2.6.31-18-generic
>>>>> Found initrd image: /boot/initrd.img-2.6.31-18-generic
>>>>> Found memtest86+ image: /boot/memtest86+.bin
>>>>> Found Windows 7 (loader) on /dev/sda1
>>>>> Found Windows Vista (loader) on /dev/sda2 <=== this
>>>>> Found Windows Vista (loader) on /dev/sda3 <=== and this
>>>>> done
>>>
>>>> I ended up commenting out (#) those last two entries. Of course tested
>>>> with 'sudo update-grub' and they came back (expected). Commented them
>>>> out again & life in the boot lane is much easier now. I'll wait to see
>>>> if the new kernal updates that seem to be appearing every few days (I'm
>>>> on -20 now) will change the commented out grub.cfg entries. I suspect it
>>>> will.
>>>
>>>> Also, wrt my comments about grub2 being a PITA; I am referring to issue
>>>> like this whereby there are so many interacting files that it is
>>>> difficult to simply edit one file (as in 'menu.lst') and have the
>>>> preferences stick. I'm quite happy that grub2 picks up the 'Vista'
>>>> entries etc., but not happy that there doesn't (yet) seem to be a way to
>>>> refer to a 'master' grub2 menu file (outside of the generated grub.cfg)
>>>> that will allow commenting out those entries to stick.
>>>
>>> I have been looking at /etc/grub.d/30_os-prober and I think that I
>>> have found a solution to your update-grub recovery problem.
>>>
>>> Back up /etc/grub.d/30_os-prober, make the following change, and run update-grub
>>>
>>> Add
>>>
>>> ***begin
>>> # Begin WinRecov removal
>>> if [ "$LONGNAME" = "Windows Vista (loader)" ] ; then
>>> continue
>>> fi
>>> # End WinRecov removal
>>> ***end
>>>
>>> between
>>>
>>> ***begin
>>> if [ -z "${LONGNAME}" ] ; then
>>> LONGNAME="${LABEL}"
>>> fi
>>> ***end
>>>
>>> and
>>>
>>> ***begin
>>> echo "Found ${LONGNAME} on ${DEVICE}" >&2
>>> ***end
>>>
>>
>> Tom, you are the man! Works! Thanks!
> ...
>
> Tom, I ran into an issue with a new netbook with Win 7 Starter on it.
> Grub 2 was showing both the Windows Recovery partitions as well as a
> second (HP bootloader) 'Windows 7 (loader) /dev/sda2'. I finally figured
> out that I could insert both 'if statements to get rid of both:
>
> /etc/grub.d/30_os-prober:
> ====
> wubi=
>
> for OS in ${OSPROBED} ; do
>   DEVICE="`echo ${OS} | cut -d ':' -f 1`"
>   LONGNAME="`echo ${OS} | cut -d ':' -f 2 | tr '^' ' '`"
>   LABEL="`echo ${OS} | cut -d ':' -f 3 | tr '^' ' '`"
>   BOOT="`echo ${OS} | cut -d ':' -f 4`"
>
>   if [ -z "${LONGNAME}" ] ; then
>     LONGNAME="${LABEL}"
>   fi
>
> # WinRecov removal
> if [ "$LONGNAME" = "Windows Recovery Environment (loader)" ] ; then
> continue
> fi
>
>  if [ "$LONGNAME" = "Windows 7 (loader)" ] && [ "$DEVICE" = "/dev/sda2"
> ] ; then
> continue
> fi
> # End WinRecov removal
> ===
>
> For those wondering what all of this is about, read the thread. The
> modifications are those starting with:
>
> # WinRecov removal
> and
> ending with
> # End WinRecov removal
>
> Insert those bits following the section shown above.
>
> But in short, the problem is that if you install Ubuntu on a Win 7
> machine (as most do), the grub menu will show your Ubuntu kernel option,
> a memtest (remove that by changing the permissions of
> /etc/grub.d/20_memtest86+ to read only + change the permission back when
> you want the memtest to appear), and multiple Windows 7 partitions:
>
> Windows Recovery Environment (loader)
> (you may even get several of these)
> Windows 7 (loader) /dev/sda1
> Windows 7 (loader) /dev/sda2
>
> Not only are the menu items irritating, but they can be downright
> dangerous for a standard user selecting the wrong menu item (note:
> 'Windows 7 (loader) /dev/sda1' is generally the *only* correct choice
> for booting to Win7). User doesn't know which to select & selects
> 'Windows Recovery Environment (loader)' or 'Windows 7 (loader)
> /dev/sda2' & from there on they can be pretty much screwed as Win7 will
> take them into neverland... So the best option is to not give them the
> option to select those to begin with. Hence the modifcations to
> /etc/grub.d/30_os-prober.
>
> Thanks again to Tom H for advising on modifying /etc/grub.d/30_os-prober
> in the original thread. Added thanks to:
> <http://forums.bodhilinux.com/index.php?/topic/1028-how-to-grub2-hide-windows-recovery-partition/>
> and
> <http://ubuntuforums.org/showpost.php?p=8343454&postcount=2>


1) I've just looked at "/etc/grub.d/30_os-prober" and it's changed
since I posted [1].

With 12.04, you have insert the lines to exclude the Windows Recovery
partition(s) between

<begin>
if [ -z "${LONGNAME}" ] ; then
 LONGNAME="${LABEL}"
fi
</end>

and

<begin>
gettext_printf "Found %s on %s\n" "${LONGNAME}" "${DEVICE}" >&2
</end>


2) The ouput of os-prober seems to have changed yet again because
according to [2], it now prints

<begin>
Found Windows Recovery Environment (loader) on /dev/sda1
Found Windows 7 (loader) on /dev/sda2
Found Windows Recovery Environment (loader) on /dev/sda3
</end>

1. https://lists.ubuntu.com/archives/ubuntu-users/2010-February/210704.html

2. http://ubuntuforums.org/showthread.php?t=2055552


3) Totally OT:

There was a post by Karl in that thread!

https://lists.ubuntu.com/archives/ubuntu-users/2010-February/210343.html




More information about the ubuntu-users mailing list