LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware
User Name
Password
Slackware This Forum is for the discussion of Slackware Linux.

Notices


Reply
  Search this Thread
Old 12-15-2016, 05:06 PM   #1
frushiyama
Member
 
Registered: Oct 2010
Location: Brazil, SP - Cosmópolis
Distribution: Slackware
Posts: 171

Rep: Reputation: 40
GRUB_SAVEDEFAULT option not working


I am trying to use this option on grub2 and it does not goes to the latest boot option.
From manual:
Quote:
‘GRUB_DEFAULT’
The default menu entry. This may be a number, in which case it identifies the Nth entry in the generated menu counted from zero, or the title of a menu entry, or the special string ‘saved’. Using the title may be useful if you want to set a menu entry as the default even though there may be a variable number of entries before it.

For example, if you have:

menuentry 'Example GNU/Linux distribution' --class gnu-linux {
...
}
then you can make this the default using:

GRUB_DEFAULT='Example GNU/Linux distribution'
If you set this to ‘saved’, then the default menu entry will be that saved by ‘GRUB_SAVEDEFAULT’, grub-set-default, or grub-reboot.

The default is ‘0’.

‘GRUB_SAVEDEFAULT’
If this option is set to ‘true’, then, when an entry is selected, save it as a new default entry for use by future runs of GRUB. This is only useful if ‘GRUB_DEFAULT=saved’; it is a separate option because ‘GRUB_DEFAULT=saved’ is useful without this option, in conjunction with grub-set-default or grub-reboot. Unset by default. This option relies on the environment block, which may not be available in all situations (see Environment block).
Source: https://www.gnu.org/software/grub/ma...-configuration

I have Slackware64_current plus multilib installed and updated using grub2, with dual boot with W10 made with aid with this post.

Is there a way to debug how the grub2 is doing the boot?
I am sending my /etc/default/grub in attach.
Attached Files
File Type: txt grub.txt (952 Bytes, 147 views)

Last edited by frushiyama; 12-15-2016 at 05:12 PM.
 
Old 12-15-2016, 05:13 PM   #2
Hangaber
Member
 
Registered: Sep 2004
Location: USA
Distribution: Slackware
Posts: 163

Rep: Reputation: 51
I turned the 'saved' feature off a few months ago, but it was working for me.
Do you have a 'grubenv' file, such as "/boot/grub/grubenv"?
If not;
Code:
grub-editenv /boot/grub/grubenv create
 
1 members found this post helpful.
Old 12-15-2016, 05:19 PM   #3
frushiyama
Member
 
Registered: Oct 2010
Location: Brazil, SP - Cosmópolis
Distribution: Slackware
Posts: 171

Original Poster
Rep: Reputation: 40
Yes i have, here its content:
Code:
# GRUB Environment Block
saved_entry=gnulinux-advanced-08280077-85be-42fa-a690-cce02de1c18b>gnulinux-4.4.32-advanced-08280077-85be-42fa-a690-cce02de1c18b
 
Old 12-15-2016, 05:33 PM   #4
Hangaber
Member
 
Registered: Sep 2004
Location: USA
Distribution: Slackware
Posts: 163

Rep: Reputation: 51
If that was the last used entry, then it looks like the 'savedefault' function worked at least. Looks like a submenu item.
Does that string exist in boot.cfg?

If you select a different option, does the value change? (You may have to boot via another method to check this, so it doesn't get changed again)
 
1 members found this post helpful.
Old 12-15-2016, 06:29 PM   #5
Hangaber
Member
 
Registered: Sep 2004
Location: USA
Distribution: Slackware
Posts: 163

Rep: Reputation: 51
This is now working for me with;
Code:
GRUB_DEFAULT=saved
GRUB_SAVEDEFAULT=true
In grub.cfg for a couple of custom entries, I had to add the 'savedefault' line to the menuentry sections to make it actually update grubenv when selected, as follows;
Code:
menuentry 'Some Other OS' ...blahblah... {
        savedefault
        load_video
(...etc)
Or in my situation, I'll modify my "/etc/grub.d/40_custom" so that it's added during a grub-mkconfig event.

(Unrelated) While I was there, I also fixed the 'locale/en.mo.gz not found' message before the grub menu appears;
Code:
cp /boot/grub/locale/en@quot.mo /boot/grub/locale/en.mo

Last edited by Hangaber; 12-15-2016 at 06:31 PM.
 
1 members found this post helpful.
Old 12-15-2016, 07:47 PM   #6
frushiyama
Member
 
Registered: Oct 2010
Location: Brazil, SP - Cosmópolis
Distribution: Slackware
Posts: 171

Original Poster
Rep: Reputation: 40
The savedefault line on the menuentry part made it work.
Now my /etc/grub.d/40_custom is
Code:
#!/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.

menuentry "W10" {
   savedefault
   set root='(hd0,gpt2)'
   chainloader /EFI/microsoft/Boot/bootmgfw.efi
}

menuentry "SL4C|<W@R3 on /dev/sda6" {
        savedefault
        set root=(hd0,6)
        linux  /boot/vmlinuz-generic-4.4.38 root=/dev/sda6 ro 
        initrd  /boot/initrd.gz
}
Thanks Hangaber!
 
  


Reply

Tags
grub2



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
dhpd and option-82 not working aml81 Linux - Server 0 06-29-2012 04:26 AM
[SOLVED] Boot option not working baliol Linux - Newbie 5 02-16-2011 06:03 PM
[SOLVED] Restart option not working biplabbijay Linux - Newbie 4 04-09-2010 06:18 AM
mount with users option not working.. sjyothi_12 Red Hat 2 11-15-2006 01:07 AM
Option IgnoreEDID not working cs-cam Linux - Newbie 4 02-10-2005 06:19 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware

All times are GMT -5. The time now is 03:15 PM.

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
Open Source Consulting | Domain Registration