Feb 25, 2018

Ubuntu Kernel: Adding a new menuentry as default before menuentry 'Ubuntu' (grub)

After the problem with s2disk/hibernate on my Ubuntu 17.10 i wanted to change the grub boot menu:
I wanted to add my new default kernel at the beginning  - before the 'Ubuntu' menuentry.





Adding the menuentry inside /boot/grub/grub.cfg does not work, because after the first kernel update the command update-grub will overwrite all changes.

Easiest way:
Go to /etc/grub.d/ and move

mv 40_custom 09_custom
Inside 09_custom add your new menuentry (just copy the one you want from /boot/grub/grub.cfg):
root@zerberus:/etc/grub.d# cat 09_custom
#!/bin/sh
exec tail -n +3 $0
# 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.
        menuentry 'Ubuntu, mit Linux 4.13.0-17-generic' --class ubuntu --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-4.13.0-17-generic-advanced-40d34826-4f8a-aefc' {
                recordfail
                load_video
                gfxmode $linux_gfx_mode
                insmod gzio
                if [ x$grub_platform = xxen ]; then insmod xzio; insmod lzopio; fi
                insmod part_gpt
                insmod ext2
                set root='hd0,gpt5'
                if [ x$feature_platform_search_hint = xy ]; then
                  search --no-floppy --fs-uuid --set=root --hint-bios=hd0,gpt5 --hint-efi=hd0,gpt5 --hint-baremetal=ahci0,gpt5  40d34826-4f8a-aefc-d422f755d339
                else
                  search --no-floppy --fs-uuid --set=root 40d34826-4f8a-aefc                fi
                echo    'Linux 4.13.0-17-generic wird geladen …'
                linux   /boot/vmlinuz-4.13.0-17-generic root=UUID=40d34826-4f8a-aefc ro  noplymouth resume=UUID=709f3f5a-5e73-b42d-b93915cea971
                echo    'Initiale Ramdisk wird geladen …'
                initrd  /boot/initrd.img-4.13.0-17-generic
        }
 And then run update-grub once again and you are done....




No comments:

Post a Comment