GRUB Dual Boot SAVEDEFAULT fails with wonky workaround

More
02 Feb 2024 20:16 - 02 Feb 2024 20:37 #292243 by y2kdeuce
Hello,

I'm a total Linux NOOB. I picked up some old Dell's with parallel ports from a school closing. My plan was to run Windows and Mach 3, and sell off the extras for the same purpose.  Some folks suggested these boxes would also be good for LinuxCNC so I thought I'd dip my toe in here to test the waters.  To that end, I set up Windows 7 Pro first leaving an unused partition to install Linux CNC.  

I grabbed the default debian .iso from the LinuxCNC download page and followed the bouncing ball.  All went well. At boot, GRUB fires up and allows m to select the OS I want to boot into. Great!   Now I want my selection to be sticky.  If I select Windows, I want it to select it every time by default. 

The way to accomplish this is supposed to be to set:

GRUB_SAVEDEFAULT=true
GRUB_DEFAULT=saved
in /etc/default/grub
and run: 
sudo update-grub
to apply to /boot/grub/grub.cfg.

Did all that but the default doesn't isn't sticky.  

Looking at /boot/grub/grubenv the current linux entry is there.
Looking at /boot/grub/grub.cfg I see a function savedefault but nothing calls it.

Workaround was to copy the three menuentries from 
/boot/grub/grub.cfg
into
/etc/grub.d/40_custom
adding: savedefault as the first menu item

this addition calls the savedefault function when a menuentry is selected that seems to not be called otherwise. 
WHY DO I NEED TO DO ALL THIS?

btw, I also had to block GRUB from calling the files that create the menuentries by setting permissions.  Adding a .bak extention was not sufficient 
sudu chmod -x /etc/grub.d/10_linux
sudu chmod -x /etc/grub.d/20_linux_xen
sudu chmod -x /etc/grub.d/30_otheros

This is my welcome to Linux.  lol
Last edit: 02 Feb 2024 20:37 by y2kdeuce.

Please Log in or Create an account to join the conversation.

More
02 Feb 2024 20:30 #292246 by tommylight
Not your fault, internet is full of useless howtos.
I am a bit fuzzy on this, but there should be a line in /etc/default/grub containing something like default choice = 1
That should be changed to whatever you want set as default, look for entry numbers below where the list starts.
Then sudo update-grub

Please Log in or Create an account to join the conversation.

More
02 Feb 2024 20:38 #292247 by y2kdeuce
if you set GRUB_DEFAULT= to a number it will default to that number. This workaround will set the default to whatever was used last.
The following user(s) said Thank You: tommylight

Please Log in or Create an account to join the conversation.

More
04 Feb 2024 02:14 #292351 by rodw
You don't need to do all this the hard way.  the Linuxcnc 2.9.x ISOs have grub-customizer installd
Just type: sudo grub-customizer
Then you can edit your grub menu in a nice drag and drop environment. I usually set it to boot the first entry and set the kernels I want to use under it, then put the rest under a menu entry.

Note that with the later EFI hardware, selecting between Windows and Linux is done at a BIOS Level (on my HP, F9 brings up the boot menu to select between Windows and Grub).

Please Log in or Create an account to join the conversation.

Time to create page: 0.081 seconds
Powered by Kunena Forum