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

Bug #983805 reported by A Dasgupta
12
This bug affects 2 people
Affects Status Importance Assigned to Milestone
initramfs-tools (Ubuntu)
Confirmed
Undecided
Unassigned

Bug Description

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

Tags: patch
Revision history for this message
A Dasgupta (adg) wrote :
Revision history for this message
A Dasgupta (adg) wrote :

New script for /usr/share/initramfs-tools/scripts/local-premount/resume
attached (full).
.

Revision history for this message
Ubuntu Foundations Team Bug Bot (crichton) wrote :

The attachment "Resume boot script makes /bin/resume superfluous" of this bug report has been identified as being a patch. The ubuntu-reviewers team has been subscribed to the bug report so that they can review the patch. In the event that this is in fact not a patch you can resolve this situation by removing the tag 'patch' from the bug report and editing the attachment so that it is not flagged as a patch. Additionally, if you are member of the ubuntu-reviewers team please also unsubscribe the team from this bug report.

[This is an automated message performed by a Launchpad user owned by Brian Murray. Please contact him regarding any issues with the action taken in this bug report.]

tags: added: patch
Revision history for this message
A Dasgupta (adg) wrote :

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

Revision history for this message
A Dasgupta (adg) wrote :

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

Revision history for this message
A Dasgupta (adg) wrote :

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

Revision history for this message
A Dasgupta (adg) wrote :

Full script, with the patch of post #6 applied, ready for testing.

Revision history for this message
A Dasgupta (adg) wrote :

Latest patch (one more version -- delaying stat call to make sure disk is ready).

Revision history for this message
A Dasgupta (adg) wrote :

And the latest full script file.

Revision history for this message
A Dasgupta (adg) wrote :

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
.

Revision history for this message
A Dasgupta (adg) wrote :

Full script --- frozen version.

Revision history for this message
Launchpad Janitor (janitor) wrote :

Status changed to 'Confirmed' because the bug affects multiple users.

Changed in initramfs-tools (Ubuntu):
status: New → Confirmed
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.