LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 01-19-2017, 09:35 PM   #1
wingman358
Member
 
Registered: Mar 2008
Location: Northeast US
Distribution: Mint, Ubuntu, Backtrack
Posts: 77

Rep: Reputation: 16
Mint 18.1 Serena - Grub doesn't remember last selected despite settings


I'm trying to get grub to remember the last booted item in the list. I keep booting the third item but each restart, the selection in grub goes back to the first item in the list.

Here's what I tried:

Code:
$ sudo cp /etc/default/grub /etc/default/grub.bkup
$ cd /etc/default/
$ sudo nano grub
Changed the GRUB_DEFAULT from "0" to "saved" and added the line "GRUB_SAVEDEFAULT=true":

Code:
GRUB_DEFAULT=saved
GRUB_SAVEDEFAULT=true
Then updated:

Code:
$ sudo update-grub
But no luck. Any tips?
 
Old 01-19-2017, 09:59 PM   #2
Ztcoracat
LQ Guru
 
Registered: Dec 2011
Distribution: Slackware, MX 18
Posts: 9,484
Blog Entries: 15

Rep: Reputation: 1162Reputation: 1162Reputation: 1162Reputation: 1162Reputation: 1162Reputation: 1162Reputation: 1162Reputation: 1162Reputation: 1162
It depends on what distribution in your Grub Menu you want your system to boot to each time you fire up your pc.

I'll use my system as an example.
I have 2 entries in my Grub Menu Slackware, Voyager/Xubuntu, and Memtest.

Code:
Xubuntu 14.04 on /dev/sdb1
Advanced Options for Xubuntu 14.04
Memtest 64
Slackware64 14.2 on /dev/sda1
Advanced Options for Slackware64
Since Slackware is the 3rd entry in the Menu I changed that in the /etc/default/grub with:
Code:
GRUB_DEFAULT=3
Note that the first distribution in the list is 0 and Advanced Option for Xubuntu 14.04 is 1.

Depending on how many distro's you have in your Grub Menu it's as easy as changing the # in the list.
 
Old 01-19-2017, 10:15 PM   #3
Ztcoracat
LQ Guru
 
Registered: Dec 2011
Distribution: Slackware, MX 18
Posts: 9,484
Blog Entries: 15

Rep: Reputation: 1162Reputation: 1162Reputation: 1162Reputation: 1162Reputation: 1162Reputation: 1162Reputation: 1162Reputation: 1162Reputation: 1162
You said you want Grub to remember the last item booted but you forgot to post your Grub Menu.
 
Old 01-19-2017, 11:19 PM   #4
wingman358
Member
 
Registered: Mar 2008
Location: Northeast US
Distribution: Mint, Ubuntu, Backtrack
Posts: 77

Original Poster
Rep: Reputation: 16
Quote:
Originally Posted by Ztcoracat View Post
You said you want Grub to remember the last item booted but you forgot to post your Grub Menu.
What does it matter? Not trying to be a dick, I just don't see how that would affect the behavior I'm after.

Also, I don't want it to default to a specific item number, I want it to default to the last booted item which is an entirely separate function.

Last edited by wingman358; 01-19-2017 at 11:21 PM.
 
Old 01-20-2017, 01:40 AM   #5
hydrurga
LQ Guru
 
Registered: Nov 2008
Location: Pictland
Distribution: Linux Mint 19.1 MATE
Posts: 8,016
Blog Entries: 5

Rep: Reputation: 2862Reputation: 2862Reputation: 2862Reputation: 2862Reputation: 2862Reputation: 2862Reputation: 2862Reputation: 2862Reputation: 2862Reputation: 2862Reputation: 2862
Is the menu option in question a custom grub option (e.g. added in /etc/grub.d/40_custom)?
 
Old 01-20-2017, 07:05 AM   #6
yancek
LQ Guru
 
Registered: Apr 2008
Distribution: PCLinux, Slackware
Posts: 8,608

Rep: Reputation: 1772Reputation: 1772Reputation: 1772Reputation: 1772Reputation: 1772Reputation: 1772Reputation: 1772Reputation: 1772Reputation: 1772Reputation: 1772Reputation: 1772
The options you are showing look correct. If this is a custom entry as asked above, you need savedefault in the menuentry. See the link below for an example.

http://askubuntu.com/questions/14866...er-last-choice
 
Old 01-23-2017, 04:44 PM   #7
wingman358
Member
 
Registered: Mar 2008
Location: Northeast US
Distribution: Mint, Ubuntu, Backtrack
Posts: 77

Original Poster
Rep: Reputation: 16
Quote:
Originally Posted by hydrurga View Post
Is the menu option in question a custom grub option (e.g. added in /etc/grub.d/40_custom)?
No and here's my 40_custom:

Code:
$ cat /etc/grub.d/40_custom
#!/bin/sh
exec tail -n +3 $0
# This file provides an easy way to add custom menu entries.  Simply type the
# menu entries you want to add after this comment.  Be careful not to change
# the 'exec tail' line above.

Quote:
Originally Posted by yancek View Post
The options you are showing look correct. If this is a custom entry as asked above, you need savedefault in the menuentry. See the link below for an example.

http://askubuntu.com/questions/14866...er-last-choice
The thread you linked to is what I used to make the changes mentioned in my first post.

While my /etc/grub.d/40_custom file is empty, I did notice the grub cfg file has "savedefault" for every menu item, so I don't think that's the issue:

Code:
$ cat /boot/grub/grub.cfg | egrep -B 3 -A 3 savedefault
  set boot_once=true
fi

function savedefault {
  if [ -z "${boot_once}" ]; then
    saved_entry="${chosen}"
    save_env saved_entry
--
export linux_gfx_mode
menuentry 'Linux Mint 18.1 Cinnamon 64-bit' --class ubuntu --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-simple-7cc8e767-6d42-45ce-8e30-0a185be17fe8' {
	recordfail
	savedefault
	load_video
	gfxmode $linux_gfx_mode
	insmod gzio
--
submenu 'Advanced options for Linux Mint 18.1 Cinnamon 64-bit' $menuentry_id_option 'gnulinux-advanced-7cc8e767-6d42-45ce-8e30-0a185be17fe8' {
	menuentry 'Linux Mint 18.1 Cinnamon 64-bit, with Linux 4.4.0-34-generic' --class ubuntu --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-4.4.0-34-generic-advanced-7cc8e767-6d42-45ce-8e30-0a185be17fe8' {
		recordfail
	savedefault
		load_video
		gfxmode $linux_gfx_mode
		insmod gzio
--
	}
	menuentry 'Linux Mint 18.1 Cinnamon 64-bit, with Linux 4.4.0-34-generic (upstart)' --class ubuntu --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-4.4.0-34-generic-init-upstart-7cc8e767-6d42-45ce-8e30-0a185be17fe8' {
		recordfail
	savedefault
		load_video
		gfxmode $linux_gfx_mode
		insmod gzio
--
	}
	menuentry 'Linux Mint 18.1 Cinnamon 64-bit, with Linux 4.4.0-21-generic' --class ubuntu --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-4.4.0-21-generic-advanced-7cc8e767-6d42-45ce-8e30-0a185be17fe8' {
		recordfail
	savedefault
		load_video
		gfxmode $linux_gfx_mode
		insmod gzio
--
	}
	menuentry 'Linux Mint 18.1 Cinnamon 64-bit, with Linux 4.4.0-21-generic (upstart)' --class ubuntu --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-4.4.0-21-generic-init-upstart-7cc8e767-6d42-45ce-8e30-0a185be17fe8' {
		recordfail
	savedefault
		load_video
		gfxmode $linux_gfx_mode
		insmod gzio
--

### BEGIN /etc/grub.d/30_os-prober ###
menuentry 'Linux Mint 18 Sarah (18) (on /dev/sda2)' --class gnu-linux --class gnu --class os $menuentry_id_option 'osprober-gnulinux-simple-abb53aad-9c48-4a8c-8adb-c5ea6b31a147' {
	savedefault
	insmod part_gpt
	insmod ext2
	set root='hd0,gpt2'
--
}
submenu 'Advanced options for Linux Mint 18 Sarah (18) (on /dev/sda2)' $menuentry_id_option 'osprober-gnulinux-advanced-abb53aad-9c48-4a8c-8adb-c5ea6b31a147' {
	menuentry 'Linux Mint 18 Cinnamon 64-bit (on /dev/sda2)' --class gnu-linux --class gnu --class os $menuentry_id_option 'osprober-gnulinux-/boot/vmlinuz-4.4.0-45-generic--abb53aad-9c48-4a8c-8adb-c5ea6b31a147' {
		savedefault
		insmod part_gpt
		insmod ext2
		set root='hd0,gpt2'
--
		initrd /boot/initrd.img-4.4.0-45-generic
	}
	menuentry 'Linux Mint 18 Cinnamon 64-bit, with Linux 4.4.0-45-generic (on /dev/sda2)' --class gnu-linux --class gnu --class os $menuentry_id_option 'osprober-gnulinux-/boot/vmlinuz-4.4.0-45-generic--abb53aad-9c48-4a8c-8adb-c5ea6b31a147' {
		savedefault
		insmod part_gpt
		insmod ext2
		set root='hd0,gpt2'
--
		initrd /boot/initrd.img-4.4.0-45-generic
	}
	menuentry 'Linux Mint 18 Cinnamon 64-bit, with Linux 4.4.0-45-generic (upstart) (on /dev/sda2)' --class gnu-linux --class gnu --class os $menuentry_id_option 'osprober-gnulinux-/boot/vmlinuz-4.4.0-45-generic--abb53aad-9c48-4a8c-8adb-c5ea6b31a147' {
		savedefault
		insmod part_gpt
		insmod ext2
		set root='hd0,gpt2'
--
		initrd /boot/initrd.img-4.4.0-45-generic
	}
	menuentry 'Linux Mint 18 Cinnamon 64-bit, with Linux 4.4.0-45-generic (recovery mode) (on /dev/sda2)' --class gnu-linux --class gnu --class os $menuentry_id_option 'osprober-gnulinux-/boot/vmlinuz-4.4.0-45-generic-root=UUID=abb53aad-9c48-4a8c-8adb-c5ea6b31a147 ro recovery nomodeset-abb53aad-9c48-4a8c-8adb-c5ea6b31a147' {
		savedefault
		insmod part_gpt
		insmod ext2
		set root='hd0,gpt2'
--
		initrd /boot/initrd.img-4.4.0-45-generic
	}
	menuentry 'Linux Mint 18 Cinnamon 64-bit, with Linux 4.4.0-21-generic (on /dev/sda2)' --class gnu-linux --class gnu --class os $menuentry_id_option 'osprober-gnulinux-/boot/vmlinuz-4.4.0-21-generic--abb53aad-9c48-4a8c-8adb-c5ea6b31a147' {
		savedefault
		insmod part_gpt
		insmod ext2
		set root='hd0,gpt2'
--
		initrd /boot/initrd.img-4.4.0-21-generic
	}
	menuentry 'Linux Mint 18 Cinnamon 64-bit, with Linux 4.4.0-21-generic (upstart) (on /dev/sda2)' --class gnu-linux --class gnu --class os $menuentry_id_option 'osprober-gnulinux-/boot/vmlinuz-4.4.0-21-generic--abb53aad-9c48-4a8c-8adb-c5ea6b31a147' {
		savedefault
		insmod part_gpt
		insmod ext2
		set root='hd0,gpt2'
--
		initrd /boot/initrd.img-4.4.0-21-generic
	}
	menuentry 'Linux Mint 18 Cinnamon 64-bit, with Linux 4.4.0-21-generic (recovery mode) (on /dev/sda2)' --class gnu-linux --class gnu --class os $menuentry_id_option 'osprober-gnulinux-/boot/vmlinuz-4.4.0-21-generic-root=UUID=abb53aad-9c48-4a8c-8adb-c5ea6b31a147 ro recovery nomodeset-abb53aad-9c48-4a8c-8adb-c5ea6b31a147' {
		savedefault
		insmod part_gpt
		insmod ext2
		set root='hd0,gpt2'
--
}

menuentry 'Windows Boot Manager (on /dev/sdc2)' --class windows --class os $menuentry_id_option 'osprober-efi-4A8B-30C0' {
	savedefault
	insmod part_gpt
	insmod fat
	set root='hd2,gpt2'
Could this be related to UEFI or an SSD at all?

Last edited by wingman358; 01-23-2017 at 04:46 PM.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
LXer: How to Set Grub to Remember Your Last Selected Entry LXer Syndicated Linux News 0 12-20-2016 01:30 AM
grub F16 doesn't allow the grub default to be selected landonmkelsey Linux - Software 3 01-12-2012 07:08 PM
GRUB doesn't remember my last selection zorro_kwh SUSE / openSUSE 5 07-10-2011 06:42 AM
[SOLVED] Debian doesn't remember DNS settings qrange Linux - Networking 5 05-05-2011 02:58 AM
KDE doesn't remember sound settings DaFrEQ Linux - Software 4 10-17-2004 08:34 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 11:18 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration