From: Gordon Messmer <gordon.mess...@gmail.com> The rescue kernel can only be used to boot a system normally if the corresponding kernel and modules are still available. Once they are removed, functionality is significantly reduced.
When a kernel is removed, check the rescue kernel and remove it if it matches the kernel to be removed. The currently running kernel is assumed good, so build a rescue kernel based on this version as long as it is still installed. diff --git a/redhat/kernel.spec.template b/redhat/kernel.spec.template index blahblah..blahblah 100644 --- a/redhat/kernel.spec.template +++ b/redhat/kernel.spec.template @@ -3846,6 +3846,9 @@ touch %{_localstatedir}/lib/rpm-state/%{name}/installing_core_%{KVERREL}%{?-v:+% %define kernel_variant_preun(v:u:) \ %{expand:%%preun %{?-v:%{-v*}-}%{!?-u*:core}%{?-u*:uki-%{-u*}}}\ /bin/kernel-install remove %{KVERREL}%{?-v:+%{-v*}} || exit $?\ +read -r MACHINE_ID < /etc/machine-id && /bin/cmp /boot/vmlinuz-0-rescue-${MACHINE_ID} boot/vmlinuz-%{KVERREL}%{?-v:+%{-v*}} &&\ + /bin/rm /boot/vmlinuz-0-rescue-${MACHINE_ID} /boot/initramfs-0-rescue-${MACHINE_ID}.img &&\ + [ -e /boot/vmlinuz-$(uname -r) ] && kernel-install add $(uname -r) /lib/modules/$(uname -r)/vmlinuz\ %if !%{with_automotive}\ if [ -x %{_sbindir}/weak-modules ]\ then\ -- https://gitlab.com/cki-project/kernel-ark/-/merge_requests/3960 -- _______________________________________________ kernel mailing list -- kernel@lists.fedoraproject.org To unsubscribe send an email to kernel-le...@lists.fedoraproject.org Fedora Code of Conduct: https://docs.fedoraproject.org/en-US/project/code-of-conduct/ List Guidelines: https://fedoraproject.org/wiki/Mailing_list_guidelines List Archives: https://lists.fedoraproject.org/archives/list/kernel@lists.fedoraproject.org Do not reply to spam, report it: https://pagure.io/fedora-infrastructure/new_issue