Here is a basic script that warns the user that the system is about to a do normal boot while a resume partition is present, giving a chance for a "manual recovery resume" for experienced users. (The script will not work for swap files or for tuxonice.)
#!/bin/sh # # Initramfs-tools boot script: # # Warn the user if partition(s) with swsusp signature remains even after the # resume/uswsusp boot scripts have run. This script is only for kernel swsusp # and userland uswsusp (not for tuxonice, sorry). # # Put this script where the resume/uswsusp boot scripts are kept. # USE AT YOUR OWN RISK. # # A Dasgupta, 2012 # PREREQ="resume uswsusp" prereqs() { echo "$PREREQ" } case $1 in # get pre-requisites prereqs) prereqs exit 0 ;; esac if [ -n "${noresume}" ] ; then exit 0 fi # Get a list of devices with swsusp signature lst=$(blkid -t TYPE=swsusp | while IFS=":" read x jnk ; do echo $x ; done) # Count how many found n=0 if [ -n "$lst" ] ; then for p in $lst ; do n=$((1+$n)) done fi # Normally, this script should not run beyond this point if [ -z "$lst" ] || [ "$n" = "0" ] ; then # Normal exit exit 0 fi # Remaining swsusp partition(s) found -- warn user sleep 2 echo "" echo "Error: Suspend signature found on partition(s): ${lst}" # Multiple partitions wth swsusp signature! if [ "$n" != "1" ] ; then echo "" echo "ERROR: You have multiple partitions with swsusp signature." echo "This should never happen. If you are not using these swap" echo "partitions, please clear their swsusp signatures by turning on" echo "swap (temporarily) on these: ${lst}" echo "" sleep 15 exit fi # A unique partition with the swsusp signature remains. # Notify user of possible actions. echo "" echo "Error: Resume script(s) ran but suspend signature found on ${lst}." echo "This can happen if you hibernated but resume parameters are wrong." echo "If so, you may want to reboot/poweroff now, and break into a premount" echo "initramfs shell at the next boot to attempt resuming from ${lst}." echo "" echo "WARNING: Resuming after your filesystems were mounted or from a" echo "stale/wrong hibernation image will cause severe filesystem" echo "corruption!!! If unsure, wait for normal boot, and make sure to" echo "clear any stale hibernation image signature." echo "" echo "If unsure, do not attempt to resume; proceed with normal boot." echo "" sleep 2 echo "Seconds remaining before normal boot:" n=40 while [ $n -ge 0 ] ; do if [ $n -lt 10 ] || [ $(($n % 5)) -eq 0 ] ; then echo -n " $n" else echo -n "." fi sleep 1 n=$(($n - 1)) done echo "" echo "Proceeding with normal boot" echo "" sleep 3 exit -- You received this bug notification because you are a member of Ubuntu Bugs, which is subscribed to Ubuntu. https://bugs.launchpad.net/bugs/923326 Title: With multiple swap partitions resume from hibenation fails To manage notifications about this bug go to: https://bugs.launchpad.net/initramfs-tools/+bug/923326/+subscriptions -- ubuntu-bugs mailing list ubuntu-bugs@lists.ubuntu.com https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs