Making "default saved" work with GRUB2...?

I just installed Moblin Operating System. It's using GRUB2. On my Ubuntu 8.04 GRUB 0.97 was being used in which i was using the default saved option comfortably. I found that with GRUB2 i should not edit /boot/grub/menu.lst directly but I did :) because my Moblin does not contain any /etc/default/grub where they say I should do the modification I want.

So what I did is as following which did not work:

default=saved
timeout=1
#splashimage=(hd0,0)/boot/grub/splash.xpm.gz
#hiddenmenu
#silent
title Moblin (2.6.31.5-10.1.moblin2-netbook)
        root (hd0,0)
        kernel /boot/vmlinuz-2.6.31.5-10.1.moblin2-netbook ro root=/dev/sda1 vga=current
        savedefault=1

title Pathetic Windows
        rootnoverify (hd0,1)
        chainloader +1
        savedefault=0

By doing so I should have automatically switch between Moblin and Window at each boot but it's not working.

Almost all the troubleshooters on internet are saying that I should enable the DEFAULT=save option in /etc/default/grub but I am unable to find this file. Any idea what else should I do?

Thanks a lot

Update:

I used the equal to sign because by default my menu.lst had an entry as default=0. However, default 0, is also working fine.

Moreover the menu.lst, i have is actually a symbolic link to ./grub.conf. I have also noticed that grub-intall and grub-set-default commands are not working.


Solution 1:

The correct syntax for enabling savedefault in /etc/default/grub (GRUB 2) is with the lines:

GRUB_DEFAULT=saved
GRUB_SAVEDEFAULT=true

and not with the line DEFAULT=save that the enquirer suggested.

After adding the two lines above to /etc/default/grub, one has to update GRUB's configuration, as a superuser, with the following commands:

grub-mkconfig
update-grub

At least on Lubuntu 12.10, grub-mkconfig is not needed (as it, without options, dumps the config file to stdout). The only needed command is update-grub which actually invokes grub-mkconfig with the proper -o file option.

Solution 2:

I'm not sure if GRUB allows the = sign; my configuration reads default saved.

Your problem is that the Pathetic Windows entry does not do a savedefault, so the default entry is never changed to Windows.

Edit: Furthermore, savedefault by default saves the current entry; only if you give it a number will it save another entry than the current one.

Try this:

default saved
timeout 1
#splashimage (hd0,0)/boot/grub/splash.xpm.gz
#hiddenmenu
#silent
title Moblin (2.6.31.5-10.1.moblin2-netbook)
        root (hd0,0)
        kernel /boot/vmlinuz-2.6.31.5-10.1.moblin2-netbook ro root=/dev/sda1 vga=current
        savedefault

title Pathetic Windows
        rootnoverify (hd0,1)
        chainloader +1
        savedefault

I don't know Moblin but in other distributions it is common to have the configuration file somewhere in /boot/grub, not in /etc.