x86 Suspend/resume support in Hoary

Matt Zimmerman mdz at ubuntu.com
Sat Feb 5 03:13:54 CST 2005


On Sat, Feb 05, 2005 at 10:52:29AM +0200, Sami Haahtinen wrote:

> The scripts should check for a kernel version mismatch, which wont be as 
> easy as it sounds.

Coincidentally, I was just working on a related problem a couple of weeks
ago.  Attached is the result.

> also it would be nice if we could somehow fixate the 
> grub menu (or whatever) so that the version we hibernated with is the 
> one that gets booted. This mostly applies for ABI changes and kernel 
> upstream version changes. Also, one option would be to refuse 
> hibernation all together if the running kernel can't be found on disk.

It sounds like we would need to do a few things:

- Refuse to hibernate if the running kernel does not match the
  kernel to be used as default on the next boot (tricky)

- If the resume fails due to a mismatch, halt, giving the user a chance to
  recover

Would it help to sync() just before going to sleep, to reduce the risk of
corruption if anything goes wrong with the resume?

-- 
 - mdz
-------------- next part --------------
#!/bin/sh

set -e

running_kernel_release=$(uname -r)
running_kernel_build=$(uname -v)
image=/boot/vmlinuz-$running_kernel_release
image_build=
if [ -f $image ]; then
    image_build=$(strings $image | sed -n -e "/^$running_kernel_release (.*) #[0-9]/ { s/^.*#/#/; p }")
fi
package=linux-image-$running_kernel_release
package_version=$(dpkg-query -W --showformat '${Version}' $package 2>/dev/null) || true

if [ -n "$package_version" ]; then
    echo "This system appears to be running an Ubuntu packaged Linux kernel"
    echo "$package version $package_version"

    if [ "$running_kernel_build" != "$image_build" ]; then
        echo
        echo "The running kernel seems to be different from the kernel on disk."
        echo "Possibly the kernel has been upgraded, and a reboot is needed:"
        echo "    running kernel: $running_kernel_build"
        echo "    on-disk kernel: $image_build"
    fi
else
    echo "This system does not appear to be running an official Ubuntu kernel"
    echo "The kernel version is: $(uname -r)"
fi

exit 0



More information about the ubuntu-devel mailing list