9

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.

2
  • You're using 0-based numbering for disk partitions -- that doesn't look like GRUB2, that looks like Legacy GRUB.
    – ephemient
    Jan 14, 2010 at 15:34
  • if you have a working /boot/grub/menu.lst you are not using Grub2. Grub2 uses /boot/grub/grub.cfg. you may see both configuration files if you've updated to Grub2 from an older installation that used Grub1. Feb 10, 2010 at 15:45

2 Answers 2

22

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.

1
  • One detail is that at least on Ubuntu, the memtest entries won't be saved incase you decide to try them to test the feature quickly...
    – Pricey
    Jan 15, 2018 at 20:21
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.

5
  • I would put the savedefault command first, as it is unclear to me wether chainloader or kernel calls exit the boot loader immediately..
    – ypnos
    Jan 14, 2010 at 12:42
  • I use 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 checked that grub-intall and grub-set-default commands are not working.
    – baltusaj
    Jan 14, 2010 at 14:23
  • See also my edit. You shouldn't give savedefault a number.
    – Thomas
    Jan 14, 2010 at 15:33
  • the syntax is savedefault N not savedefault=N (again, if you want it to save another entry as the default -- if you want current entry, leave N off). Jan 14, 2010 at 17:58
  • +1 cuz it worked for me (though the OP did ask about grub2)
    – nhed
    Apr 17, 2013 at 17:08

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .