grub won't recall last OS used

Status
Not open for further replies.

anneranch

Active Member
Joined
Mar 16, 2019
Messages
223
Reaction score
43
Credits
2,078
There is an option in grub to remeber last OS used - obviously on multiform / multi OS system


# If you change this file, run 'update-grub' afterwards to update
# /boot/grub/grub.cfg.
# For full documentation of the options in this file, see:
# info -f grub -n 'Simple configuration'

GRUB_DEFAULT=0
GRUB_TIMEOUT_STYLE=hidden
GRUB_TIMEOUT=10
GRUB_DISTRIBUTOR=`lsb_release -i -s 2> /dev/null || echo Debian`
#GRUB_CMDLINE_LINUX_DEFAULT="quiet splash"
GRUB_CMDLINE_LINUX=""
GRUB_DEFAULT=saved
GRUB_SAVEDEFAULT=true



it does not work on Ubuntu 21.04
Any remedy - applicable to 21.04 ?
 


It does work on Ubuntu 21.04, I have it set up that way.

After changing /etc/default/grub, did you remember to update grub, and then reboot?

sudo update-grub

Cheers

Wizard
 
It does work on Ubuntu 21.04, I have it set up that way.

After changing /etc/default/grub, did you remember to update grub, and then reboot?

sudo update-grub

Cheers

Wizard

YES

And it is run on most Ubuntu update/ upgrade too.
 
Your fault lies in the first line of your file /etc/default/grub.

You have two instances of lines beginning with

GRUB_DEFAULT=

The first with zero, the second bolded with saved

Grub reads and acts on the first and ignores the second.

You should have simply changed the first line to end with zero.

So either edit the first instance to show saved, or comment out the second with a #

Then run

sudo update-grub

and reboot and it will work.

Please report back with the outcome.

Wizard
 
@anneranch it has been 3 and a half days since I posted the above.

Perhaps you could tell us whether the method proposed worked, in which case you can mark this Thread as solved, or else let us know otherwise in case you need more assistance.

Thanks.

Wizard
 
I have changed /etc/default/grub to have ONE pair of lines

GRUB_DEFAULT=saved
GRUB_SAVEDEFAULT=true


Still no go.
I puled out cat /boot/grub/grub.cfg ....
I have several Linux OS on my system - the one in use currently is in /dev/sde11

The grub.cfg DOES NOT contain ANY entry /dev/sde11 !

I understand "sdxyz" device designation is not set in stone and can change after each boot...

My boot grub menu ALWAYS contains "sde11" and when selected it boots and runs my system
as expected.

Since I disabled "flash" in grub I can observe boot process "on the fly" and it always identifies /dev/sde11.

So it appears that missing /dev/sde11 in grub.cfg MAY be the problem-

how can it process "saved last entry " if it is not there ? .
 
I'll look into this a little more and try to get back to you soon

Wizard
 
After going thru the entire cfg file I noticed it does not match the /dev in grub menu in many instances.
I have been thru "multiboot process" many times and NOBODY actually confirmed how it works when several Linux OS's are spread over more than ONE had drive.

I have "grub" files all over the place - ( almost ) each HDD contains one and the only way I can guess which one is actually used / run is to activate the "flash" again.

PS I have somting set wrong - I am not getting new posts notification - that partially explains my slow / erratic response here. Sorry.
 
That's OK, if it persists and you cannot find the answer in your Profile/Account settings, start a Thread in Forum Assistance and a couple of us will try to help. :)

I have several Linux OS on my system - the one in use currently is in /dev/sde11

The grub.cfg DOES NOT contain ANY entry /dev/sde11 !

... and it won't. It will not show the details of the root partition you are currently on, under the /dev/sdxyz protocol, but it WILL show it in other references. Similarly, if you run, in your circumstances, from /dev/sde11

sudo update-grub

watch closely and you will see it output the details on all your other distros' root partitions, but not that on /dev/sde11.

You will find that occurs too, in the other distros.

The only distro I have come across so far that includes its own root partition in the update-grub output is, I think PCLOS (PC Linux OS).

I said

but it WILL show it in other references

If you run the command

Code:
sudo blkid | grep -i "/dev/sde11"

you will get a line of output which includes a UUID.

If you take that UUID and insert it in this fashion

Code:
grep -i <UUID here> /boot/grub/cfg

you will have output to you of the references for /dev/sde11 in your grub.cfg

An example from the Arcolinux (Arch-based distro) I am writing from is as follows in the Spoiler (click to open it, click to close)

Code:
[chris@Arcolinux-Xfce-HDD ~]$ sudo blkid | grep -i "/dev/sda11"

[sudo] password for chris:

/dev/sda11: LABEL="ArcolinuxXfceHDD" UUID="ba05f70e-1562-4063-a63a-19c946b74278" BLOCK_SIZE="4096" TYPE="ext4" PARTUUID="be0a83e7-42c9-43f8-a0d0-77671072df18"

[chris@Arcolinux-Xfce-HDD ~]$ grep -i ba05f70e-1562-4063-a63a-19c946b74278 /boot/grub/grub.cfg

grep: /boot/grub/grub.cfg: Permission denied

[chris@Arcolinux-Xfce-HDD ~]$ sudo grep -i ba05f70e-1562-4063-a63a-19c946b74278 /boot/grub/grub.cfg

  search --no-floppy --fs-uuid --set=root --hint-bios=hd0,gpt11 --hint-efi=hd0,gpt11 --hint-baremetal=ahci0,gpt11  ba05f70e-1562-4063-a63a-19c946b74278

  search --no-floppy --fs-uuid --set=root ba05f70e-1562-4063-a63a-19c946b74278

  search --no-floppy --fs-uuid --set=root --hint-bios=hd0,gpt11 --hint-efi=hd0,gpt11 --hint-baremetal=ahci0,gpt11  ba05f70e-1562-4063-a63a-19c946b74278

  search --no-floppy --fs-uuid --set=root ba05f70e-1562-4063-a63a-19c946b74278

menuentry 'ArcoLinux Linux' --class arcolinux --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-simple-ba05f70e-1562-4063-a63a-19c946b74278' {

      search --no-floppy --fs-uuid --set=root --hint-bios=hd0,gpt11 --hint-efi=hd0,gpt11 --hint-baremetal=ahci0,gpt11  ba05f70e-1562-4063-a63a-19c946b74278

      search --no-floppy --fs-uuid --set=root ba05f70e-1562-4063-a63a-19c946b74278

    linux    /boot/vmlinuz-linux root=UUID=ba05f70e-1562-4063-a63a-19c946b74278 rw  noquiet nosplash root=UUID=ba05f70e-1562-4063-a63a-19c946b74278

submenu 'Advanced options for ArcoLinux Linux' $menuentry_id_option 'gnulinux-advanced-ba05f70e-1562-4063-a63a-19c946b74278' {

    menuentry 'ArcoLinux Linux, with Linux linux' --class arcolinux --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-linux-advanced-ba05f70e-1562-4063-a63a-19c946b74278' {

          search --no-floppy --fs-uuid --set=root --hint-bios=hd0,gpt11 --hint-efi=hd0,gpt11 --hint-baremetal=ahci0,gpt11  ba05f70e-1562-4063-a63a-19c946b74278

          search --no-floppy --fs-uuid --set=root ba05f70e-1562-4063-a63a-19c946b74278

        linux    /boot/vmlinuz-linux root=UUID=ba05f70e-1562-4063-a63a-19c946b74278 rw  noquiet nosplash root=UUID=ba05f70e-1562-4063-a63a-19c946b74278

    menuentry 'ArcoLinux Linux, with Linux linux (fallback initramfs)' --class arcolinux --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-linux-fallback-ba05f70e-1562-4063-a63a-19c946b74278' {

          search --no-floppy --fs-uuid --set=root --hint-bios=hd0,gpt11 --hint-efi=hd0,gpt11 --hint-baremetal=ahci0,gpt11  ba05f70e-1562-4063-a63a-19c946b74278

          search --no-floppy --fs-uuid --set=root ba05f70e-1562-4063-a63a-19c946b74278

        linux    /boot/vmlinuz-linux root=UUID=ba05f70e-1562-4063-a63a-19c946b74278 rw  noquiet nosplash root=UUID=ba05f70e-1562-4063-a63a-19c946b74278

        search --fs-uuid --no-floppy --set=root --hint-bios=hd0,gpt11 --hint-efi=hd0,gpt11 --hint-baremetal=ahci0,gpt11  ba05f70e-1562-4063-a63a-19c946b74278

That grepping requires sudo usage in some distros.

In that output, you will see a number of references to

hd0,gpt11

That is my /dev/sda11

The hd is for hard drive, and it starts from zero. I have a hard drive and an SSD in this Dell Inspiron, and it is always hooked in with a Western Digital 4 TB powered external HDD.

So my HDD, /dev/sda is referenced as hd0, the SSD /dev/sdb as hd1 and the WD /dev/sdc as hd2.

I am using UEFI-GPT so hd0,gpt11 is /dev/sda11

If you are on BIOS-MBR it might be something like hd0.msdos11

I will get back over my weekend with more, I hope.

Avagudweegend all

Wizard
 
Status
Not open for further replies.

Members online


Top