• Grub menu contains entries with the same $menuentry_id_option


    I’m using 2 kernels for Antergos.
    LTS and the latest one.
    I need default to be set to LTS kernel in grub so I went and changed settings to save latest selected menu option.
    Latest kernel goes first and other boot option after it.
    After rebooting and selecting LTS kernel I rebooted againg to check that selected grub option was saved correctly but was surprised by fact that it was loaded to latest kernel instead LTS.
    So I started digging around grub.cfg and grub_env files and noticed that grub saves selected option by $menuentry_id_option from grub.cfg. When I looked for this option in each menuentry in my grub.cfg I found that all option has the same $menuentry_id_option and as they all equals grub selected first found(in my case it is latest kernel).
    I don’t want to use direct default option set in /etc/default/grub I want it to remember my last choice during boot as I might want later to use some other boot option.
    Isn’t it supposed for each menuentry to have unique $menuentry_id_option?

  • @TaurohtaR
    In file /etc/default/grub, you can set two options:

    GRUB_DEFAULT=saved
    GRUB_SAVEDEFAULT="true"
    

    Then you can write a new file /boot/grub/custom.cfg:

    menuentry "Antergos LTS" {
      savedefault
      linux  /boot/vmlinuz-linux-lts root=LABEL=Antergos rw quiet splash
      initrd /boot/initramfs-linux-lts.img
    }
    menuentry "Antergos" {
      savedefault
      linux  /boot/vmlinuz-linux root=LABEL=Antergos rw quiet splash
      initrd /boot/initramfs-linux.img
    }
    

    assuming the LABEL of your Antergos partition is ‘Antergos’.
    Finally, run command

    grub-mkconfig -o /boot/grub/grub.cfg
    

    and reboot.

  • @manuel
    Thanks.
    Didn’t know about custom configs for GRUB.
    What I did is modification of /etc/grub.d/10_antergos file and added generated title to $menuentry_id_option line.

  • @TaurohtaR
    I’d recommend against modifying files in /etc/grub.d, since they may be updated by the Antergos team. On the other hand, using /boot/grub/custom.cfg is safe, as Antergos team will not change it.

contains1 entries1 menu24 grub76 Posts 4Views 130
Log in to reply