Today, I tested rtcwake on several x86 or x86-64 based computers.
The outcome:
(1) Suspend to RAM (say, "rtcwake -m mem -s 10"): * Success: Every system. (2) Wake-on-timer ("rtcwake -m no -s 120 && shutdown -h now" or "rtcwake -m off -s 120"): * Success: Lenovo Thinkpad X220 (2012?), and a 5-year-old desktop system * Fail: IBM Thinkpad X60 (Core Duo from 2006), a HP Zbook from 2016. (3) Suspend to disk ("rtcwake -m disk -s 120") had no chance of working, because I never configure any swap partition. I would assume that this could only work if (2) worked in the first place. On the Debian systems that I tried, the command would fail as expected. On one Arch Linux system (Lenovo Thinkpad X220), it forcibly power off the computer and fail to start automatically; a file system check ran on the manual power-on.
GNU/Linux is the only operating system on each computer, and apart from the 32-bit Thinkpad X60, everything boots up via UEFI.
In the BIOS setup of both the Thinkpad X60 and the HP laptop there are some settings related to powering up on timer. Maybe with something like nvram-wakeup (which was the only working option for a 2001 Intel Celeron machine) they could be made to work.
Moral of the story: You can't expect wake-on-timer to "just work" even on relatively recent hardware. Possibly the chances are better with desktop or small-form-factor systems than with laptops.
Marko
Reminds me of the nvram-wakeup lotto back in the day.
Am 16. April 2023 19:54:03 MESZ schrieb "Marko Mäkelä" marko.makela@iki.fi:
Today, I tested rtcwake on several x86 or x86-64 based computers.
The outcome:
(1) Suspend to RAM (say, "rtcwake -m mem -s 10"):
- Success: Every system.
(2) Wake-on-timer ("rtcwake -m no -s 120 && shutdown -h now" or "rtcwake -m off -s 120"):
- Success: Lenovo Thinkpad X220 (2012?), and a 5-year-old desktop system
- Fail: IBM Thinkpad X60 (Core Duo from 2006), a HP Zbook from 2016.
(3) Suspend to disk ("rtcwake -m disk -s 120") had no chance of working, because I never configure any swap partition. I would assume that this could only work if (2) worked in the first place. On the Debian systems that I tried, the command would fail as expected. On one Arch Linux system (Lenovo Thinkpad X220), it forcibly power off the computer and fail to start automatically; a file system check ran on the manual power-on.
GNU/Linux is the only operating system on each computer, and apart from the 32-bit Thinkpad X60, everything boots up via UEFI.
In the BIOS setup of both the Thinkpad X60 and the HP laptop there are some settings related to powering up on timer. Maybe with something like nvram-wakeup (which was the only working option for a 2001 Intel Celeron machine) they could be made to work.
Moral of the story: You can't expect wake-on-timer to "just work" even on relatively recent hardware. Possibly the chances are better with desktop or small-form-factor systems than with laptops.
Marko
vdr mailing list vdr@linuxtv.org https://www.linuxtv.org/cgi-bin/mailman/listinfo/vdr
Hallo,
here a longer thread at problems with rtcwake (in German):
https://forum.ubuntuusers.de/topic/rtcwake-geht-nicht-mehr/#post-9369451
Perhaps it might be useful for someone,
GBruno
Am 16.04.23 um 19:54 schrieb Marko Mäkelä:
Today, I tested rtcwake on several x86 or x86-64 based computers.
The outcome:
(1) Suspend to RAM (say, "rtcwake -m mem -s 10"):
- Success: Every system.
(2) Wake-on-timer ("rtcwake -m no -s 120 && shutdown -h now" or "rtcwake -m off -s 120"):
- Success: Lenovo Thinkpad X220 (2012?), and a 5-year-old desktop system
- Fail: IBM Thinkpad X60 (Core Duo from 2006), a HP Zbook from 2016.
(3) Suspend to disk ("rtcwake -m disk -s 120") had no chance of working, because I never configure any swap partition. I would assume that this could only work if (2) worked in the first place. On the Debian systems that I tried, the command would fail as expected. On one Arch Linux system (Lenovo Thinkpad X220), it forcibly power off the computer and fail to start automatically; a file system check ran on the manual power-on.
GNU/Linux is the only operating system on each computer, and apart from the 32-bit Thinkpad X60, everything boots up via UEFI.
In the BIOS setup of both the Thinkpad X60 and the HP laptop there are some settings related to powering up on timer. Maybe with something like nvram-wakeup (which was the only working option for a 2001 Intel Celeron machine) they could be made to work.
Moral of the story: You can't expect wake-on-timer to "just work" even on relatively recent hardware. Possibly the chances are better with desktop or small-form-factor systems than with laptops.
Marko
vdr mailing list vdr@linuxtv.org https://www.linuxtv.org/cgi-bin/mailman/listinfo/vdr
Mon, Apr 17, 2023 at 10:17:03AM +0200, g.bruno wrote:
here a longer thread at problems with rtcwake (in German):
https://forum.ubuntuusers.de/topic/rtcwake-geht-nicht-mehr/#post-9369451
Thank you. I am not going to use rtcwake on those 2 problematic laptops for anything real, but out of curiosity I will experiment a bit more.
One user wrote there that after a reboot, the wakeup time is still there after reboot, but the IRQ is disabled.
The "powertop" tool was not mentioned yet. A possible fix might be to use it to enable power management on the offending devices.
Marko
Mon, Apr 17, 2023 at 04:38:11PM +0300, Marko Mäkelä wrote:
Mon, Apr 17, 2023 at 10:17:03AM +0200, g.bruno wrote:
here a longer thread at problems with rtcwake (in German):
https://forum.ubuntuusers.de/topic/rtcwake-geht-nicht-mehr/#post-9369451
Thank you. I am not going to use rtcwake on those 2 problematic laptops for anything real, but out of curiosity I will experiment a bit more.
One user wrote there that after a reboot, the wakeup time is still there after reboot, but the IRQ is disabled.
The "powertop" tool was not mentioned yet. A possible fix might be to use it to enable power management on the offending devices.
"sudo powertop" indeed fixed the HP laptop. I pressed the TAB key 4 times to get to the "Tunables" screen, then used the up and down arrow keys and the Enter key to toggle each "Bad" to "Good". Near the top of the screen the corresponding command was displayed. Finally, I pressed Esc and waited several seconds to exit the program. Below are a few examples of such tuning advice, from my desktop system:
echo auto > /sys/bus/usb/devices/3-1/power/control echo auto > /sys/bus/pci/devices/0000:09:00.0/power/control echo med_power_with_dipm > /sys/class/scsi_host/host0/link_power_management_policy
The page https://help.ubuntu.com/community/PowerManagement/ReducedPower mentions a tool pm-powersave and some options. That could be useful for making such power-saving changes permanent on startup.
On the IBM Thinkpad X60, fixing the "Bad" things to "Good" was not to enable the wake-up. In the BIOS setup there is a setting that can prohibit power-on-timer when the system is on battery power, to protect an old-fashioned spinning HDD from damage in case the laptop happens to be moving at the wakeup time. I have an SSD, so I had enabled that, and the system was on AC power anyway. But the system did not wake up.
After doing the "powertop", I executed the following to diagnose it: sudo rtcwake -m no -s 300 && sudo reboot sudo rtcwake -m show sudo journalctl -x
The "rtcwake -m show" straight after the reboot indicated that the alarm is off. I read all journal entries between the two rtcwake commands, which were helpfully logged. The only thing I found was a kernel boot message that said that the RTC device supports wakeup from the ACPI S4 state (hibernate, suspend-to-disk). The normal "soft power off" would be S5. So, I will have to shrink the file system and create a swap partition, to enable the suspend-to-disk. I expect that after this exercise, "rtcwake -m disk -s 300" should actually work, perhaps even without using any "powertop" spells.
Marko
Mon, Apr 17, 2023 at 09:14:30PM +0300, Marko Mäkelä wrote:
The "rtcwake -m show" straight after the reboot indicated that the alarm is off. I read all journal entries between the two rtcwake commands, which were helpfully logged. The only thing I found was a kernel boot message that said that the RTC device supports wakeup from the ACPI S4 state (hibernate, suspend-to-disk). The normal "soft power off" would be S5. So, I will have to shrink the file system and create a swap partition, to enable the suspend-to-disk. I expect that after this exercise, "rtcwake -m disk -s 300" should actually work, perhaps even without using any "powertop" spells.
After I shrunk the only partition and created a swap partition, I got "rtcwake -m disk -s 300" to wake up the computer, with no need for any tuning with "powertop". After I fixed the resume settings and rebuilt the initial RAM disk, the computer would correctly wake up from the hibernation, and the exit status of the rtcwake would be 0, as expected. Before I fixed that, the computer powered up, but ran a normal boot sequence, including a file system check.
I am going to create a page https://www.linuxtv.org/vdrwiki/index.php/Rtcwake for documenting this. For commodity x86 or x86-64 hardware, rtcwake seems to actually work, with some quirks.
Assuming that the environment has been set up correctly for rtcwake, I believe that my VDR shutdown script in https://www.linuxtv.org/vdrwiki/index.php/Systemd should work as is. I did not test it yet.
Marko