LinuxQuestions.org
Review your favorite Linux distribution.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices



Reply
 
Search this Thread
Old 07-25-2009, 05:28 PM   #1
marozsas
Senior Member
 
Registered: Dec 2005
Location: Campinas/SP - Brazil
Distribution: SuSE, RHEL, Fedora, Ubuntu
Posts: 1,393
Blog Entries: 1

Rep: Reputation: 64
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 ?
 
Old 07-26-2009, 10:56 AM   #2
DamjanDimitrioski
LQ Newbie
 
Registered: Sep 2007
Location: Macedonia
Distribution: ArchLinux
Posts: 11

Rep: Reputation: 0
Quote:
Originally Posted by marozsas View Post
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
 
Old 07-26-2009, 11:01 AM   #3
DamjanDimitrioski
LQ Newbie
 
Registered: Sep 2007
Location: Macedonia
Distribution: ArchLinux
Posts: 11

Rep: Reputation: 0
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.

Last edited by DamjanDimitrioski; 07-26-2009 at 11:02 AM. Reason: s/safe/saves
 
Old 07-26-2009, 11:05 AM   #4
marozsas
Senior Member
 
Registered: Dec 2005
Location: Campinas/SP - Brazil
Distribution: SuSE, RHEL, Fedora, Ubuntu
Posts: 1,393
Blog Entries: 1

Original Poster
Rep: Reputation: 64
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....
 
Old 07-26-2009, 11:10 AM   #5
DamjanDimitrioski
LQ Newbie
 
Registered: Sep 2007
Location: Macedonia
Distribution: ArchLinux
Posts: 11

Rep: Reputation: 0
Quote:
Originally Posted by marozsas View Post
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/
 
Old 07-26-2009, 04:23 PM   #6
marozsas
Senior Member
 
Registered: Dec 2005
Location: Campinas/SP - Brazil
Distribution: SuSE, RHEL, Fedora, Ubuntu
Posts: 1,393
Blog Entries: 1

Original Poster
Rep: Reputation: 64
Quote:
Originally Posted by DamjanDimitrioski View Post
... 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...
 
Old 07-26-2009, 05:12 PM   #7
DamjanDimitrioski
LQ Newbie
 
Registered: Sep 2007
Location: Macedonia
Distribution: ArchLinux
Posts: 11

Rep: Reputation: 0
I dig up this FAQ:
http://wiki.debian.org/Grub#FAQ
 
Old 07-26-2009, 05:52 PM   #8
marozsas
Senior Member
 
Registered: Dec 2005
Location: Campinas/SP - Brazil
Distribution: SuSE, RHEL, Fedora, Ubuntu
Posts: 1,393
Blog Entries: 1

Original Poster
Rep: Reputation: 64
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,
 
Old 07-27-2009, 10:01 AM   #9
DamjanDimitrioski
LQ Newbie
 
Registered: Sep 2007
Location: Macedonia
Distribution: ArchLinux
Posts: 11

Rep: Reputation: 0
Smile

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 .

Last edited by DamjanDimitrioski; 07-27-2009 at 10:02 AM. Reason: s/help/helped
 
Old 07-27-2009, 03:35 PM   #10
marozsas
Senior Member
 
Registered: Dec 2005
Location: Campinas/SP - Brazil
Distribution: SuSE, RHEL, Fedora, Ubuntu
Posts: 1,393
Blog Entries: 1

Original Poster
Rep: Reputation: 64
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,
 
  


Reply

Tags
grub, hibernate, suspend


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
how to detect system power event(user trigger),suspend,hibernate,resume...? minge.zu Linux - Desktop 1 02-11-2009 09:19 PM
cannot login after hibernate/suspend homyangcha Linux - Newbie 2 01-21-2009 01:17 AM
Hibernate/suspend with two swap partitions ordealbyfire83 Linux - Hardware 8 07-30-2007 01:11 PM
Possible Suspend/HIbernate fix angryfirelord Linux - Hardware 0 07-20-2007 07:46 PM
suspend a.k.a hibernate on kernel 2.6, how to use it? demmylls Linux - General 1 03-06-2004 01:06 PM


All times are GMT -5. The time now is 07:33 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration