On Thu, Apr 14, 2016 at 9:25 PM, Andrei Borzenkov
15.04.2016 04:35, Carlos E. R. пишет:
On 2016-04-15 01:50, Chris Murphy wrote:
I don't know the details of how a Linux hibernation image is properly restored. Can someone explain that? The hibernation image is written to the swap partition, I get that part, and there is a resume= hint as a boot parameter. So the system basically cold boots up, the bootloader is executed, and runs the proper boot menu entry that includes that resume= parameter,
Without displaying the menu. That's important. The user must not try to boot anything else.
but also includes loading the kernel and the initramfs. Now what? The kernel knows to look for the hibernation image at the resume= defined swap location?
Yes
And it ignores the initramfs?
No.
This will not work without initramfs, see below.
Does the kernel to any kind of sanity checking to make sure it's restoring the correct hibernation file?
Yes, but I don't know what exactly it checks.
At least kernel version is checked.
While this is not sufficient, at the very least I'd like to think that the kernel can compare its signing key to that of the one inside the hibernation image before committing to resume. If they don't match, for sure the kernel should panic before trying to write anything to disk.
Basically, the kernel starts to boot. It knows that there is the possibility that it has to read an hibernation image; at some point in boot, it suddenly checks that image. If valid, it loads that image into memory, in the position in memory that everything should be
Today this first attempt almost universally fails because resume= parameter refers to udev links that kernel itself cannot resolve. So initramfs has code to trigger this attempt once more after udev runs and links are created but before it attempts to mount root. In this case it simply passes to kernel major:minor of resume device.
Interesting. What about resume= to the swap's UUID set with mkswap and reported by blkid? Seems like that would be a lot more reliable. And if it is more reliable, why isn't that the default boot parameter setting? -- Chris Murphy -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org To contact the owner, e-mail: opensuse+owner@opensuse.org