-   Linux - Newbie (
-   -   Editing the grub2 boot menu in a dual boot machine (

Chriscrof 05-18-2010 04:39 AM

Editing the grub2 boot menu in a dual boot machine
I would be grateful if someone would help with this:

I have a dual boot machine that is running Windows XP and Ubuntu 10.04. It was previously Win XP/Ubuntu 9.10, but for various reasons I did a 'clean' install of Ubuntu 10.04 and having done so I ended up with a machine that was unbootable unless I "jumped through a lot of hoops".

I used the Windows 'fixmbr' facility and am now able to boot it either into Windows or Ubuntu. However, I want the boot menu to default to Windows like it did before, instead of to Ubuntu because someone else uses the machine.

The literature says that grub.cfg cannot be edited but that it can be modified by the addition of a file called /etc/grub.d/40_custom into which one can copy parts of 'menu.lst'

What exactly must I put into this file to make the boot menu default to Windows? I am beginning to think it might be easier to install Ubuntu 9.04, edit menu.lst and then upgrade to 10.04. I have another machine which is also dual boot and which I upgraded to 10.04 and didn't have any problems at all afterwards.

I should mention that Ubuntu and Windows are on separate hard drives

yooy 05-18-2010 06:04 AM

If i understood you well you want to change default boot OS in grub. (windows appears in your grub)

here is how:

else maybe this will help:

avee137 05-18-2010 08:09 AM

If you have a live cd,you can try this.worked fine for me:

Chriscrof 05-18-2010 03:03 PM

Thanks, yooy. I followed the link but I haven't got the files to edit that are mentioned in that answer. I think the link must be referring to grub 1 but I have grub2.

I am still digesting the item in your link, avee137. Thanks for your trouble. I will let you know what happens

syg00 05-18-2010 04:58 PM

Use the "grub2" link in that article. Takes you to a very good overview. Describes exactly what you need - don't forget the update-grub afterwards.
Looks like a GUI is available for these sort of updates now - haven't looked at it.

Chriscrof 05-19-2010 07:53 AM

Hi, if anyone is interested, I set the default OS to Windows by editing /etc/default/grub and changing 0 to 6 in the line "Grub default" and then using the command 'update-grub'. However, I now have another problem - a situation rather than a problem. Update manager has installed a new version of the Linux kernel so that I now have both the previous kernel and the latest one showing in the boot menu. While it is not a problem in itself I would like to remove the entries relating to the previous kernel so the the boot menu does not get longer and longer with every new release of the kernel. Anyone know how to do this? It is grub2 that I have so it is not a question of editing menu.lst as there isn't a menu.lst and deleting the unwanted lines.

grail 05-19-2010 08:32 AM

If you remove the kernel and other related files from /boot and then refresh the config for grub this issue will be resolved.

Chriscrof 05-20-2010 01:48 PM

Thanks for the information, grail. I have just one more question: in my /boot folder there are two sets of four files. One set ends in -2.6.32-21-generic and the other ends in -2.6.32-22-generic. The four files in each set are abi- config- and vmlinuz-. Should I delete all four files in the set ending with 2.6.32-21?

This is probably a very naive question but grub2 seems to have very steep learning curve especially when one is not a programmer

grail 05-20-2010 06:50 PM

Correct that all files with the same kernel version numbering should be removed

syg00 05-20-2010 08:21 PM

Better to remove them from Synaptic - this deletes all dependent files and updates. Updates the grub automagically.

grail 05-20-2010 08:35 PM

syg00 is correct, my bad didn't look at which distro :(

Chriscrof 05-21-2010 01:41 PM

Hi, thank you all for your help it was greatly appreciated. Everything is now resolved so with help like that it won't be long before I'll be able to wipe Windows from my hard disc!

vigi 05-21-2010 02:00 PM

Another way may be to rename or move the unused kernel files, and run update-grub (so you still have a backup kernel).

cr4321 07-15-2010 01:14 AM

Hi Chriscrof and others,

I have a similar problem which I am living with - due to lack of programming skills. The above exchanges give a reasonably good idea, but there are gaps which I am not able to understand.

It would be a extremely helpful if you can give a step by stem approach on this - from problem to resolution.

Hope to gain some experience by that!

Best wishes.


All times are GMT -5. The time now is 01:59 AM.