...
I sometimes prefer to hibernate my system, but unfortunately on one of my default Mi3 install machines hibernation wasn't working. This may be because in this instance I didn't use a separate swap partition and instead opted to simply use a swap file for swap needs.
First just check that you can hibernate (mod+0
, followed by h
). If you can, then there's no need to do the below. If you can't, continue (below).
Let's first enable hibernation. To setup hibernate we're going to install the hibernator
package and run it as root:
Code Block |
---|
sudo pacman -S hibernator
sudo hibernator |
Once the hibernator script has run you should have the requirements for hibernate to work.
If you're using a swap file (as opposed to a swap partition) then we'll need to do a bit more work. I assume there that you're using grub as you're boot loader.
We're going to be editing /etc/default/grub
. Note that there is scope here to mess things up royally. So, let's backup our current grub file to be safe(r)
Code Block | ||
---|---|---|
| ||
sudo cp /etc/default/grub /etc/default/grub.backup |
So, before we can edit our grub, we need a few pieces of information:
- device name of parition where have swap file;
- physical offset of
/swapfile
(which is my swap file).
For (1), we can simply run df
and find the partition where our swap file is (which will usually be the same partition as Mi3 is installed to). In my case, running dfoutputs:
The partition where I have Mi3 installed is /dev/sda3
.
For (2), we can run:
Code Block | ||
---|---|---|
| ||
sudo filefrag -v /swapfile |
For my system doing so outputs:
The value we are after is the ext 0 physical offset (first value of physical_offset
) as shown in the image (red rectangle).
With these pieces of information let's now edit our grub
Code Block | ||
---|---|---|
| ||
sudo nano /etc/default/grub |
We want to find the lines starting with GRUB_CMDLINE_LINUX
(which was line 5 in my case) and add the following with the bits of information previously outlined:
Code Block |
---|
GRUB_CMDLINE_LINUX="resume=/dev/sda3 resume_offset=249856" |
Now, we can save our changes and then run
Code Block | ||
---|---|---|
| ||
sudo update-grub |
See Use a swap file and enable hibernation on Arch Linux - including on a LUKS root partitionReboot and hibernation should hopefully now be working. GIve it a go.
Stop 2018 Razer Blade 15 waking right after sleep
...