The GRUB_SAVEDEFAULT option for grub2 is missing from /etc/defaults/grub [needed for saving last selection as default]

Bug #503935 reported by Michael Lueck on 2010-01-06
This bug affects 4 people
Affects Status Importance Assigned to Milestone
grub (Ubuntu)
Nominated for Lucid by David Clayton

Bug Description

Binary package hint: grub

I started a thread at first, please see:

Discussions went round and round... finally tried viewing the contents of file: "cat (hdX,Y)/boot/grub/grubenv" via the Grub shell and the correct "Windows ..." string was in the file. So the problem I think must be in Grub reading that file and/or selecting the correct partition from the boot menu list.

Since conversation has ceased in the forum, opening a bug report against what we have encountered.

We have loaded several systems with Ubuntu 9.10 dual-boot, want to configure all of them to utilize "saved" last boot choice. Then only way I have found to get a different default than Ubuntu is to force the default to be Windows and that does work.

Michael Lueck (mlueck) on 2010-01-06
description: updated
Michael Lueck (mlueck) wrote :

A view of the grubenv file showing Windows is the OS remembered, yet the top choice of Linux is selected.

Michael Lueck (mlueck) wrote :

Screen capture of Linux being selected even though grubenv has Windows as the last OS

Michael Lueck (mlueck) wrote :

Attached in the /etc/default/grub file, and yes I did issue sudo update-grub after editing it to specify GRUB_DEFAULT=saved

Michael Lueck (mlueck) wrote :

I just now tested this issue against Lucid Alpha 2 and that release works properly. Booting to Windows, rebooting, Windows is then the default grub entry.

Thus I think this only is a bug in Ubuntu 9.10.

Hope that narrows the bug down. Now for getting it squashed! ;-)

David Clayton (dcstar) wrote :

I have a similar bug in 10.04 alpha.

I have "GRUB_DEFAULT=saved" set, run update-grub and can see that my grub.cfg file has been generated to use the default entry, but my grub.env file always contains this:

# GRUB Environment Block
######### (the rest of these deleted)

My system never saves the booted OS entry and therefore always boots the top menu item.

If I change the GRUB_DEFAULT= to a number it will boot that entry correctly.

I just re-tested this issue with the 20100426.1 daily image. Broken even a bit worse than last reported against 9.10.

Today's /boot/grub/grubenv file after just rebooting from Windows shows:

# GRUB Environment Block

So noticeably missing the saved_entry= data

While it was working in earlier Lucid testing, currently it seems broken even worse than 9.10. (shrug)

summary: - Ubuntu 9.10 DEFAULT=saved, Last boot = Windows, Grub comes up defaulting
- to Ubuntu
+ Ubuntu Lucid 10.04 DEFAULT=saved, Last boot = Windows, Grub comes up
+ defaulting to Ubuntu
NickMax (ntorres) wrote :

from: Grub 2 Basics

GRUB_SAVEDEFAULT= - If set to true this setting will automatically set the last selected OS from the menu as the default OS on the next boot. No commands need be run to set the default OS

This way works as advertised

Michael Lueck (mlueck) wrote :

@NickMax #7

Now I have added GRUB_SAVEDEFAULT=1 and put back GRUB_DEFAULT=saved.

Booted to Windows XP, upon reboot it is set to the top Grub menu choice which is Ubuntu.

Really odd that it would take Grub2 TWO entries in order to get it to save the last booted OS choice... and that GRUB_SAVEDEFAULT= does not appear at all in the default configuration file, just commented out. I would have expected it to be there commented out.

Further suggestions please...

David Clayton (dcstar) wrote :

Having to add the GRUB_SAVEDEFAULT= entry to the default config file is just insane.

I have never been able to get the Grub2 saved selection to work because I never had this obvious entry in my config file, silly me for expecting the provided entries - commented out or not - to actually be comprehensive enough to be useful for this BASIC functionality.

Stuff like this is one of the reasons people keep using legacy software and get frustrated when the new "improved" version of something make their life more difficult or just doesn't work.

Huseyin AKIN (huseyinakin) wrote :


add these line and sudo update-grub


Michael Lueck (mlueck) wrote :

@Huseyin AKIN #10: Thanks, those concise steps actually worked. Thus, solution confirmed.

Tested on fully updated 10.04.

A commented "#GRUB_SAVEDEFAULT=true" needs to be in the default config file as this saving of last booted OS will not work otherwise. Insane to expect people to happen to know what to hand key in to make Grub2 work the way Grub used to be able to work WITHOUT needing to know what line to add.

mtu (mtu) on 2010-08-27
summary: - Ubuntu Lucid 10.04 DEFAULT=saved, Last boot = Windows, Grub comes up
- defaulting to Ubuntu
+ The GRUB_SAVEDEFAULT option for grub2 is missing from /etc/defaults/grub
+ [needed for saving last selection as default]
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Duplicates of this bug

Other bug subscribers