You are not logged in.

#1 2017-04-17 20:01:45

cal22
Member
Registered: 2017-02-01
Posts: 3

Having trouble setting the default kernel for GRUB

I have both linux and linux-lts installed, and GRUB seems determined to boot into the latter. At first I edited /etc/default/grub to set

GRUB_DEFAULT="Advanced options for Arch Linux>Arch Linux, with Linux linux"

however after running grub-mkconfig and restarting this had no effect. I thought the fact that I was specifying an option within the "Advanced options" submenu might be needlessly complicating things, so I added

GRUB_DISABLE_SUBMENU=y

to the end of /etc/default/grub, so then I could just use a numeric value in GRUB_DEFAULT. However, running grub-mkconfig and restarting again, I find that this hasn't had any effect. I still need to go into an "Advanced options for Arch Linux" submenu, rather than having all available kernels in the initial menu like GRUB_DISABLE_SUBMENU is supposed to do.

Here's my /etc/default/grub:

GRUB_DEFAULT="Advanced options for Arch Linux>Arch Linux, with Linux linux"
GRUB_TIMEOUT=5
GRUB_DISTRIBUTOR="Arch"
GRUB_CMDLINE_LINUX_DEFAULT="quiet"
GRUB_CMDLINE_LINUX=""

# Preload both GPT and MBR modules so that they are not missed
GRUB_PRELOAD_MODULES="part_gpt part_msdos"

# Uncomment to enable Hidden Menu, and optionally hide the timeout count
#GRUB_HIDDEN_TIMEOUT=5
#GRUB_HIDDEN_TIMEOUT_QUIET=true

# Uncomment to use basic console
GRUB_TERMINAL_INPUT=console

# Uncomment to disable graphical terminal
#GRUB_TERMINAL_OUTPUT=console

# The resolution used on graphical terminal
# note that you can use only modes which your graphic card supports via VBE
# you can see them in real GRUB with the command `vbeinfo'
GRUB_GFXMODE=auto

# Uncomment to allow the kernel use the same resolution used by grub
GRUB_GFXPAYLOAD_LINUX=keep

# Uncomment if you want GRUB to pass to the Linux kernel the old parameter 
# format "root=/dev/xxx" instead of "root=/dev/disk/by-uuid/xxx" 
#GRUB_DISABLE_LINUX_UUID=true

# Uncomment to disable generation of recovery mode menu entries
GRUB_DISABLE_RECOVERY=true

# Uncomment and set to the desired menu colors.  Used by normal and wallpaper 
# modes only.  Entries specified as foreground/background.
#GRUB_COLOR_NORMAL="light-blue/black"
#GRUB_COLOR_HIGHLIGHT="light-cyan/blue"

# Uncomment one of them for the gfx desired, a image background or a gfxtheme
#GRUB_BACKGROUND="/path/to/wallpaper"
#GRUB_THEME="/path/to/gfxtheme"

# Uncomment to get a beep at GRUB start
#GRUB_INIT_TUNE="480 440 1"

#GRUB_SAVEDEFAULT="true"

GRUB_DISABLE_SUBMENU=y

and here's my /boot/grub/grub.cfg (generated after the above changes):

#
# DO NOT EDIT THIS FILE
#
# It is automatically generated by grub-mkconfig using templates
# from /etc/grub.d and settings from /etc/default/grub
#

### BEGIN /etc/grub.d/00_header ###
insmod part_gpt
insmod part_msdos
if [ -s $prefix/grubenv ]; then
  load_env
fi
if [ "${next_entry}" ] ; then
   set default="${next_entry}"
   set next_entry=
   save_env next_entry
   set boot_once=true
else
   set default="0"
fi

if [ x"${feature_menuentry_id}" = xy ]; then
  menuentry_id_option="--id"
else
  menuentry_id_option=""
fi

export menuentry_id_option

if [ "${prev_saved_entry}" ]; then
  set saved_entry="${prev_saved_entry}"
  save_env saved_entry
  set prev_saved_entry=
  save_env prev_saved_entry
  set boot_once=true
fi

function savedefault {
  if [ -z "${boot_once}" ]; then
    saved_entry="${chosen}"
    save_env saved_entry
  fi
}

function load_video {
  if [ x$feature_all_video_module = xy ]; then
    insmod all_video
  else
    insmod efi_gop
    insmod efi_uga
    insmod ieee1275_fb
    insmod vbe
    insmod vga
    insmod video_bochs
    insmod video_cirrus
  fi
}

if [ x$feature_default_font_path = xy ] ; then
   font=unicode
else
insmod part_msdos
insmod ext2
set root='hd0,msdos1'
if [ x$feature_platform_search_hint = xy ]; then
  search --no-floppy --fs-uuid --set=root --hint-bios=hd0,msdos1 --hint-efi=hd0,msdos1 --hint-baremetal=ahci0,msdos1  e4167399-9c38-4ff3-9899-7479f371c671
else
  search --no-floppy --fs-uuid --set=root e4167399-9c38-4ff3-9899-7479f371c671
fi
    font="/usr/share/grub/unicode.pf2"
fi

if loadfont $font ; then
  set gfxmode=auto
  load_video
  insmod gfxterm
fi
terminal_input console
terminal_output gfxterm
if [ x$feature_timeout_style = xy ] ; then
  set timeout_style=menu
  set timeout=5
# Fallback normal timeout code in case the timeout_style feature is
# unavailable.
else
  set timeout=5
fi
### END /etc/grub.d/00_header ###

### BEGIN /etc/grub.d/10_linux ###
menuentry 'Arch Linux' --class arch --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-simple-e4167399-9c38-4ff3-9899-7479f371c671' {
        load_video
        set gfxpayload=keep
        insmod gzio
        insmod part_msdos
        insmod ext2
        set root='hd0,msdos1'
        if [ x$feature_platform_search_hint = xy ]; then
          search --no-floppy --fs-uuid --set=root --hint-bios=hd0,msdos1 --hint-efi=hd0,msdos1 --hint-baremetal=ahci0,msdos1  e4167399-9c38-4ff3-9899-7479f371c671
        else
          search --no-floppy --fs-uuid --set=root e4167399-9c38-4ff3-9899-7479f371c671
        fi
        echo    'Loading Linux linux-lts ...'
        linux   /boot/vmlinuz-linux-lts root=UUID=e4167399-9c38-4ff3-9899-7479f371c671 rw  quiet
        echo    'Loading initial ramdisk ...'
        initrd  /boot/initramfs-linux-lts.img
}
submenu 'Advanced options for Arch Linux' $menuentry_id_option 'gnulinux-advanced-e4167399-9c38-4ff3-9899-7479f371c671' {
        menuentry 'Arch Linux, with Linux linux-lts' --class arch --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-linux-lts-advanced-e4167399-9c38-4ff3-9899-7479f371c671' {
                load_video
                set gfxpayload=keep
                insmod gzio
                insmod part_msdos
                insmod ext2
                set root='hd0,msdos1'
                if [ x$feature_platform_search_hint = xy ]; then
                  search --no-floppy --fs-uuid --set=root --hint-bios=hd0,msdos1 --hint-efi=hd0,msdos1 --hint-baremetal=ahci0,msdos1  e4167399-9c38-4ff3-9899-7479f371c671
                else
                  search --no-floppy --fs-uuid --set=root e4167399-9c38-4ff3-9899-7479f371c671
                fi
                echo    'Loading Linux linux-lts ...'
                linux   /boot/vmlinuz-linux-lts root=UUID=e4167399-9c38-4ff3-9899-7479f371c671 rw  quiet
                echo    'Loading initial ramdisk ...'
                initrd  /boot/initramfs-linux-lts.img
        }
        menuentry 'Arch Linux, with Linux linux-lts (fallback initramfs)' --class arch --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-linux-lts-fallback-e4167399-9c38-4ff3-9899-7479f371c671' {
                load_video
                set gfxpayload=keep
                insmod gzio
                insmod part_msdos
                insmod ext2
                set root='hd0,msdos1'
                if [ x$feature_platform_search_hint = xy ]; then
                  search --no-floppy --fs-uuid --set=root --hint-bios=hd0,msdos1 --hint-efi=hd0,msdos1 --hint-baremetal=ahci0,msdos1  e4167399-9c38-4ff3-9899-7479f371c671
                else
                  search --no-floppy --fs-uuid --set=root e4167399-9c38-4ff3-9899-7479f371c671
                fi
                echo    'Loading Linux linux-lts ...'
                linux   /boot/vmlinuz-linux-lts root=UUID=e4167399-9c38-4ff3-9899-7479f371c671 rw  quiet
                echo    'Loading initial ramdisk ...'
                initrd  /boot/initramfs-linux-lts-fallback.img
        }
        menuentry 'Arch Linux, with Linux linux' --class arch --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-linux-advanced-e4167399-9c38-4ff3-9899-7479f371c671' {
                load_video
                set gfxpayload=keep
                insmod gzio
                insmod part_msdos
                insmod ext2
                set root='hd0,msdos1'
                if [ x$feature_platform_search_hint = xy ]; then
                  search --no-floppy --fs-uuid --set=root --hint-bios=hd0,msdos1 --hint-efi=hd0,msdos1 --hint-baremetal=ahci0,msdos1  e4167399-9c38-4ff3-9899-7479f371c671
                else
                  search --no-floppy --fs-uuid --set=root e4167399-9c38-4ff3-9899-7479f371c671
                fi
                echo    'Loading Linux linux ...'
                linux   /boot/vmlinuz-linux root=UUID=e4167399-9c38-4ff3-9899-7479f371c671 rw  quiet
                echo    'Loading initial ramdisk ...'
                initrd  /boot/initramfs-linux.img
        }
        menuentry 'Arch Linux, with Linux linux (fallback initramfs)' --class arch --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-linux-fallback-e4167399-9c38-4ff3-9899-7479f371c671' {
                load_video
                set gfxpayload=keep
                insmod gzio
                insmod part_msdos
                insmod ext2
                set root='hd0,msdos1'
                if [ x$feature_platform_search_hint = xy ]; then
                  search --no-floppy --fs-uuid --set=root --hint-bios=hd0,msdos1 --hint-efi=hd0,msdos1 --hint-baremetal=ahci0,msdos1  e4167399-9c38-4ff3-9899-7479f371c671
                else
                  search --no-floppy --fs-uuid --set=root e4167399-9c38-4ff3-9899-7479f371c671
                fi
                echo    'Loading Linux linux ...'
                linux   /boot/vmlinuz-linux root=UUID=e4167399-9c38-4ff3-9899-7479f371c671 rw  quiet
                echo    'Loading initial ramdisk ...'
                initrd  /boot/initramfs-linux-fallback.img
        }
}

### END /etc/grub.d/10_linux ###

### BEGIN /etc/grub.d/20_linux_xen ###
### END /etc/grub.d/20_linux_xen ###

### BEGIN /etc/grub.d/30_os-prober ###
### END /etc/grub.d/30_os-prober ###

### BEGIN /etc/grub.d/40_custom ###
# 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.
### END /etc/grub.d/40_custom ###

### BEGIN /etc/grub.d/41_custom ###
if [ -f  ${config_directory}/custom.cfg ]; then
  source ${config_directory}/custom.cfg
elif [ -z "${config_directory}" -a -f  $prefix/custom.cfg ]; then
  source $prefix/custom.cfg;
fi
### END /etc/grub.d/41_custom ###

Thanks!

Last edited by cal22 (2017-04-17 20:04:43)

Offline

#2 2017-04-18 00:34:44

Head_on_a_Stick
Member
From: London
Registered: 2014-02-20
Posts: 7,732
Website

Re: Having trouble setting the default kernel for GRUB

cal22 wrote:
GRUB_DEFAULT="Advanced options for Arch Linux>Arch Linux, with Linux linux"

↑This is not the same as this ↓

menuentry 'Arch Linux, with Linux linux'

You should use exactly what is between the quotation marks after menuentry.

Offline

#3 2017-04-19 15:27:26

cal22
Member
Registered: 2017-02-01
Posts: 3

Re: Having trouble setting the default kernel for GRUB

Head_on_a_Stick wrote:
cal22 wrote:
GRUB_DEFAULT="Advanced options for Arch Linux>Arch Linux, with Linux linux"

↑This is not the same as this ↓

menuentry 'Arch Linux, with Linux linux'

You should use exactly what is between the quotation marks after menuentry.

Hm, this still just seems to load the LTS version. I just copied the line here that seemed to be suggesting that I needed to specify that the option I want is inside the "Advanced options" submenu.

Offline

#4 2017-04-19 20:49:07

respiranto
Member
Registered: 2015-05-15
Posts: 479
Website

Re: Having trouble setting the default kernel for GRUB

Head_on_a_Stick wrote:
cal22 wrote:
GRUB_DEFAULT="Advanced options for Arch Linux>Arch Linux, with Linux linux"

↑This is not the same as this ↓

menuentry 'Arch Linux, with Linux linux'

You should use exactly what is between the quotation marks after menuentry.

According to the documentation, the usage appears to be correct. That is, if such a submenu exists.


Anyways, are you, cal22, sure to have regenerated grub.cfg after updating /etc/default/grub? Because, if so, the former should not contain the line `set default="0"' (the default) but instead set `default' to the above long option. Also, I suppose, it should not contain submenus, due to `GRUB_DISABLE_SUBMENU=y'.

Last edited by respiranto (2017-04-19 20:49:50)

Offline

#5 2017-04-20 13:01:35

mrunion
Member
From: Jonesborough, TN
Registered: 2007-01-26
Posts: 1,938
Website

Re: Having trouble setting the default kernel for GRUB

Are you using UEFI boot? If so, make sure you are mounting the actual /boot folder to the right location. Check (post) your /etc/fstab file. You may not have the proper /boot folder mounted when you are making changes and that's whats causing the issue.


Matt

"It is very difficult to educate the educated."

Offline

#6 2017-04-20 18:30:54

paulkerry
Member
From: Sheffield, UK
Registered: 2014-10-02
Posts: 611

Re: Having trouble setting the default kernel for GRUB

As well as all of the suggestions above, instead of having the text string for the kernel in /etc/default/grub, does using the corresponding string with the long hexademical code from /boot/grub/grub.cfg work?

cat /boot/grub/grub.cfg | grep gnulinux | grep -v fallback

So you'd get something like...

GRUB_DEFAULT='gnulinux-linux-advanced-{hex-codes-etc-etc-etc-etc-etc}'

Offline

Board footer

Powered by FluxBB