Skip to contentSkip to conversation

resume from hibernation without touching saved image?

DISCUSSION Michael Tokarev 2 participants 3 messages Oct 31, 2014 – Nov 1, 2014

lore
Share & tools
lore
#0 lore raw

Hello again.

Currently, linux kernel is able to resume from a previously saved image, and it basically clears up that image when done, so there's no way to resume from it once more.

Is it possible to _not_ touch the image at all and keep it in the same state as before? Maybe putting it to a readonly block device (like blockdev --setro, or mdadm readonly array) will help?

What I'm thinking is to speed up starting of a diskless client which boots out of read-only filesystem - the only thing it needs to do is to start X server and connect to a terminal server, but booting it to the point when it can do that requires some time. So I'm thinking about booting it there and suspending it, so it can be resumed later, so the only thing left is just to start X. That works, but the prob is that it works only once.

So, basically, how to turn off that feature which resets the saved hibernation image at the end of resume process?

Thanks,

/mjt

#1 lore raw
Quoted 5 lines · Michael Tokarev

Hello again.

Currently, linux kernel is able to resume from a previously saved image, and it basically clears up that image when done, so there's no way to resume from it once more.

Which is intentional.

Quoted 3 lines

Is it possible to _not_ touch the image at all and keep it in the same state as before? Maybe putting it to a readonly block device (like blockdev --setro, or mdadm readonly array) will help?

Keeping an image itself immutable doesn't help, because the state recorded in the image has to match the state recorded in other places, like fs superblocks and such.

As long as you can't guarantee that all of that is in sync, nothing helps.

Signature · 2 lines
I speak only for myself.
Rafael J. Wysocki, Intel Open Source Technology Center.
#2 lore raw
Quoted 8 lines · Rafael J. Wysocki
Quoted 5 lines · Michael Tokarev

Hello again.

Currently, linux kernel is able to resume from a previously saved image, and it basically clears up that image when done, so there's no way to resume from it once more.

Which is intentional.

Sure, I understand.

Quoted 7 lines
Quoted 3 lines

Is it possible to _not_ touch the image at all and keep it in the same state as before? Maybe putting it to a readonly block device (like blockdev --setro, or mdadm readonly array) will help?

Keeping an image itself immutable doesn't help, because the state recorded in the image has to match the state recorded in other places, like fs superblocks and such.

As I mentioned before, all the filesystems are readonly so does not change no matter how many times you resume, and there's no other state.

The only thing that changes is the swap/image and its signature -- it can't be made read-only because it must be read-only for the kernel which is being resumed, but it's impossible since it is the kernel who writes this image to start with.

Quoted 1 line

As long as you can't guarantee that all of that is in sync, nothing helps.

No one can guarantee this - eg, usb devices might be removed or added while the system is sleeping, and so on.

In my case it is easy to guarantee there's no state changes, because there really aren't. But ofcourse this is a rather rare situation.

Thanks,

/mjt