Last active
October 15, 2024 18:20
-
-
Save mjkloeckner/214a0ee42c920affe572e12e933a1bb0 to your computer and use it in GitHub Desktop.
Fix grub linux kernel display version
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- /etc/grub.d/10_linux | |
+++ /etc/grub.d/10_linux | |
@@ -144,7 +144,7 @@ | |
fi | |
printf '%s\n' "${prepare_boot_cache}" | sed "s/^/$submenu_indentation/" | |
fi | |
- message="$(gettext_printf "Loading Linux %s ..." ${version})" | |
+ message="$(gettext_printf "Loading Linux %s ..." ${display_version})" | |
sed "s/^/$submenu_indentation/" << EOF | |
echo '$(echo "$message" | grub_quote)' | |
linux ${rel_dirname}/${basename} root=${linux_root_device_thisversion} rw ${args} | |
@@ -217,6 +217,7 @@ | |
dirname=`dirname $linux` | |
rel_dirname=`make_system_path_relative_to_its_root $dirname` | |
version=`echo $basename | sed -e "s,vmlinuz-,,g"` | |
+ display_version=`file $linux | grep -oP '(?<=version )\S*'` | |
alt_version=`echo $version | sed -e "s,\.old$,,g"` | |
linux_root_device_thisversion="${LINUX_ROOT_DEVICE}" | |
@@ -290,7 +291,7 @@ | |
fi | |
if [ "x$is_top_level" = xtrue ] && [ "x${GRUB_DISABLE_SUBMENU}" != xtrue ]; then | |
- linux_entry "${OS}" "${version}" simple \ | |
+ linux_entry "${OS}" "${display_version}" simple \ | |
"${GRUB_CMDLINE_LINUX} ${GRUB_CMDLINE_LINUX_DEFAULT}" | |
submenu_indentation="$grub_tab" |
It requires grep with perl regex support, I'm using GNU grep
to apply execute: cd / && sudo patch -p0 < fix-grub-linux-display-version.diff
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
In my case when booting from grub the console echoed
Loading Linux linux
; with this patch the message is nowLoading Linux 6.9.7-arch1-1