2

I need to get my Pi4 running Raspbian to sleep or hibernate. The when I type the commands systemctl suspend or systemctl hibernated I get the error 'not supported'. Is it possible to enable this functionality? Or is there another way to do this?

My goal is to get the Pi4 to boot as fast as possible. Current, it takes 30 seconds.

My Pi4 has is the 2gig version.

Please help. Thanks!

3
  • 1
    not supported is pretty clear ... if your goal is to boot fast, look at cmdline.txt and config.txt options that can improve boot speed a bit Commented Apr 16, 2020 at 11:18
  • Does this answer your question? How to hibernate/suspend rapberry pi?
    – itiic
    Commented Apr 16, 2020 at 11:20
  • 30 seconds for an RPi4 to boot sounds like an awfully long time. Are you spinning up a lot of services at boot time?
    – Seamus
    Commented Apr 19, 2020 at 0:45

1 Answer 1

7

Raspbian kernel is built without CONFIG_HIBERNATION which is needed to provide the necessary interfaces for systemctl. You will have to build a custom kernel to enable those interfaces. You will also need a swap partition which is at least as big as your RAM size (2GB) for the hibernation to actually work, and you need to make sure the kernel command line is updated before power-off so that the kernel knows it must resume from swap instead of a regular boot. I don't think systemctl is aware of /boot/config.txt.

Another issue making hibernation less practical is the Pi power management after shutdown. You'll need to configure the Pi bootloader with POWER_OFF_ON_HALT to actually get the power consumption down, and once you do that, you need to either toggle the GLOBAL_EN node (HI-LO-HI), or unplug and re-plug the power to boot again.

Note that @goldilocks have tried enabling hibernation on a Pi, and it didn't work. See his comment below.

Suspending to RAM and standby (or power-on suspend) additionally require hardware support (ACPI/APM or the like) which AFAIK is missing on Raspberries, so even if you get the command accepted by systemctl, there will be no reduction in power consumption.

The simplest thing you can do is to leave the Pi running: it doesn't consume that much power in the first place, and there will be no boot time at all when you need it.

20
  • Thanks Dmitry. That explains a lot. I have a Witty Pi hat for my Pi4. This hat can control shutdown and startup and can be triggered via an external source. Have it set up to turn on where there is an external power source and to shut down gracefully when the external power source is turned off. I want it to hibernate instead of shutting off. I will start by looking into building my own kernal (sounds very daunting) and including CONFIG_HIBERNATION. I also need to create the swap partition of 2GB. How to resume from swap is the question. Thanks!
    – Sarphati
    Commented Apr 16, 2020 at 13:40
  • 1
    Interesting answer - I've long been curious re the absence of any hibernate or sleep mode for RPi - even though such a mode appears to be required by regulations that were inspired by the One Watt Initiative. I've done some reading, and it now seems to me that the kernel has all of the necessary plumbing to do this (e.g. systemd-logind), but the RPi side of this interface does not.
    – Seamus
    Commented Jul 15, 2021 at 5:31
  • 1
    "You will have to build a custom kernel to enable those interfaces." I have tried this, it does not work, unfortunately (and I've been doing that with linux since before the Pi existed). I was firmly of the opinion that the way hibernate works does not require any hardware support -- it's just saving the memory state to the storage and then loading it again at boot. Normally, power can be completely removed from a system that has been put into hibernate (it can just end with a normal shutdown, right?). But for whatever reason it fails on the Pi (I don't remember what actually happens).
    – goldilocks
    Commented Jul 16, 2021 at 13:49
  • 1
    @Seamus "the kernel has all of the necessary plumbing to do this (e.g. systemd-logind)" 1) Systemd is not part of the kernel and logind is not required to perform suspend or hibernate (you don't need any init system at all; see documentation for /sys/power/state). 2) WRT to hibernate, the stock pi kernel certainly does not have the necessary bits built in, last I checked. You can confirm this via sudo modprobe configs; gunzip -c /proc/config.gz | HIBERNAT, no E on the end to catch -ION and -E; the result is interesting but negative).
    – goldilocks
    Commented Jul 16, 2021 at 14:03
  • 1
    I don't use swap files. I put a partition at the end of the card. Also, I would almost certainly have used /sys/power/state, although there is a thin chance I might have used systemd hibernate. If I get time in the next few days I may do this again just to nail the problem down better.
    – goldilocks
    Commented Jul 17, 2021 at 20:04

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.