hibernation

classic Classic list List threaded Threaded
16 messages Options
Reply | Threaded
Open this post in threaded view
|

hibernation

Michael Vetter
Hello there,

I use i3 as my window manager and use xfce4-power-manager for saving
battery and stuff on my laptop. Today I tried "hibernation" for the
first time and realized: it does not work.

All I did so far was installing fce4-power-manager selecting some
sections in kernel config that seemed necessary and installed polkit.

However when I close my notebook's lid (I configured xfce4-power-manager
to switch into hibernation in this case) it shuts down, but when i press
the start button, it just does a normal restart.
What am I missing?

Michael

Reply | Threaded
Open this post in threaded view
|

Re: hibernation

Randolph Maaßen


On Dec 3, 2014 11:33 AM, "Michael Vetter" <[hidden email]> wrote:
>
> Hello there,
>
> I use i3 as my window manager and use xfce4-power-manager for saving
> battery and stuff on my laptop. Today I tried "hibernation" for the
> first time and realized: it does not work.
>
> All I did so far was installing fce4-power-manager selecting some
> sections in kernel config that seemed necessary and installed polkit.
>
> However when I close my notebook's lid (I configured xfce4-power-manager
> to switch into hibernation in this case) it shuts down, but when i press
> the start button, it just does a normal restart.
> What am I missing?
>
> Michael
>

Maybe you need to pass the resume-partition parameter to the kernel in the bootloader. Point it to your swap device.

You can boot normal with this parameter set and not hibernated

Reply | Threaded
Open this post in threaded view
|

Re: hibernation

J. Roeleveld
In reply to this post by Michael Vetter
On Wednesday, December 03, 2014 11:32:10 AM Michael Vetter wrote:

> Hello there,
>
> I use i3 as my window manager and use xfce4-power-manager for saving
> battery and stuff on my laptop. Today I tried "hibernation" for the
> first time and realized: it does not work.
>
> All I did so far was installing fce4-power-manager selecting some
> sections in kernel config that seemed necessary and installed polkit.
>
> However when I close my notebook's lid (I configured xfce4-power-manager
> to switch into hibernation in this case) it shuts down, but when i press
> the start button, it just does a normal restart.
> What am I missing?
>
> Michael

To test hibernate try the following:

1) Stop all important stuff
2) run the following as root:
#  echo disk > /sys/power/state

If this works, then you can try to configure a power management tool.
Please also ensure you only have 1 power management tool configured.

--
Joost

Reply | Threaded
Open this post in threaded view
|

Re: hibernation

Marc Stuermer
In reply to this post by Michael Vetter
Am 03.12.2014 um 11:32 schrieb Michael Vetter:

> However when I close my notebook's lid (I configured xfce4-power-manager
> to switch into hibernation in this case) it shuts down, but when i press
> the start button, it just does a normal restart.

Do you want to configure

a) simply hibernation, which means that the RAM is still powered by your
battery and just the rest of the computer is being switched off (CPU,
HDDs and so on)

or

b) suspend to disk, which means that the whole content of the RAM is
being written on your HDD and after that your computer is being shut
down entirely?

Reply | Threaded
Open this post in threaded view
|

Re: hibernation

Michael Vetter
> Maybe you need to pass the resume-partition parameter to the kernel in
the bootloader. Point it to your swap device.

Maybe I should add: I have EFI notebook, and my kernel is copied to
/boot/EFI/Boot/bootx64.efi. So I boot over that EFI thing because it
seemed the easiest thing to set up..

> b) suspend to disk, which means that the whole content of the RAM is
> being written on your HDD and after that your computer is being shut
> down entirely?

Yes, thats what I want to achive.

Reply | Threaded
Open this post in threaded view
|

Re: hibernation

J. Roeleveld
On 4 December 2014 17:30:28 CET, Michael Vetter <[hidden email]> wrote:
>> Maybe you need to pass the resume-partition parameter to the kernel
>in
>the bootloader. Point it to your swap device.
>
>Maybe I should add: I have EFI notebook, and my kernel is copied to
>/boot/EFI/Boot/bootx64.efi. So I boot over that EFI thing because it
>seemed the easiest thing to set up..

You can set the resume partition in the kernel. Might be an option.

>> b) suspend to disk, which means that the whole content of the RAM is
>> being written on your HDD and after that your computer is being shut
>> down entirely?
>
>Yes, thats what I want to achive.

Did you try suspending using the echo command I mentioned earlier?

--
Joost


--
Sent from my Android device with K-9 Mail. Please excuse my brevity.

Reply | Threaded
Open this post in threaded view
|

Re: hibernation

Michael Vetter
> Did you try suspending using the echo command I mentioned earlier?
Yes, it seemed to work (just starting up again didn't).

> You can set the resume partition in the kernel. Might be an option.
Okay, so I changed my kernel command string from "root=/dev/sdb2" to
"root=/dev/sdb2,resume=/dev/mapper/g-SWAP".

Then typed your suspension command again, now the system isn't booting
up anymore: kernel prints trace.

--
Michael

Reply | Threaded
Open this post in threaded view
|

Re: hibernation

Randolph Maaßen
2014-12-04 17:58 GMT+01:00 Michael Vetter <[hidden email]>:
>> Did you try suspending using the echo command I mentioned earlier?
> Yes, it seemed to work (just starting up again didn't).
>
>> You can set the resume partition in the kernel. Might be an option.
> Okay, so I changed my kernel command string from "root=/dev/sdb2" to
> "root=/dev/sdb2,resume=/dev/mapper/g-SWAP".

In my menuconfig I have a space separated list, not comma separated.
So I guess the boot failure is, that the kernel can't find the root
partition /dev/sdb2,resume...

>
> Then typed your suspension command again, now the system isn't booting
> up anymore: kernel prints trace.
>
> --
> Michael
>



--
Mit freundlichen Grüßen / Best regards

Randolph Maaßen

Reply | Threaded
Open this post in threaded view
|

Re: hibernation

Michael Vetter
Am 04/12/14 18:10, schrieb Randolph Maaßen:

> 2014-12-04 17:58 GMT+01:00 Michael Vetter <[hidden email]>:
>>> Did you try suspending using the echo command I mentioned earlier?
>> Yes, it seemed to work (just starting up again didn't).
>>
>>> You can set the resume partition in the kernel. Might be an option.
>> Okay, so I changed my kernel command string from "root=/dev/sdb2" to
>> "root=/dev/sdb2,resume=/dev/mapper/g-SWAP".
>
> In my menuconfig I have a space separated list, not comma separated.
> So I guess the boot failure is, that the kernel can't find the root
> partition /dev/sdb2,resume...

Okay, sorry thought this is equivalent to [1].
Anyways, I changed it to space and my system boots now.
So I tried the suspend command again, but when rebooting its like a
fresh reboot.

Any ideas?

[1] http://man7.org/linux/man-pages/man7/bootparam.7.html

--
Michael

Reply | Threaded
Open this post in threaded view
|

Re: hibernation

J. Roeleveld
On 4 December 2014 18:32:16 CET, Michael Vetter <[hidden email]> wrote:

>Am 04/12/14 18:10, schrieb Randolph Maaßen:
>> 2014-12-04 17:58 GMT+01:00 Michael Vetter
><[hidden email]>:
>>>> Did you try suspending using the echo command I mentioned earlier?
>>> Yes, it seemed to work (just starting up again didn't).
>>>
>>>> You can set the resume partition in the kernel. Might be an option.
>>> Okay, so I changed my kernel command string from "root=/dev/sdb2" to
>>> "root=/dev/sdb2,resume=/dev/mapper/g-SWAP".
>>
>> In my menuconfig I have a space separated list, not comma separated.
>> So I guess the boot failure is, that the kernel can't find the root
>> partition /dev/sdb2,resume...
>
>Okay, sorry thought this is equivalent to [1].
>Anyways, I changed it to space and my system boots now.
>So I tried the suspend command again, but when rebooting its like a
>fresh reboot.
>
>Any ideas?
>
>[1] http://man7.org/linux/man-pages/man7/bootparam.7.html

Yes.
If using LVM for the swap partition (and subsequently the resume) you need to use an initramfs.

I will dig out the script I use on my laptop and post it tomorrow. (It boots faster with a custom script compared to the genkernel or dracut ones)

--
Joost
--
Sent from my Android device with K-9 Mail. Please excuse my brevity.

Reply | Threaded
Open this post in threaded view
|

Re: hibernation

Marc Stuermer
In reply to this post by Michael Vetter
Am 04.12.2014 um 17:30 schrieb Michael Vetter:

> Yes, thats what I want to achive.

The sad thing about hibernation is, that it has always kinda been some
kind of lackluster in the kernel and quite disappointing. It is a kind
of area which does not get much love in the kernel for at least over one
decade.

he number of computers it does not work is bigger than the number of
computers it does work on correctly.

At least last time I tried it it was quite like that. Hibernation is
disabled by default on Ubuntu 14.04, because it is so unreliable and
broken.

In fact, there are three different kind of implementations around namely:

a) the thing in the main line kernel, which seems to work quite subpar,
which is being used by the utility swsusp,
b) something in the user space being called uswsusp,
c) and an alternative implementation for the kernel being named "Tux on
Ice."

Many do consider Tux on Ice the most reliable way to get hibernation up
and running on Linux, unfortunately development seems to be stalled
since always about one year and it is not part of the main line kernel.

So if you want to get this working reliable, good luck. You'll need it.

Reply | Threaded
Open this post in threaded view
|

Re: hibernation

James-2
Marc Stürmer <mail <at> marc-stuermer.de> writes:


> The sad thing about hibernation is, that it has always kinda been some
> kind of lackluster in the kernel and quite disappointing. It is a kind
> of area which does not get much love in the kernel for at least over one
> decade.

> So if you want to get this working reliable, good luck. You'll need it.

Hibernation depends on a myriad of CPU variants, setting and the matching
memory issues. (U)efi is a good place to start your long, arduous journey
of research [1] ; see S4.


I would research the problem and fix it with winblows as the operating
system, if possible; then hope that those setting are not changed
by booting linux. Often you can copy the bios setting from the laptop
and find tools to at least view the contents legibly. It does depend
on the bios. Maybe you need a vendor supplied bios update/downgrade.

Maybe Coreboot, has some old work laying around that is relevant to
your needs [2]. It is mostly a research journey, that may lead
to success or failure. Hard to say, as sometimes the same make and
model of a laptop, has diffent internal components (like firmware, bios
and chips)...


Good hunting!
James



[1] http://technet.microsoft.com/en-us/library/dn387089.aspx

[2] http://www.coreboot.org/Laptop




Reply | Threaded
Open this post in threaded view
|

Re: hibernation

J. Roeleveld
In reply to this post by J. Roeleveld
On Thursday, December 04, 2014 07:52:44 PM J.  Roeleveld wrote:
> On 4 December 2014 18:32:16 CET, Michael Vetter <michael.vetter@uni-
konstanz.de> wrote:

> >Am 04/12/14 18:10, schrieb Randolph Maaßen:
> >> 2014-12-04 17:58 GMT+01:00 Michael Vetter
> >
> ><[hidden email]>:
> >>>> Did you try suspending using the echo command I mentioned earlier?
> >>>
> >>> Yes, it seemed to work (just starting up again didn't).
> >>>
> >>>> You can set the resume partition in the kernel. Might be an option.
> >>>
> >>> Okay, so I changed my kernel command string from "root=/dev/sdb2" to
> >>> "root=/dev/sdb2,resume=/dev/mapper/g-SWAP".
> >>
> >> In my menuconfig I have a space separated list, not comma separated.
> >> So I guess the boot failure is, that the kernel can't find the root
> >> partition /dev/sdb2,resume...
> >
> >Okay, sorry thought this is equivalent to [1].
> >Anyways, I changed it to space and my system boots now.
> >So I tried the suspend command again, but when rebooting its like a
> >fresh reboot.
> >
> >Any ideas?
> >
> >[1] http://man7.org/linux/man-pages/man7/bootparam.7.html
>
> Yes.
> If using LVM for the swap partition (and subsequently the resume) you need
> to use an initramfs.
>
> I will dig out the script I use on my laptop and post it tomorrow. (It boots
> faster with a custom script compared to the genkernel or dracut ones)
Bit later then planned.

The "init" file is the initramfs init-file.
The "config" is what I configure in the kernel:

$ zcat /proc/config.gz | grep initramfs
CONFIG_INITRAMFS_SOURCE="/usr/src/initramfs/config"

There are a few changes you'll need to do:
1) In the "init" file, change the name of the swap-partition you use
2) In the "config" file, change the following paths:
  - init-file
3) In the "config" file, run the command mentioned at the end of the file and
    add the result of the command to the end of the " config " file.

I have been using this config succesfully for over a year on my laptop.

--
Joost

config (5K) Download Attachment
init (975 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: hibernation

J. Roeleveld
In reply to this post by James-2
On Friday, December 05, 2014 03:08:25 PM James wrote:

> Marc Stürmer <mail <at> marc-stuermer.de> writes:
> > The sad thing about hibernation is, that it has always kinda been some
> > kind of lackluster in the kernel and quite disappointing. It is a kind
> > of area which does not get much love in the kernel for at least over one
> > decade.
> >
> > So if you want to get this working reliable, good luck. You'll need it.
>
> Hibernation depends on a myriad of CPU variants, setting and the matching
> memory issues. (U)efi is a good place to start your long, arduous journey
> of research [1] ; see S4.

Not my experience, suspend-to-disk works quite well. The biggest issue was
with certain drivers not being able to re-initialize certain hardware. (Yes, I
am talking about the likes of Nvidia)
With current kernels, it does work though.

> I would research the problem and fix it with winblows as the operating
> system, if possible; then hope that those setting are not changed
> by booting linux. Often you can copy the bios setting from the laptop
> and find tools to at least view the contents legibly. It does depend
> on the bios. Maybe you need a vendor supplied bios update/downgrade.
>
> Maybe Coreboot, has some old work laying around that is relevant to
> your needs [2]. It is mostly a research journey, that may lead
> to success or failure. Hard to say, as sometimes the same make and
> model of a laptop, has diffent internal components (like firmware, bios
> and chips)...

For suspend-to-ram, I agree.
Suspend-to-disk can be handled by the OS.

--
Joost

Reply | Threaded
Open this post in threaded view
|

Re: hibernation

Mick-10
On Saturday 06 Dec 2014 07:41:18 J. Roeleveld wrote:
> > Hibernation depends on a myriad of CPU variants, setting and the matching
> > memory issues. (U)efi is a good place to start your long, arduous journey
> > of research [1] ; see S4.
>
> Not my experience, suspend-to-disk works quite well. The biggest issue was
> with certain drivers not being able to re-initialize certain hardware.
> (Yes, I  am talking about the likes of Nvidia)
> With current kernels, it does work though.

It is not just Nvidia.  Suspend to disk (hybernation) worked fine on my laptop
for years.  Then something changed in the kernel and now although it will
hybernate, waking up causes all sort of failures and crashes.  It is a kernel
bug, I found out that someone reported it last year, but it has not been fixed
yet it seems.

On another PC both hybernation and sleep have gone through a cyclical pattern
of working or not working over the years.  Thankfully now they are working!  
:-)

--
Regards,
Mick

signature.asc (484 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: hibernation

Neil Bothwick
On Sat, 6 Dec 2014 11:15:07 +0000, Mick wrote:

> It is not just Nvidia.  Suspend to disk (hybernation) worked fine on my
> laptop for years.  Then something changed in the kernel and now
> although it will hybernate, waking up causes all sort of failures and
> crashes.  It is a kernel bug, I found out that someone reported it last
> year, but it has not been fixed yet it seems.

I had a similar experience and found it as caused by the ethernet driver.
I added a line to my hibernate script to unload the module before
hibernating and the problem went away.


--
Neil Bothwick

The Japanese call us lazy, but at least we cook our fish!

attachment0 (188 bytes) Download Attachment