'Previously booted entry' option not working in Ubuntu 16.04

Bug #1580012 reported by Ashish Yadav
26
This bug affects 6 people
Affects Status Importance Assigned to Milestone
Grub Customizer
Confirmed
Undecided
Unassigned

Bug Description

I have two dual boot laptops (HP Probook and Asus X200LA) with Ubuntu and Windows. I depended on the 'previously booted entry' option in General settings of Grub-Customizer in previous editions of Ubuntu. However, after upgrade to Ubuntu 16.04, this setting has stopped taking effect and even though the General Settings show that 'Previously booted entry' is selected, it always boots Ubuntu by default which is the first entry in both these laptops. Kindly provide a fix. I'll try to provide all information that you might need.

Revision history for this message
Daniel Richter (danielrichter2007) wrote :

It works well for me…

Paste your /boot/grub/grub.cfg please.

Revision history for this message
Ashish Yadav (dr-ashishyadav) wrote :
Download full text (12.2 KiB)

Here it is:

#
# DO NOT EDIT THIS FILE
#
# It is automatically generated by grub-mkconfig using templates
# from /etc/grub.d and settings from /etc/default/grub
#

### BEGIN /etc/grub.d/00_header ###
if [ -s $prefix/grubenv ]; then
  set have_grubenv=true
  load_env
fi
if [ "${next_entry}" ] ; then
   set default="${next_entry}"
   set next_entry=
   save_env next_entry
   set boot_once=true
else
   set default="${saved_entry}"
fi

if [ x"${feature_menuentry_id}" = xy ]; then
  menuentry_id_option="--id"
else
  menuentry_id_option=""
fi

export menuentry_id_option

if [ "${prev_saved_entry}" ]; then
  set saved_entry="${prev_saved_entry}"
  save_env saved_entry
  set prev_saved_entry=
  save_env prev_saved_entry
  set boot_once=true
fi

function savedefault {
  if [ -z "${boot_once}" ]; then
    saved_entry="${chosen}"
    save_env saved_entry
  fi
}
function recordfail {
  set recordfail=1
  if [ -n "${have_grubenv}" ]; then if [ -z "${boot_once}" ]; then save_env recordfail; fi; fi
}
function load_video {
  if [ x$feature_all_video_module = xy ]; then
    insmod all_video
  else
    insmod efi_gop
    insmod efi_uga
    insmod ieee1275_fb
    insmod vbe
    insmod vga
    insmod video_bochs
    insmod video_cirrus
  fi
}

if [ x$feature_default_font_path = xy ] ; then
   font=unicode
else
insmod part_msdos
insmod ext2
set root='hd0,msdos9'
if [ x$feature_platform_search_hint = xy ]; then
  search --no-floppy --fs-uuid --set=root --hint-bios=hd0,msdos9 --hint-efi=hd0,msdos9 --hint-baremetal=ahci0,msdos9 307a06b6-1861-4091-82c0-36909d647c8f
else
  search --no-floppy --fs-uuid --set=root 307a06b6-1861-4091-82c0-36909d647c8f
fi
    font="/usr/share/grub/unicode.pf2"
fi

if loadfont $font ; then
  set gfxmode=auto
  load_video
  insmod gfxterm
  set locale_dir=$prefix/locale
  set lang=en_IN
  insmod gettext
fi
terminal_output gfxterm
if [ "${recordfail}" = 1 ] ; then
  set timeout=30
else
  if [ x$feature_timeout_style = xy ] ; then
    set timeout_style=menu
    set timeout=10
  # Fallback normal timeout code in case the timeout_style feature is
  # unavailable.
  else
    set timeout=10
  fi
fi
### END /etc/grub.d/00_header ###

### BEGIN /etc/grub.d/05_debian_theme ###
insmod part_msdos
insmod ext2
set root='hd0,msdos8'
if [ x$feature_platform_search_hint = xy ]; then
  search --no-floppy --fs-uuid --set=root --hint-bios=hd0,msdos8 --hint-efi=hd0,msdos8 --hint-baremetal=ahci0,msdos8 b54cdeb3-d0f8-46be-a5c7-fab881752428
else
  search --no-floppy --fs-uuid --set=root b54cdeb3-d0f8-46be-a5c7-fab881752428
fi
insmod jpeg
if background_image /ashish/Pictures/Wallpapers/hp-spider-wall-wallpapers1024x768.jpg; then
  set color_normal=light-blue/black
  set color_highlight=white/black
else
  set menu_color_normal=white/black
  set menu_color_highlight=black/light-gray
  if background_color 44,0,30,0; then
    clear
  fi
fi
### END /etc/grub.d/05_debian_theme ###

### BEGIN /etc/grub.d/10_linux ###
function gfxmode {
 set gfxpayload="${1}"
 if [ "${1}" = "keep" ]; then
  set vt_handoff=vt.handoff=7
 else
  set vt_handoff=
 fi
}
if [ "${recordfail}" != 1 ]; then
  if [ -e ${prefix}/gfxblacklist.txt ]; then
    if hwmatch ${prefix}/gfxblacklist.txt 3; ...

Revision history for this message
Daniel Richter (danielrichter2007) wrote :

Your windows 10 menuentry, which is manually modified, has no "savedefault" call. Just add the line "savedefault" at the top of this menuentry.

Revision history for this message
Ashish Yadav (dr-ashishyadav) wrote :

Thanks a lot for the suggestion. It works all right now.

However, I did not modify Windows 10 menuentry manually being not knowledgeable in this. I did, however, change the name of the menuentry via grub-customizer and no more. Why was 'savedefault' not added by grub-customizer on choosing the option of 'previously booted entry' should still be assessed I suppose.

Now my menuentry (after manual modification), looks as under and works perfectly.

menuentry "Windows 10" --class windows --class os $menuentry_id_option 'osprober-chain-26F20FADF20F8073' {
 savedefault
 insmod part_msdos
 insmod ntfs
 set root='hd0,msdos1'
        ...
        ...

I assume the same problem bugs my other laptop which has Ubuntu 16.04 and Win7. I shall make changes in grub.cfg there also. Thanks a lot for your help.

Revision history for this message
Tomasz Przybysz (topr) wrote :

I'm facing the same exact issue on 16.04 for both: Windows and Ubuntu entries. I've edited the names as Ashish did.

Manually adding savedafeault helped.

Revision history for this message
Krister Swenson (thekswenson) wrote :

Still a problem in 17.10.

Changed in grub-customizer:
status: New → Confirmed
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.