View previous topic :: View next topic |
Author |
Message |
Massimo B. Veteran
Joined: 09 Feb 2005 Posts: 1816 Location: PB, Germany
|
Posted: Fri Sep 15, 2017 5:48 am Post subject: Howto make grub respect the kernel symlink as default |
|
|
Howto make grub respect the kernel symlink as default
Many tools like genkernel still create the /boot/kernel symlinks, at least when using SYMLINK="yes" in genkernel.conf. However when building my new kernel like this
Code: | genkernel all --makeopts="-j4 -l8" --loglevel=4 && grub-mkconfig -o /boot/grub/grub.cfg |
the grub-mkconfig does not respect this link but does it's own alphabetical sorting. While I have different kernels prepared grub by default would choose the -gentoo kernel being alphabetically first and not my preferred kernel:
Code: | # ls -l /boot/kernel*
lrwxrwxrwx 1 root root 34 Sep 14 16:11 /boot/kernel -> kernel-genkernel-x86_64-4.13.0-pf2
-rw-r--r-- 1 root root 4,3M Mai 4 13:32 /boot/kernel-genkernel-x86_64-4.10.13-ck
-rw-r--r-- 1 root root 4,4M Sep 14 16:11 /boot/kernel-genkernel-x86_64-4.13.0-pf2
-rw-r--r-- 1 root root 4,4M Sep 14 15:46 /boot/kernel-genkernel-x86_64-4.13.0-pf2.old
-rw-r--r-- 1 root root 4,4M Sep 13 12:06 /boot/kernel-genkernel-x86_64-4.13.1-gentoo |
After struggling with GRUB_DEFAULT= in /etc/default/grub and numbers, I found that you can set that to "saved", so this is my approach to always boot the symlinked kernel by default:
Code: | # cat /etc/grub.d/40_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 'Gentoo GNU/Linux, current kernel' --class gentoo --class gnu-linux --class gnu --class os $menuentry_id_option 'gentoo-current' {
load_video
insmod gzio
insmod part_msdos
insmod ext2
if [ x$feature_platform_search_hint = xy ]; then
search --no-floppy --fs-uuid --set=root 430c4991-31e4-41db-940a-8d733834d5f6
else
search --no-floppy --fs-uuid --set=root 430c4991-31e4-41db-940a-8d733834d5f6
fi
echo 'Loading current Gentoo-Linux ...'
linux /kernel root=/dev/mapper/root ro rootflags=subvol=root keymap=de splash=silent,theme:livecd-2007.0 console=tty1 quiet crypt_root=UUID=e609e76c-419f-4677-ff00-872290730e6f root=LABEL=gentoo dobtrfs
echo 'Loading initial ramdisk ...'
initrd /initramfs
} |
Code: | # grep GRUB_DEFAULT /etc/default/grub
GRUB_DEFAULT="saved"
# grub-set-default gentoo-current
# head -n2 /boot/grub/grubenv
# GRUB Environment Block
saved_entry=gentoo-current |
_________________ HP ZBook Power 15.6" G8 i7-11800H|HP EliteDesk 800G1 i7-4790|HP Compaq Pro 6300 i7-3770 |
|
Back to top |
|
|
Syl20 l33t
Joined: 04 Aug 2005 Posts: 621 Location: France
|
Posted: Mon Sep 25, 2017 12:53 pm Post subject: |
|
|
Interesting.
That said, there's also the "good old" solution. You can write a correct (and so much simplier...) grub.cfg file by hand, and completely forget grub-mkconfig. |
|
Back to top |
|
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|