Working on Suspend to Disk on Pinebook 1080p

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:
sudo fallocate -l 4G /swapfile

Make it a swapfile, make it private to root, and turn it on:

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:

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

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:

# 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!

4 Likes

According to wiki:

More about here
https://wiki.pine64.org/index.php/1080P_Pinebook_Main_Page

But that would be hard to execute, when the ketboard and trackpad does not work. :stuck_out_tongue:

1 Like

In that case i wouldn't look for suspend/hibernate either :grin:

external keyboard.
and combo of shortcuts to increase brightness.
but its a problem either way.

Is there a way to determine why the keyboard isn't working? And/or to have a script run as soon as the machine

external keyboard.
and combo of shortcuts to increase brightness.
but its a problem either way.

I just tried that and it does not work. The system is completely locked up, it looks like. The cursor even does not blink.

have you tried using seperate swap partition
to hibernate.

Hibernation on ARM has always been hit'n'miss.

I hope the situation is better with the Pinebook Pro.

That's sad to hear that hibernation on ARM is often a problem. I would really like to see either a working suspend or a working hibernate for Pinebook as it would probably extend my normal battery life from 1 day to several days.
Do you have any tips as to how I could go about debugging this? I have tried recording dmesg with dmesg > dmesg.log but the last recorded entry is the hibernation event - no information about why the device is failing to work with any of its peripherals upon booting back up.

Just tried this - no change in behaviour.

Forum kindly sponsored by Bytemark