[Pm-utils] [patch] disable suspend when kernel image changed

Richard Zidlicky rz at linux-m68k.org
Wed Apr 7 12:52:06 PDT 2010


trying to fix this crash situation: /boot/vmlinuz-XXX exists and is the currently 
running kernel, I decide to reconfigure and recompile it, overwrite /boot/vmlinuz-XXX 
and hit pm-hibernate.

Currently 01grub does not recognize that the kernel image vmlinuz-XXX is not 
identical with that of the running kernel and will suspend. Resume fails with 
"version mismatch".

I have cooked up this patch as a fix to avoid the problem. It would be nice to do
something more sophisticated but I do not know how to figure out the exact version
from the saved image in a portable way without draging in exotic dependencies.
Another option would be to compare the date stamp with uptime if boot.log is
something distribution specific - slightly more difficult scripting-wise and not 
sure if it is needed.

Supposed to work on Fedora but not really tested yet.

--- 01grub.rz   2010-04-07 19:52:02.000000000 +0200
+++ 01grub      2010-04-07 21:22:30.000000000 +0200
@@ -15,6 +15,7 @@
        [ -x /sbin/grubby -a -x /sbin/grub ] || return $NA
        [ -e "/boot/vmlinuz-$(uname -r)" ] || return 1
+       [ /var/log/boot.log -ot "/boot/vmlinuz-$(uname -r)" ] && return $NA
        out=$(/sbin/grubby --info /boot/vmlinuz-$(uname -r) |grep index)
        [ -n "${out}" ] || return 1


More information about the Pm-utils mailing list