diff --git a/initramfs/alpm-script.sh.in b/initramfs/alpm-script.sh.in index 36cf647..bf2a6dd 100644 --- a/initramfs/alpm-script.sh.in +++ b/initramfs/alpm-script.sh.in @@ -15,6 +15,19 @@ if [ -n "$1" ]; then if command -v INITRD 1>/dev/null; then INITRD_installation + + # Worth noticing that it is possible (though unlikely) that during + # the kdumpst package installation, users are running a previously + # uninstalled kernel. Imagine if the user upgrades the kernel, and + # then install kdumpst before rebooting. With that, creating an + # initrd fails here since it relies on "uname -r". To prevent such + # unhandled error, check if this kernel's modules directory exists. + + if [ ! -d "/lib/modules/$1" ]; then + logger "kdumpst: no kernel modules dir; defer initrd creation to next boot" + exit 0 + fi + create_initramfs_INITRD "$1" fi exit 0