SlackwareThis Forum is for the discussion of Slackware Linux.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
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).
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)
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;
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
}
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.