[Bug 923326] Re: With multiple swap partitions resume from hibenation fails

2012-04-16 Thread A Dasgupta
Not sure about kernel 3.0.x, but I will describe some methods for the
2.6.30+ kernels that I use with initramfs-tools-0.98.  You most likely
have to modify and adapt things to suit your versions.  Read carefully
and proceed (at your own risk) only if you know what you are doing.  

When multiple swaps are active and you hibernate using the kernel's
built-in method (in pm-utils terms, SLEEP_MODULE="kernel", not
"uswsusp" or "tuxonice"), the kernel will randomly choose one of your
active swap devices to store the snapshot image (AFAIK, there is no way
to force the kernel to use a specific swap device).  So resume will only
work if that device happens to be the same one as the one configured
via the "resume=" initramfs parameter (which is specified
either via "RESUME=..." in /etc/initramfs-tools/conf.d/resume, or via
grub2 config /etc/default/grub, or manually at the grub boot screen,
with each of these directives overriding the preceding ones).

Unfortunately, under normal conditions the kernel does not notify you
which partition it uses for hibernation.  Here are some things to consider.
I will assume only swap partitions are being used --- no swap files.

(A) Quick and dirty manual recovery to resume:

DANGER, WILL ROBINSON!!  READ THE WARNINGS BELOW!

If you hibernated while multiple swap partitions were active and still
want to resume, a quick and dirty manual method is to boot into the
initramfs "premount" break-poiint shell (boot parameter break=premount),
and run:   blkid -t TYPE=swsusp   (or run blkid | grep swsusp), which should
identify the unique partition where the hibernation image is stored.
[Note:  Having multiple such partitions is a serious error condition
which should never happen and your only course of action then would be
to do a normal boot and making sure that the suspend signatures on those
partitions are erased (automatically done if those partitions are used as swap).
Also, if the blkid command above does not return anything you have to
do a normal boot; just exit out of the initramfs shell or reboot.]

Next, identify the major and minor numbers m:n for that partition from
/sys/class/block/sdaXY/dev (cat that file).

Finally, echo the major:minor numbers (in the format m:n) onto
/sys/power/resume.  If everything has been done right, it should
perform a proper resume

Note again that these steps are valid only if the kernel's internal
hibernation method was used (when using userland uswsusp, the
command to manually resume is /sbin/resume -r ).

[One can even automate the above manual procedure by adding
an initramfs boot script which runs at the end of premount phase,
after resume via kernel/uswsusp has been tried.  Such a script can
detect the presence of a unique "swsusp" swap partition (_after_
the initramfs premount resume/uswsusp boot scripts have
attempted to resume but have returned) and give the user
the option of either attempting a resume from that "swsusp"
partition, or proceeding to a normal boot (echo "if unsure, do
normal boot").  But unless carefully written, such a script can
introduce additional security or other vulnerabilities, see the
warnings below.]

WARNING, USE AT YOUR OWN RISK:
The above manual resume assumes that nothing has touched the disk
between your last hibernation and the manual resume (no mounting of
any partition, no boot from liveCD/USB, etc).  Resuming after your disk
has been touched in some way or resuming with a wrong/stale snapshot
image will cause severe damage to your filesystems --- much more severe
than a "normal boot without resume" (which initially checks filesystems)
where you may loose your session but have generally limited damage to
your filesystems.  If unsure, it is safer to do a normal boot.

MORE WARNING:
Even after a normal boot, there are additional risks to consider:  Unless
all your swap devices are listed in /etc/fstab as swaps to be activated
(i.e. without the noauto option), there is a risk of having a stale snapshot
image remaining between boots and normal use (since mountall/swapon -a
will not clear the SIG_SUSPEND suspend signature) and a later configuration
change can cause a resume from that old image leading to disaster.
Consider having a special script which is run both at normal boot and
before and after each hibernation) manually doing a "swapon;swaoff"
on every swap partition on disk that is not being actively used as swap.

(B) Use userland uswsusp method

Unlike the "kernel" hibernation method, this allows you to choose
a specific swap device for hibernation, giving you more flexibility.
[You can even use the kernel method and the uswsusp method
parallely (I do, with different swap partitions assigned to them,
but additional bookkeeping and check scripts are needed).]

But (especially when using multiple swap devices) a misconfiguration
can result in an "out-of-sync" condition between uswsusp's master
config file (/etc/uswsusp.conf or /etc/suspend.conf) on disk filesystem
and its copy in the initramfs image.  S

[Bug 923326] Re: With multiple swap partitions resume from hibenation fails

2012-04-16 Thread A Dasgupta
** Also affects: initramfs-tools
   Importance: Undecided
   Status: New

-- 
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


[Bug 923326] Re: With multiple swap partitions resume from hibenation fails

2012-04-16 Thread A Dasgupta
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


[Bug 50437] Re: Resume from hibernation may fail because swap partition UUID does not match /etc/initramfs-tools/conf.d/resume

2012-04-16 Thread A Dasgupta
See my detailed postings regarding this issue in:

  https://bugs.launchpad.net/initramfs-tools/+bug/923326

.

-- 
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.
https://bugs.launchpad.net/bugs/50437

Title:
  Resume from hibernation may fail because swap partition UUID does not
  match /etc/initramfs-tools/conf.d/resume

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/initramfs-tools/+bug/50437/+subscriptions

-- 
ubuntu-bugs mailing list
ubuntu-bugs@lists.ubuntu.com
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs


[Bug 923326] Re: With multiple swap partitions resume from hibenation fails

2012-04-16 Thread A Dasgupta
Script (slightly improved) attached for download.

** Attachment added: "Initramfs-tools boot script for giving user a chance to 
resume manually"
   
https://bugs.launchpad.net/initramfs-tools/+bug/923326/+attachment/3081061/+files/warnresumefail

-- 
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


[Bug 923326] Re: With multiple swap partitions resume from hibenation fails

2012-04-16 Thread A Dasgupta
Some internals:

If you decide to resume manually, here is some additional low-level
(non-portable) method for detecting suspend signatures.  This is
meant only for experienced users and even then a small error
can destroy all your data.

Both the kernel internal swsusp and the userland uswsusp (suspend-utils)
codes store their suspend signature in the last 10 bytes of the first
4096-byte block of the swap partition used at hibernation.

For the kernel internal swsusp, that signature is "S1SUSPEND\0",
as defined in kernel/power/swap.c:

#define SWSUSP_SIG  "S1SUSPEND"

and for userland suspend, it is "ULSUSPEND\0", as defined in
swsusp.h:

#define SWSUSP_SIG  "ULSUSPEND"

So if in the initramfs premount break-point shell you find a swap partition
/dev/sdXY for which blkid reports TYPE=swsusp, you can do the following
test for further confirmation (DANGER WARNING APPLIES):

suspsig=$(dd if=/dev/sdXY bs=1 skip=4086 count=9 2>/dev/null)

if [ "$suspsig" = "S1SUSPEND" ] ; then
  echo "kernel swsusp, echo major:minor onto /sys/power/resume to resume"
fi

if [ "$suspsig" = "ULSUSPEND" ] ; then
  echo "userland uswsusp, run /sbin/resume -r /dev/sdXY to resume"
fi

I am posting these only for those who may want to experiment while
being fully aware of the risk of losing all data on disk.  The warning script
for manual resume posted in #4 can be further automated with the
last commands (giving the user the option to run these low-level tests
and resume commands to "auto-resume"), but that would be neither
portable not safe.
.

-- 
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


[Bug 923326] Re: With multiple swap partitions resume from hibenation fails

2012-04-17 Thread A Dasgupta
There was an error in my posted script above ("swswap"should be
"swsuspend").

Fixed script (tested) is attached with this post.

Please replace the old script by the attached fixed script file
warnresumefail.fixed

Here is the diff anyway:

--- warnresumefail  2012-04-17 03:56:16.945738809 -0400
+++ warnresumefail.fixed2012-04-17 03:34:27.294976347 -0400
@@ -41,7 +41,7 @@
 fi
 
 # Get a list and count of devices with swsusp signature
-set x $($BLKID -o device -t TYPE=swswap) 
+set x $($BLKID -o device -t TYPE=swsuspend) 
 shift
 lst="$@"
 n="$#"


** Attachment added: "Fixed manual resume warning script"
   
https://bugs.launchpad.net/initramfs-tools/+bug/923326/+attachment/3082184/+files/warnresumefail.fixed

-- 
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


[Bug 983805] [NEW] Resume boot script fix makes /bin/resume unnecessary (kernel's internal swsusp)

2012-04-17 Thread A Dasgupta
Public bug reported:

This patch to scripts/local-premount/resume makes the C program
/bin/resume unnecessary (from klibc-utils, source resumelib.c).

The source shows that C program /bin/resume is simply echoing
major:minor[:offset] onto /sys/power/resume, which is exactly
what is done in this patch, but using shell commands.

This patch is against initramfs-tools_0.99ubuntu12, but
the file scripts/local-premount/resume has stayed the
same for quite a while (at least since maverick).

I will also post the full script file.
.

** Affects: initramfs-tools (Ubuntu)
 Importance: Undecided
 Status: New

-- 
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.
https://bugs.launchpad.net/bugs/983805

Title:
  Resume boot script fix makes /bin/resume unnecessary (kernel's
  internal swsusp)

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/initramfs-tools/+bug/983805/+subscriptions

-- 
ubuntu-bugs mailing list
ubuntu-bugs@lists.ubuntu.com
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs


[Bug 983805] Re: Resume boot script fix makes /bin/resume unnecessary (kernel's internal swsusp)

2012-04-17 Thread A Dasgupta
New script for /usr/share/initramfs-tools/scripts/local-premount/resume
attached (full).
.

** Attachment added: "Full script file"
   
https://bugs.launchpad.net/ubuntu/+source/initramfs-tools/+bug/983805/+attachment/3082529/+files/resume

-- 
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.
https://bugs.launchpad.net/bugs/983805

Title:
  Resume boot script fix makes /bin/resume unnecessary (kernel's
  internal swsusp)

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/initramfs-tools/+bug/983805/+subscriptions

-- 
ubuntu-bugs mailing list
ubuntu-bugs@lists.ubuntu.com
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs


[Bug 983805] Re: Resume boot script fix makes /bin/resume unnecessary (kernel's internal swsusp)

2012-04-17 Thread A Dasgupta
** Patch added: "Resume boot script makes /bin/resume superfluous"
   
https://bugs.launchpad.net/bugs/983805/+attachment/3082526/+files/initramfs-tools-resume-boot-script-diff

-- 
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.
https://bugs.launchpad.net/bugs/983805

Title:
  Resume boot script fix makes /bin/resume unnecessary (kernel's
  internal swsusp)

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/initramfs-tools/+bug/983805/+subscriptions

-- 
ubuntu-bugs mailing list
ubuntu-bugs@lists.ubuntu.com
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs


[Bug 923326] Re: With multiple swap partitions resume from hibenation fails

2012-04-17 Thread A Dasgupta
Final version ready for testing (it only improves the error
message from the last fixed version).  If you have a spare
computer where data does not matter, put this script in

   /etc/initramfs-tools/scripts/local-premount/

run update-initramfs -u ; update-grub, and then
deliberately misconfigure the "resume=" parameter
to test if you can still recover.
.

** Attachment added: "Script for checking resume failure / recovery:  Please 
test"
   
https://bugs.launchpad.net/initramfs-tools/+bug/923326/+attachment/3082922/+files/warnresumefail.final

-- 
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


[Bug 983805] Re: Resume boot script fix makes /bin/resume unnecessary (kernel's internal swsusp)

2012-04-17 Thread A Dasgupta
Updated script:  Please discard the previous patch in post #1 and the
full script file in post #2.  Instead, use the patch in this post, or the
full script in a following post.  This should be good for testing.

[Although the previous version of the script worked in all my tests,
it has a bug which can make it fail if there are symlinks to symlinks.
Also the code is cleaned up:  Finding the major:minor numbers
for the device is now done using the busybox builtins stat/printf
instead of chasing through sysfs or /proc/partitions.  This makes
it even more close to the original klibc/kinit C program resumelib.c.]
.

** Attachment added: "Updated patch --- please discard previous version"
   
https://bugs.launchpad.net/ubuntu/+source/initramfs-tools/+bug/983805/+attachment/3085991/+files/initramfs-tools-resume-boot-script-diff.v2

-- 
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.
https://bugs.launchpad.net/bugs/983805

Title:
  Resume boot script fix makes /bin/resume unnecessary (kernel's
  internal swsusp)

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/initramfs-tools/+bug/983805/+subscriptions

-- 
ubuntu-bugs mailing list
ubuntu-bugs@lists.ubuntu.com
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs


[Bug 983805] Re: Resume boot script fix makes /bin/resume unnecessary (kernel's internal swsusp)

2012-04-17 Thread A Dasgupta
Updated full script :  This post contains the updated version of full
resume script.

Please discard the version in post #2 and use this one instead for testing.
.

** Attachment added: "Updated full script (please discard previous version in 
post #2)"
   
https://bugs.launchpad.net/ubuntu/+source/initramfs-tools/+bug/983805/+attachment/3086004/+files/resume

-- 
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.
https://bugs.launchpad.net/bugs/983805

Title:
  Resume boot script fix makes /bin/resume unnecessary (kernel's
  internal swsusp)

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/initramfs-tools/+bug/983805/+subscriptions

-- 
ubuntu-bugs mailing list
ubuntu-bugs@lists.ubuntu.com
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs


[Bug 983805] Re: Resume boot script fix makes /bin/resume unnecessary (kernel's internal swsusp)

2012-04-17 Thread A Dasgupta
Further Update:  Not a bug fix, but more code cleanup (the diff is
shorter) making the checking logic identical to that of the original
resumelib.c.

This post contains the diff, and the full script in the following post.
This version should be preferred over the one in post #4/#5. 
.

** Attachment added: "Patch with further updates"
   
https://bugs.launchpad.net/ubuntu/+source/initramfs-tools/+bug/983805/+attachment/3087499/+files/initramfs-tools-resume-boot-script-diff.v3

-- 
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.
https://bugs.launchpad.net/bugs/983805

Title:
  Resume boot script fix makes /bin/resume unnecessary (kernel's
  internal swsusp)

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/initramfs-tools/+bug/983805/+subscriptions

-- 
ubuntu-bugs mailing list
ubuntu-bugs@lists.ubuntu.com
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs


[Bug 983805] Re: Resume boot script fix makes /bin/resume unnecessary (kernel's internal swsusp)

2012-04-17 Thread A Dasgupta
Full script, with the patch of post #6 applied, ready for testing.

** Attachment added: "Full script file with the last patch above"
   
https://bugs.launchpad.net/ubuntu/+source/initramfs-tools/+bug/983805/+attachment/3087501/+files/resume

-- 
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.
https://bugs.launchpad.net/bugs/983805

Title:
  Resume boot script fix makes /bin/resume unnecessary (kernel's
  internal swsusp)

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/initramfs-tools/+bug/983805/+subscriptions

-- 
ubuntu-bugs mailing list
ubuntu-bugs@lists.ubuntu.com
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs


[Bug 923326] Re: With multiple swap partitions resume from hibenation fails

2012-04-17 Thread A Dasgupta
The warning message in the script is still a little cryptic.
To help the user to recover, a better message is needed.

-- 
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


[Bug 983805] Re: Resume boot script fix makes /bin/resume unnecessary (kernel's internal swsusp)

2012-04-18 Thread A Dasgupta
And the latest full script file.

** Attachment added: "Full script file replacing one in post #7"
   
https://bugs.launchpad.net/ubuntu/+source/initramfs-tools/+bug/983805/+attachment/3088244/+files/resume

-- 
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.
https://bugs.launchpad.net/bugs/983805

Title:
  Resume boot script fix makes /bin/resume unnecessary (kernel's
  internal swsusp)

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/initramfs-tools/+bug/983805/+subscriptions

-- 
ubuntu-bugs mailing list
ubuntu-bugs@lists.ubuntu.com
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs


[Bug 983805] Re: Resume boot script fix makes /bin/resume unnecessary (kernel's internal swsusp)

2012-04-18 Thread A Dasgupta
Latest patch (one more version -- delaying stat call to make sure disk
is ready).

** Attachment added: "Patch (replaces one in post #6)"
   
https://bugs.launchpad.net/ubuntu/+source/initramfs-tools/+bug/983805/+attachment/3088202/+files/initramfs-tools-resume-boot-script-diff.v5

-- 
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.
https://bugs.launchpad.net/bugs/983805

Title:
  Resume boot script fix makes /bin/resume unnecessary (kernel's
  internal swsusp)

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/initramfs-tools/+bug/983805/+subscriptions

-- 
ubuntu-bugs mailing list
ubuntu-bugs@lists.ubuntu.com
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs


[Bug 983805] Re: Resume boot script fix makes /bin/resume unnecessary (kernel's internal swsusp)

2012-04-18 Thread A Dasgupta
Frozen version :  This is frozen until bugs are found.  (This post contains
the patch and the next post the full script.)

Boot script:   scripts/local-premount/resume

Summary of changes from current initramfs-tools production version:

- /bin/resume is not used any more and its function of echoing
  major:minor on to /sys/power/resume is done in the script itself

- The major and minor device number is found using the stat built-in
  of busybox

- The check logic is identical to that of original /bin/resume (which
  means not only block but also character special files are allowed!)

- Device TYPE detection method:  Tries blkid first for RESUMEDELAY
  seconds, and if that fails then falls back to the original behaviour of
  calling wait-for-root with a wait value of RESUMEDELAY seconds
.

** Attachment added: "Patch file for frozen version"
   
https://bugs.launchpad.net/ubuntu/+source/initramfs-tools/+bug/983805/+attachment/3091727/+files/initramfs-tools-resume-boot-script-diff.v6

-- 
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.
https://bugs.launchpad.net/bugs/983805

Title:
  Resume boot script fix makes /bin/resume unnecessary (kernel's
  internal swsusp)

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/initramfs-tools/+bug/983805/+subscriptions

-- 
ubuntu-bugs mailing list
ubuntu-bugs@lists.ubuntu.com
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs


[Bug 983805] Re: Resume boot script fix makes /bin/resume unnecessary (kernel's internal swsusp)

2012-04-18 Thread A Dasgupta
Full script --- frozen version.

** Attachment added: "Full script --- frozen version"
   
https://bugs.launchpad.net/ubuntu/+source/initramfs-tools/+bug/983805/+attachment/3091728/+files/resume

-- 
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.
https://bugs.launchpad.net/bugs/983805

Title:
  Resume boot script fix makes /bin/resume unnecessary (kernel's
  internal swsusp)

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/initramfs-tools/+bug/983805/+subscriptions

-- 
ubuntu-bugs mailing list
ubuntu-bugs@lists.ubuntu.com
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs


[Bug 985346] [NEW] Resume fails if kernel swsusp method is not configured

2012-04-18 Thread A Dasgupta
Public bug reported:

Bug in script:

debian/initramfs-tools/scripts/local-premount/uswsusp

(This script has stayed the same at least from lucid to precise.
I guess this will need to go upstream?)

Problem:

The uswsusp initramfs boot script (scripts/local-premount/uswsusp)
exits if the kernel swsusp's "resume=" is not set (i.e. it is set
neither in initramfs conf.d/resume nor as a grub boot parameter)
resulting in a failed resume from hibernation.

This should not happen since /sbin/resume has its own config file and
the script does not pass the "resume=" parameter to /sbin/resume
anyway, so /sbin/resume should be run independently of the
"resume=" parameter (unless the noresume boot parameter is present).

Fix:

The line

[ -n ${resume}" ] || exit 0;

should have been

[ -z "${noresume}" ] || exit 0;

Patch attached.

Comment:  An alternative fix would be to modify the above boot script
to pass the "resume=" parameter as /sbin/resume -r ${resume},
which would let users specify the resume device in a more unified
way between kernel swsusp and userland uswsusp methods.  But
it would also create more complications (/sbin/resume's config file
may not get used for resume anymore) and it will disturb the current
independence of the kernel and userland methods as well.
.

** Affects: uswsusp (Ubuntu)
 Importance: Undecided
 Status: New

-- 
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.
https://bugs.launchpad.net/bugs/985346

Title:
  Resume fails if kernel swsusp method is not configured

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/uswsusp/+bug/985346/+subscriptions

-- 
ubuntu-bugs mailing list
ubuntu-bugs@lists.ubuntu.com
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs


[Bug 985346] Re: Resume fails if kernel swsusp method is not configured

2012-04-18 Thread A Dasgupta
** Attachment added: "Patch for boot script 
initramfs-tools/scripts/local-premount/uswsusp"
   
https://bugs.launchpad.net/ubuntu/+source/uswsusp/+bug/985346/+attachment/3092109/+files/uswsusp_1.0%2B20110509-diff

-- 
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.
https://bugs.launchpad.net/bugs/985346

Title:
  Resume fails if kernel swsusp method is not configured

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/uswsusp/+bug/985346/+subscriptions

-- 
ubuntu-bugs mailing list
ubuntu-bugs@lists.ubuntu.com
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs