Ubuntu – /etc/grub.d/09_lowlatency and /etc/grub.d/10_linux double list kernel

14.04grub2ubuntu-studio

In a fresh ubuntu-studio 14.04 install sudo apt-get install linux-generic.

Then the grub-mkconfig will give you a menu as such

Ubuntu (lowlatency)
Ubuntu
Advanced options for Ubuntu

A quick look with the 'e' key will show that both Ubuntu (lowlatency) and Ubuntu point to

linux   /boot/vmlinuz-3.13.0-24-lowlatency

A work around is you can select the desired kernel in the 'Advanced option for Ubuntu' menu.

How can we fix /etc/grub.d/09_lowlatency and /etc/grub.d/10_linux so that they don't select the same default kernel?

Relevant menuentry in /boot/grub/grub.cfg from /etc/grub.d/09_lowlatency

menuentry 'Ubuntu (lowlatency)' --class ubuntu --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-simple-0f6e1051-cf9f-4299-b691-76d0d8c532d1' {
recordfail
        load_video
        gfxmode $linux_gfx_mode
        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  0f6e1051-cf9f-4299-b691-76d0d8c532d1
        else
          search --no-floppy --fs-uuid --set=root 0f6e1051-cf9f-4299-b691-76d0d8c532d1
        fi
        linux   /boot/vmlinuz-3.13.0-24-lowlatency root=UUID=0f6e1051-cf9f-4299-b691-76d0d8c532d1 ro   quiet splash $vt_handoff
        initrd  /boot/initrd.img-3.13.0-24-lowlatency
}

And the menu entry in /boot/grub/grub.cfg from /etc/grub.d/10_linux

menuentry 'Ubuntu' --class ubuntu --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-simple-0f6e1051-cf9f-4299-b691-76d0d8c532d1' {
        recordfail
        load_video
        gfxmode $linux_gfx_mode
        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  0f6e1051-cf9f-4299-b691-76d0d8c532d1
        else
          search --no-floppy --fs-uuid --set=root 0f6e1051-cf9f-4299-b691-76d0d8c532d1
        fi
        linux   /boot/vmlinuz-3.13.0-24-lowlatency root=UUID=0f6e1051-cf9f-4299-b691-76d0d8c532d1 ro  quiet splash $vt_handoff
        initrd  /boot/initrd.img-3.13.0-24-lowlatency
}

Yes I assure you I have a normal kernel installed:

$ ls -l /vmlinuz*
lrwxrwxrwx 1 root root 30 May  5 20:37 /vmlinuz -> boot/vmlinuz-3.13.0-24-generic
lrwxrwxrwx 1 root root 33 May  2 20:25 /vmlinuz.old -> boot/vmlinuz-3.13.0-24-lowlatency

Best Answer

  1. Open /etc/grub.d/10_linux for editing

  2. Look for kernel list loop:

    machine=`uname -m`
    case "x$machine" in
        xi?86 | xx86_64)
            list=`for i in /boot/vmlinuz-* /vmlinuz-* /boot/kernel-* ; do
                      if grub_file_is_not_garbage "$i" ; then echo -n "$i " ; fi
                  done` ;;
        *)
            list=`for i in /boot/vmlinuz-* /boot/vmlinux-* /vmlinuz-* /vmlinux-* /boot/kernel-* ; do
                      if grub_file_is_not_garbage "$i" ; then echo -n "$i " ; fi
                 done` ;;
    esac
    
  3. Add if clause to skip lowlatency kernels

    machine=`uname -m`
    case "x$machine" in
        xi?86 | xx86_64)
            list=`for i in /boot/vmlinuz-* /vmlinuz-* /boot/kernel-* ; do
                      if [ -z "${i##*lowlatency}" ] ; then continue ; fi
                      if grub_file_is_not_garbage "$i" ; then echo -n "$i " ; fi
                  done` ;;
        *)
            list=`for i in /boot/vmlinuz-* /boot/vmlinux-* /vmlinuz-* /vmlinux-* /boot/kernel-* ; do
                      if [ -z "${i##*lowlatency}" ] ; then continue ; fi
                      if grub_file_is_not_garbage "$i" ; then echo -n "$i " ; fi
                 done` ;;
    esac
    
  4. Update Grub list

    sudo update-grub2
    
Related Question