LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - General (https://www.linuxquestions.org/questions/linux-general-1/)
-   -   how grub knows there is a system in suspend/hibernate state ? (https://www.linuxquestions.org/questions/linux-general-1/how-grub-knows-there-is-a-system-in-suspend-hibernate-state-742782/)

marozsas 07-25-2009 04:28 PM

how grub knows there is a system in suspend/hibernate state ?
 
Dear fellows,

How grub knows there is a system in suspend/hibernate state ?
The amazing is it returns to the previous hibernated/suspend system even if it is windows XP, Vista or Linux, in a triple boot machine.

I expected when I turn on my computer again after I have put a system in hibernate mode, the grub menu shows up, then I select a system, let say, Windows XP, and then the system figures out it was in hibernate mode and resumes.

But it is not in this way this things happens. I do not have a chance to select any option in grub's menu. It starts to resume the previous system whatever it was.

How this works ?

DamjanDimitrioski 07-26-2009 09:56 AM

Quote:

Originally Posted by marozsas (Post 3620208)
Dear fellows,

How grub knows there is a system in suspend/hibernate state ?
The amazing is it returns to the previous hibernated/suspend system even if it is windows XP, Vista or Linux, in a triple boot machine.

I expected when I turn on my computer again after I have put a system in hibernate mode, the grub menu shows up, then I select a system, let say, Windows XP, and then the system figures out it was in hibernate mode and resumes.

But it is not in this way this things happens. I do not have a chance to select any option in grub's menu. It starts to resume the previous system whatever it was.

How this works ?

Well it's a module in initrd, when init starts it calls the hibernation program, which checks for a saved image, if there is one it loads it.
This is only the algorithm, for more read>
http://www.thinkwiki.org/wiki/Softwa...ecreate_initrd

DamjanDimitrioski 07-26-2009 10:01 AM

And for the record, a hibernation is a process which saves the content of the ram memory to a static file as an image, so every OS has some image like that. Then it shutdown the computer.

On the other hand the suspend system is a hardware based, it saves the content of the ram and then it tells the bios to switch to another power level - that is suspend.

marozsas 07-26-2009 10:05 AM

thank you, but I think something happens before that controlled by grub.
In a multiple boot system controlled by grub, if a windows system is put to hibernate, grub "knows" it must boot the windows system which resumes from hibernation - and in this case, initrd has nothing to do with this process.

The same is valid if another linux system is put to hibernate; when you turn on your system againgrub "knows" what system it must call to resume.

So I guess the key here is "grub" but I was unable to find any information about how this works on grub documentation....

DamjanDimitrioski 07-26-2009 10:10 AM

Quote:

Originally Posted by marozsas (Post 3620769)
thank you, but I think something happens before that controlled by grub.
In a multiple boot system controlled by grub, if a windows system is put to hibernate, grub "knows" it must boot the windows system which resumes from hibernation - and in this case, initrd has nothing to do with this process.

The same is valid if another linux system is put to hibernate; when you turn on your system againgrub "knows" what system it must call to resume.

So I guess the key here is "grub" but I was unable to find any information about how this works on grub documentation....

Ok, here is the deal, when you choose to hibernate it disables grub, what ever os disables grub.

See here for a reference>
http://mandrivausers.org/index.php?/...disables-grub/

marozsas 07-26-2009 03:23 PM

Quote:

Originally Posted by DamjanDimitrioski (Post 3620770)
... it disables grub, what ever os disables grub.

Thanks for the link, I checked, but even so, this does not make sense.
Another OS, let say, Windows, does not known anything about grub so it is unlike it could disable it. Think about...

DamjanDimitrioski 07-26-2009 04:12 PM

I dig up this FAQ:
http://wiki.debian.org/Grub#FAQ

marozsas 07-26-2009 04:52 PM

this phrase on the link you provided, DamjanDimitrioski:
Quote:

Originally Posted by http://wiki.debian.org/Grub#FAQ
...GRUB isn't aware that your host is suspended...

is more intriguing. But the question remains, how this work ? If it is not grub, who knows what system must resume ? Than is it the BIOS ? I think this makes sense, specially on the "suspend to ram" case. The BIOS is responsible for resume a system in hibernate mode too ? So the last instruction a system (windows, linux or whatever) does is calling a function on the BIOS (one on those famous interrupts calls) that in fact put a system in hibernate or suspend mode.

I think I will google about any information that could confirm this. This time I will focus on BIOS calls/interrupts.
see'ya,

DamjanDimitrioski 07-27-2009 09:01 AM

I think this answers everything>

http://en.wikipedia.org/wiki/Hibernate_%28OS_feature%29
the OS puts the bios to S4, the power manager i.e the ACPI is doing all the work.

The ACPI has all the information, I believe this is what you were looking for.

If this doesn't help you, it helped me, I learned new stuff :).

marozsas 07-27-2009 02:35 PM

yes, it does, indeed !

now the things are more clear in my head. So, grubs does not have anything to do with hibernate/suspend modes - it is the BIOS which is responsible for start up the OS previously in hibernate/suspend mode.

thank you DamjanDimitrioski for the valuables links. I learned a lot too !

best regards,


All times are GMT -5. The time now is 02:01 PM.