Hibernation (suspend to disk) progress
#1
I have spent the last few days working on getting suspend to disk (hibernate) working, to improve battery life, since suspend to RAM does not improve it that much. I have it working now, with one major caveat. I am doing this on Manjaro ARM but the process should be similar on any OS.

First, it is necessary to create a swapfile using normal techniques. Allocate a swapfile (we'll call it /swapfile), set it as swap, and place an entry for it in /etc/fstab.

Create a 4GB file:
Code:
sudo fallocate -l 4G swapfile

Make it a swapfile, make it private to root, and turn it on:
Code:
sudo mkswap /swapfile
sudo chmod 0600 /swapfile
sudo swapon /swapfile

Then, add it to fstab, with the line "/swapfile swap swap defaults 0 0".

Now we need to add the resume hook to the initcpio. In /etc/mkinitcpio.conf, change the HOOKS line to include the hook resume:


Code:
HOOKS=(base udev autodetect modconf block resume filesystems keyboard fsck)

Now we need to edit the kernel's command line to include the resume target. First we need the UUID and the offset of the file.

Get the UUID with

Code:
sudo findmnt -no SOURCE,UUID -T /swapfile
And the offset by looking at the first row of sudo filefrag -e /swapfile, looking at the first column marked physical_offset. This tells the kernel where on the given block device to look.

These values need to be put into the kernel command line in /boot/boot.txt like so:


Code:
# Original line
setenv bootargs console=${console} console=tty0 root=PARTUUID=${uuid} rw rootwait
# New line
setenv bootargs console=${console} console=tty0 root=PARTUUID=${uuid} rw rootwait resume=UUID=29a4df6e-1531-4e1b-be79-82bd21f849ff resume_offset=2727936
Then you need to generate a new uboot script by running sudo /boot/mkscr followed by sudo mkinitcpio -P to regenerate the modified initcpio.

Now the machine will hibernate and resume! Try it with systemctl hibernate.

HOWEVER. In my case, when the system resumes, the screen image is as expected, but the screens brightness is at minimum and neither the keyboard or the trackpad work. I have to hard power off the machine and reboot.

If we can solve this problem, Pinebook can have working suspend-to-disk!
Leonora Tindall | https:///nora.codes
Pinebook 1080p / Pinebook Pro / Pinephone UBPorts CE


Messages In This Thread
Hibernation (suspend to disk) progress - by NoraCodes - 09-25-2019, 11:30 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Pinebook will not wake from suspend MECZero 6 8,561 12-02-2018, 12:17 PM
Last Post: oloturia
  Wifi applet after resume from suspend Luke 13 15,023 10-01-2017, 05:26 AM
Last Post: maya.b

Forum Jump:


Users browsing this thread: 1 Guest(s)