[GTALUG] TIL: rtcwake / wakealarm

Stewart C. Russell scruss at gmail.com
Sun Apr 11 18:04:22 EDT 2021


On 2021-04-11 2:28 p.m., Giles Orr via talk wrote:
> 
>     # rtcwake --date +5min --mode mem
> 
> I chose "--mode mem" because this machine has often and successfully
> been suspended to RAM.

Hi Giles - thanks for the report. I stayed away from using rtcwake,
partly because of the report of it not working for the Raspberry Pi
user. What I did - on my main Ubuntu laptop - at around 19:47 as root:

  echo  0 > /sys/class/rtc/rtc0/wakealarm
  echo `date +%s -d'19:50'` > /sys/class/rtc/rtc0/wakealarm

I then used my normal shutdown procedure. I did not suspend in any way.

At a couple of seconds before the requested 19:50 bootup time, my laptop
powered up normally.

> Presumably it would work fine on a Raspberry Pi as it came from a Pi
> forum and they're a fairly homogeneous form of hardware.

The hardware of the Raspberry Pi may be, but since none of them have an
RTC built in, they have very different RTC options. Any chip you use you
have to configure via I²C. Some of the chips that work as RTCs don't
have alarm/wake-up capabilities. The DS3231 used in the original example
is a bit of a step-up from most PC's RTCs.

(There is a Raspberry Pi with a built-in RTC - the Raspberry Pi Pico
micro controller board. It's rather hard to give it external battery
power, though, so it's not very useful.)

cheers,
 Stewart




More information about the talk mailing list