2

I've compiled a new kernel based on 5.4.18-xanmod10 kernel. Then I've installed it:

sudo dpkg -i linux*5.4.18-xanmod10-custom*.deb

But after installing, it have not been found by update-grub2:

root@lenovo:~# ls /boot/
config-5.3.0-29-lowlatency           memtest86+.elf
config-5.4.18-xanmod10-custom        memtest86+_multiboot.bin
config-5.5.0-3.2-liquorix-amd64      System.map-5.3.0-29-lowlatency
config-5.5.0-4.1-liquorix-amd64      System.map-5.4.18-xanmod10-custom
config-5.5.4-xanmod3                 System.map-5.5.0-3.2-liquorix-amd64
grub                                 System.map-5.5.0-4.1-liquorix-amd64
initrd.img                           System.map-5.5.4-xanmod3
initrd.img-5.3.0-29-lowlatency       vmlinuz
initrd.img-5.4.18-xanmod10-custom    vmlinuz-5.3.0-29-lowlatency
initrd.img-5.5.0-3.2-liquorix-amd64  vmlinuz-5.4.18-xanmod10-custom
initrd.img-5.5.0-4.1-liquorix-amd64  vmlinuz-5.5.0-3.2-liquorix-amd64
initrd.img-5.5.4-xanmod3             vmlinuz-5.5.0-4.1-liquorix-amd64
initrd.img.old                       vmlinuz-5.5.4-xanmod3
memtest86+.bin                       vmlinuz.old

root@lenovo:~# update-grub2
Sourcing file `/etc/default/grub'
Sourcing file `/etc/default/grub.d/init-select.cfg'
Generating grub configuration file ...
Found linux image: /boot/vmlinuz-5.3.0-29-lowlatency
Found initrd image: /boot/initrd.img-5.3.0-29-lowlatency
Found linux image: /boot/vmlinuz-5.3.0-29-lowlatency
Found initrd image: /boot/initrd.img-5.3.0-29-lowlatency
Found memtest86+ image: /boot/memtest86+.elf
Found memtest86+ image: /boot/memtest86+.bin
done

There're other kernels present, but after reboot only lowlatency kernel and memtest are present in the grub menu. Also, during update it shows the same kernel two times. Previously, before generic cernels moving to another folder, generic and lowlatency kernels have been listed during grub update.

How could I resolve this issue?

Gryu
  • 7,559
  • 9
  • 33
  • 52

2 Answers2

4

The following three commands also solve this problem, by turning off the executable bit on 09_lowlatency and turning on the bit for 10_linux, in accordance with the text in /etc/grub.d/README.lowlatency. I recommend editing /etc/default/grub to change GRUB_TIMEOUT to a positive value, prior to invoking update-grub as well.

# chmod -x /etc/grub.d/09_lowlatency
# chmod +x /etc/grub.d/10_linux
# update-grub
0

I've solved it, but the solution is not very nice.

  1. Copy lowlatency grub configuration file into new custom grub config file: sudo cp /etc/grub.d/09_lowlatency /etc/grub.d/08_custom
    I got 09_lowlatency file by following instructions:

    First, let’s visit https://packages.ubuntu.com/. This step is a little less obvious. The package “ubuntustudio-default-settings” contains a file named “09_lowlatency”. This file is a GRUB configuration file we can use to assure our lowlatency kernel is booted first and assures it will stay that way.

  2. Take away these files so they will not duplicate grub menu entries and will not be duplicated in a list during sudo update-grub2 command execution:
    sudo mv /etc/grub.d/10_linux /home/myuser/backup/ && sudo mv /etc/grub.d/09_lowlatency /home/myuser/backup/

  3. I changed one case statement in the 08_custom file:
    Before changing it was:

    case "x$machine" in
        xi?86 | xx86_64)
            list=
            for i in /boot/vmlinuz-*lowlatency /vmlinuz-*lowlatency /boot/kernel-*lowlatency ; do
                if grub_file_is_not_garbage "$i" ; then list="$list $i" ; fi
            done
            list2=
            for i in /boot/vmlinuz-*generic /vmlinuz-*generic /boot/kernel-*generic ; do
                if grub_file_is_not_garbage "$i" ; then list2="$list2 $i" ; fi
            done ;;
        *)
            list=
            for i in /boot/vmlinuz-*lowlatency /boot/vmlinux-*lowlatency /vmlinuz-*lowlatency /vmlinux-*lowlatency /boot/kernel-*lowlatency ; do
                      if grub_file_is_not_garbage "$i" ; then list="$list $i" ; fi
            done
            list2=
            for i in /boot/vmlinuz-*generic /boot/vmlinux-*generic /vmlinuz-*generic /vmlinux-*generic /boot/kernel-*generic ; do
                      if grub_file_is_not_garbage "$i" ; then list2="$list2 $i" ; fi
            done ;;
    esac
    

    After changing it became:

    case "x$machine" in
        xi?86 | xx86_64)
            list=
            for i in /boot/vmlinuz-*lowlatency ; do
                if grub_file_is_not_garbage "$i" ; then list="$list $i" ; fi
            done
            for i in /boot/vmlinuz-*generic ; do
                if grub_file_is_not_garbage "$i" ; then list="$list $i" ; fi
            done
            for i in /boot/vmlinuz-*xanmod10-custom ; do
                if grub_file_is_not_garbage "$i" ; then list="$list $i" ; fi
            done ;;
        *)
            list=
            for i in /boot/vmlinuz-*lowlatency ; do
                      if grub_file_is_not_garbage "$i" ; then list="$list $i" ; fi
            done
            for i in /boot/vmlinuz-*generic ; do
                      if grub_file_is_not_garbage "$i" ; then list="$list $i" ; fi
            done
            for i in /boot/vmlinuz-*xanmod10-custom ; do
                      if grub_file_is_not_garbage "$i" ; then list2="$list2 $i" ; fi
            done ;;
    esac
    

My ls -alh /boot and sudo update-grab2 commands show the next:

$ ls -alh /boot
total 275M
drwxr-xr-x  3 root root 4,0K feb 17 00:32 .
drwxr-xr-x 20 root root 4,0K feb 13 09:55 ..
-rw-r--r--  1 root root 231K jan 17 15:59 config-5.3.0-29-generic
-rw-r--r--  1 root root 231K jan 17 15:59 config-5.3.0-29-lowlatency
-rw-r--r--  1 root root 138K feb 16 03:54 config-5.4.18-xanmod10-custom
-rw-r--r--  1 root root 216K feb 15 19:56 config-5.5.0-4.1-liquorix-amd64
-rw-r--r--  1 root root 237K feb 15 16:06 config-5.5.4-xanmod3
drwxr-xr-x  4 root root 4,0K feb 17 00:28 grub
lrwxrwxrwx  1 root root   35 feb 16 09:06 initrd.img -> initrd.img-5.5.0-4.1-liquorix-amd64
-rw-r--r--  1 root root  46M feb 13 21:37 initrd.img-5.3.0-29-generic
-rw-r--r--  1 root root  46M feb 14 00:01 initrd.img-5.3.0-29-lowlatency
-rw-r--r--  1 root root  12M feb 16 08:36 initrd.img-5.4.18-xanmod10-custom
-rw-r--r--  1 root root  53M feb 16 09:07 initrd.img-5.5.0-4.1-liquorix-amd64
-rw-r--r--  1 root root  52M feb 17 00:32 initrd.img-5.5.4-xanmod3
lrwxrwxrwx  1 root root   30 feb 16 09:06 initrd.img.old -> initrd.img-5.3.0-29-lowlatency
-rw-r--r--  1 root root 179K jan 28  2016 memtest86+.bin
-rw-r--r--  1 root root 181K jan 28  2016 memtest86+.elf
-rw-r--r--  1 root root 181K jan 28  2016 memtest86+_multiboot.bin
-rw-------  1 root root 4,5M jan 17 15:59 System.map-5.3.0-29-generic
-rw-------  1 root root 4,5M jan 17 15:59 System.map-5.3.0-29-lowlatency
-rw-r--r--  1 root root 4,2M feb 16 03:54 System.map-5.4.18-xanmod10-custom
-rw-r--r--  1 root root 3,9M feb 15 19:56 System.map-5.5.0-4.1-liquorix-amd64
-rw-r--r--  1 root root 5,1M feb 15 16:06 System.map-5.5.4-xanmod3
lrwxrwxrwx  1 root root   32 feb 16 09:06 vmlinuz -> vmlinuz-5.5.0-4.1-liquorix-amd64
-rw-------  1 root root  11M jan 17 16:35 vmlinuz-5.3.0-29-generic
-rw-------  1 root root  11M jan 17 16:35 vmlinuz-5.3.0-29-lowlatency
-rw-r--r--  1 root root 6,6M feb 16 03:54 vmlinuz-5.4.18-xanmod10-custom
-rw-r--r--  1 root root 8,9M feb 15 19:56 vmlinuz-5.5.0-4.1-liquorix-amd64
-rw-r--r--  1 root root 7,2M feb 15 16:06 vmlinuz-5.5.4-xanmod3
lrwxrwxrwx  1 root root   27 feb 16 09:06 vmlinuz.old -> vmlinuz-5.3.0-29-lowlatency

$ sudo update-grub2
Sourcing file `/etc/default/grub'
Sourcing file `/etc/default/grub.d/init-select.cfg'
Generating grub configuration file ...
Found linux image: /boot/vmlinuz-5.4.18-xanmod10-custom
Found initrd image: /boot/initrd.img-5.4.18-xanmod10-custom
Found linux image: /boot/vmlinuz-5.4.18-xanmod10-custom
Found initrd image: /boot/initrd.img-5.4.18-xanmod10-custom
Found linux image: /boot/vmlinuz-5.3.0-29-lowlatency
Found initrd image: /boot/initrd.img-5.3.0-29-lowlatency
Found linux image: /boot/vmlinuz-5.3.0-29-generic
Found initrd image: /boot/initrd.img-5.3.0-29-generic
Found memtest86+ image: /boot/memtest86+.elf
Found memtest86+ image: /boot/memtest86+.bin
done

I removed excessive code not needed in my case, then copy-pasted a pair of for loops for lowlatency kernel and changed lowlatency to xanmod10-custom in it.

$ ls -alh /etc/grub.d/
total 136K
drwxr-xr-x   2 root root 4,0K feb 17 00:28 .
drwxr-xr-x 141 root root  12K feb 17 00:31 ..
-rwxr-xr-x   1 root root  11K feb 11 16:57 00_header
-rwxr-xr-x   1 root root 6,2K feb 11 16:57 05_debian_theme
-rwxr-xr-x   1 root root  16K feb 17 00:28 08_xanmod_custom
-rwxr-xr-x   1 root root  37K feb 11 16:57 10_linux_zfs
-rwxr-xr-x   1 root root  13K feb 11 16:57 20_linux_xen
-rwxr-xr-x   1 root root 2,0K feb 28  2016 20_memtest86+
-rwxr-xr-x   1 root root  12K feb 11 16:57 30_os-prober
-rwxr-xr-x   1 root root 1,4K feb 11 16:57 30_uefi-firmware
-rwxr-xr-x   1 root root  214 feb 11 16:57 40_custom
Gryu
  • 7,559
  • 9
  • 33
  • 52