I'm running 18.04 and trying to have my system use hibernate instead of pm-hibernate when my laptop's lid closes.
I have a swap partition of 20GB on 16GB of RAM, so ample space.
When I use pm-hibernate, I get a small apci error that pops up very quickly when both hibernating and restoring that I cannot read. While the hibernate works in the sense it seems to dump to disk and restore from disk, it seems to be a sleep state in that it uses battery at a normal rate, rather than shutting down completely and ceasing battery use.
However, when I use the hibernate installed by:
sudo apt-get install hibernate
And run:
sudo hibernate
And restore from that, I notice my machine does in fact shutdown---the LEDs stop throbbing, etc---and battery usage goes to zero. This is the behavior I would like to see when my lid closes, not the sleep behavior that uses battery as if I were making active use of the computer.
I have followed these guides:
modified
/etc/systemd/logind.conf
to include:
#HandleLidSwitch=suspend
HandlelidSwitch=hibernate
And added my swap partition change in:
/etc/default/grub
To include the correct resume= link, and requested s2disk specifically with:
sudo cat /etc/pm/config.d/00sleep_module
SLEEP_MODULE="swsusp"
I have read the following related askubuntus:
- Hibernate on lid close
- Ubuntu 17.04 hibernate works but pm-hibernate does not
- Laptop locks screen instead of hibernates
- how to make linux prefer sudo pm-hibernate over systemctl hibernate as default?
- Sleep mode consumes as much as battery as when laptop is in use
- Replacing default hibernate method to s2disk
I have also read these links on Lenovo and Arch forums:
- https://forums.lenovo.com/t5/Linux-Discussion/X1-Carbon-Gen-6-cannot-enter-deep-sleep-S3-state-aka-Suspend-to/td-p/3998182/page/4
- https://forums.lenovo.com/t5/Linux-Discussion/X1-Gen6-Massive-battery-drain-in-suspend-No-deep-sleep-support/m-p/3997789
- https://wiki.archlinux.org/index.php/Lenovo_ThinkPad_X1_Carbon_(Gen_6)
- https://wiki.archlinux.org/index.php/Power_management/Suspend_and_hibernate
How can I make sure the that the hibernate called by lid-close is hibernate not pm-hibernate?
Update
This is still a problem and still makes the Carbon X1 6th gen fundamentally useless with ubuntu. Any solutions that could fix this and maybe additionally add a login prompt might be almost as good as a Windows machine from 4 years ago... ;)
I too hate having to pass a URL so I will copy and paste the information and attach the web page to the bottom. I do not see this in your link.
While reading this, I noticed that hibernation may not work if you formatted with btrfs file system? So, how is hibernation permanently enabled in Ubuntu 16.04?
To make the Ubuntu hibernation process permanent, you need to create a new file using a text editor on the command line:
The system requires root privileges to enable the hibernation option, hence, the command sudo should be added. You can use other text editors like vi, gedit, emacs, etc.
Now, copy and paste the following text to a file (use the mouse; keyboard shortcuts won’t work):
Press CTRL+O to save, and CTRL+X to exit the nano editor.
Now, logout of your system and then login again. You will now see a hibernate option, along with the Shut Down and Suspend options.
The link for your convenience is: https://fossbytes.com/enable-disable-hibernate-option-ubuntu-power-menu/
Two options
The first option (listed second) is to review
journalctl
for possible error messages related to hibernation. If the first option doesn't produce results the second option is to create a wrapper script that replacespm-hibernate
with `hibernate.Create Wrapper script
Creating a wrapper script allows
hibernate
to replacepm-hibernate
.Find directories commands are located in
Before creating wrapper script you need to know which directories the
hibernate
andpm-hibernate
commands reside. Use these two commands:The wrapper script you want to create will be
/usr/sbin/pm-hibernate
. I don't have thehibernate
package installed so the first search only finds a Windows utility. According to package file listing, it should reveal/usr/sbin/hibernate
along with a couple of other files.Backup original file
First we want to make an on-line backup copy of the original file:
Next delete the original file:
Create wrapper script
Note: instead of a wrapper script many find it easier to create a symbolic link for
pm-hibernate
tohibernate
: How to create a soft or symbolic link?I like to use
gedit
for editing but you can replace it withnano
orvim
or whichever editor you prefer:An empty file will appear. Paste in the following lines
Convert wrapper script to executable
Currently the wrapper script is a regular file. We need to convert it to an executable object:
We now have an operational wrapper script so every time
pm-hibernate
is calledhibernate
runs instead. As mentioned at the top though, you should reviewjournalctl
first (described next) before creating a wrapper script.Review
journalctl
You can
grep
the hibernation messages injournalctl
for possible problems.I don't use hibernate but I do use suspend. The following command allows me to see all messages pertaining to
suspend
which you would replace withhibernate
: