Difference between revisions of "ACPI Wakeup"
Kurtkimber (talk | contribs) (Changed focus to "/sys/class/rtc/rtc0/wakealarm" and made "/proc/acpi/alarm" mostly archival. I intend to do more editting later today (31 May 2009).) |
Kurtkimber (talk | contribs) (Changed focus to "/sys/class/rtc/rtc0/wakealarm" and made "/proc/acpi/alarm" mostly archival. Lots of re-arranging. Also cleanup editing.) |
||
Line 5: | Line 5: | ||
== Introduction == | == Introduction == | ||
− | Most users tend to leave their mythTV system running 24 by 7. This page describes the options you have in Linux to | + | Most users tend to leave their mythTV system running 24 by 7. This page describes the options you have in Linux to shutdown and automatically wakeup your machine before a recording. A glance at your last electricity bill shows you just how expensive electricity is. You can save energy, money and reduce your carbon footprint. ([http://w3.linux-magazine.com/issue/46/Wakeup_Call_For_Computers.pdf read more]) |
− | shutdown and automatically wakeup your machine before a recording. A glance at your last electricity bill | ||
− | shows you just how expensive electricity is. You can save energy | ||
{{SUSE_head| Your options:}} | {{SUSE_head| Your options:}} | ||
− | * Hardware time switch - a cheap power switch and a simple cronjob to shutdown the machine can do | + | * Hardware time switch - a cheap power switch and a simple cronjob to shutdown the machine can do the job |
− | * Wake On LAN - have another machine on your network wake your mythTV machine. ([[Wake-on-LAN|See the Wake on LAN mythTV | + | * Wake On LAN - have another machine on your network wake your mythTV machine. ([[Wake-on-LAN|See the "Wake on LAN" mythTV HowTo]]) |
− | * Use the BIOS - most machines have an option in the BIOS for time-controlled booting - this | + | * Use the BIOS - most machines have an option in the BIOS for time-controlled booting - this option is the subject of this HowTo |
− | {{SUSE_head| Use the BIOS: }} | + | {{SUSE_head| Use the BIOS:}} |
− | MythTV has a | + | MythTV has a great standard option to write the date and time of the next recording to the BIOS. This allows your machine to automatically shutdown (or suspend) and turn on again a few minutes before it needs to record again. The Advanced Configuration and Power Interface (ACPI) specification is an open industry standard first released in December 1996 developed by HP, Intel, Microsoft, Phoenix, and Toshiba that defines common interfaces for hardware recognition, motherboard and device configuration and power management. |
− | The Advanced Configuration and Power Interface (ACPI) specification is an open industry standard first released in December 1996 developed by HP, Intel, Microsoft, Phoenix, and Toshiba that defines common interfaces for hardware recognition, motherboard and device configuration and power management. | + | |
+ | The ACPI Real Time Clock (RTC) Alarm function can be used by your mythTV system to wake up your machine at a certain date and time. | ||
+ | |||
+ | |||
+ | {{SUSE_head| Steps to 'Use the BIOS' to access the ACPI RTC Alarm function:}} | ||
+ | # Configure your BIOS | ||
+ | # Disable HWclock updates | ||
+ | # Configure mythTV | ||
+ | |||
− | |||
== BIOS setup == | == BIOS setup == | ||
− | If you want to use ACPI to wake up your mythTV system, you first need to ensure that your | + | If you want to use ACPI to wake up your mythTV system, you first need to ensure that your BIOS supports this functionality. Check your BIOS for the wakeup alarm function. This setting is likely found under a sub-menu of "Power Management Setup" "APM", or "Advanced" - you just need to poke around to find it. It will likely be called something like Wake From Alarm, Power-on by Alarm, Wake from RTC, RTC Resume, etc. |
− | BIOS | + | |
− | This setting is likely found under a sub-menu of "Power Management" "APM", or "Advanced" - you just need to poke around to find it. It will likely be called something like Wake from RTC | + | |
+ | {{SUSE_head| UTC, localtime and BIOS date format}} | ||
+ | |||
+ | If supported by your BIOS, set the time to UTC (Coordinated Universal Time). If not supported in the BIOS you need to recalculate the time before you write it to the BIOS. (There are an integer number of hours difference between UTC and local time.) | ||
+ | |||
+ | |||
+ | == Disable HWclock updates == | ||
+ | On most machines it's required to make a small change to the Linux shutdown procedure. When your machine shuts down, most | ||
+ | Linux distributions write the system time/data back to the BIOS. On MANY machines, the machine never wakes-up after this time/data update. It is recommended to make this change before you start. | ||
+ | |||
+ | The reason for this recommendation is that most Linux distributions write the current system time back to the BIOS when shutting down the machine, and with some BIOSes, the machine will not wake up if the hardware clock is modified after the wakeup alarm timer has been set. To avoid this, it is necessary to disable the writing of the current system time to the hardware clock in the system shutdown scripts. This is distribution specific, so here are some examples: | ||
+ | |||
+ | |||
+ | ; | ||
+ | ;[[Image:Gentoo.png|25px]] Gentoo | ||
+ | Set clock_systohc to "NO" in <code>/etc/conf.d/clock</code>: | ||
+ | {{Code box|/etc/conf.d/clock|<pre> | ||
+ | # Set CLOCK to "UTC" if your system clock is set to UTC (also known as | ||
+ | # Greenwich Mean Time). If your clock is set to the local time, then | ||
+ | # set CLOCK to "local". Note that if you dual boot with Windows, then | ||
+ | # you should set it to "local". | ||
+ | clock="UTC" | ||
+ | |||
+ | # If you want to set the Hardware Clock to the current System Time | ||
+ | # during shutdown, then say "YES" here. | ||
+ | # You normally don't need to do this if you run a ntp daemon. | ||
+ | clock_systohc="NO" | ||
+ | # If you wish to pass any other arguments to hwclock during bootup, | ||
+ | # you may do so here. Alpha users may wish to use --arc or --srm here. | ||
+ | clock_args="" | ||
+ | </pre>}} | ||
− | |||
− | |||
+ | ;[[Image:Geeko_head48.png|25px]] openSUSE | ||
+ | modifying <code>/etc/sysconfig/clock</code> holds a switch to write back system time to the hardware clock | ||
+ | {{Code box|/etc/sysconfig/clock|<pre> | ||
+ | # Set to "-u" if your system clock is set to UTC, and to "--localtime" | ||
+ | # if your clock runs that way. | ||
+ | # | ||
+ | HWCLOCK="-u" | ||
+ | |||
+ | SYSTOHC="no" | ||
+ | # Is set to "yes" write back the system time to the hardware | ||
+ | # clock at reboot or shutdown. Usefull if hardware clock is | ||
+ | # much more inaccurate than system clock. Set to "no" if | ||
+ | # system time does it wrong due e.g. missed timer interrupts. | ||
+ | # If set to "no" the hardware clock adjust feature is also | ||
+ | # skipped because it is rather useless without writing back | ||
+ | # the system time to the hardware clock. | ||
+ | |||
+ | </pre>}} | ||
+ | |||
+ | |||
+ | ;[[Image:Debianlogo.png|18px]] Debian (and Ubuntu) | ||
+ | modifying <code>/etc/default/rcS</code> with the following will fix this problem: | ||
+ | {{Code box|/etc/default/rcS|<pre># | ||
+ | # /etc/default/rcS | ||
+ | # | ||
+ | # Default settings for the scripts in /etc/rcS.d/ | ||
+ | # | ||
+ | # For information about these variables see the rcS(5) manual page. | ||
+ | # | ||
+ | # This file belongs to the "initscripts" package. | ||
+ | |||
+ | TMPTIME=0 | ||
+ | SULOGIN=no | ||
+ | DELAYLOGIN=no | ||
+ | UTC=no | ||
+ | VERBOSE=no | ||
+ | FSCKFIX=no | ||
+ | ==> HWCLOCKACCESS=no | ||
+ | </pre>}} | ||
+ | |||
+ | |||
+ | ;[[Image:Fedora.png|25px]] Fedora Core 6 | ||
+ | modifying <code>/etc/init.d/halt</code> with the following will fix this problem: | ||
+ | {{Code box|/etc/init.d/halt|<pre> | ||
+ | |||
+ | ==> ACPITIME=`cat /proc/acpi/alarm` | ||
+ | |||
+ | [ -x /sbin/hwclock ] && action $"Syncing hardware clock to system time" /sbin/hwclock $CLOCKFLAGS | ||
+ | |||
+ | ==> echo "$ACPITIME" > /proc/acpi/alarm | ||
+ | |||
+ | </pre>}} | ||
− | |||
− | |||
== Which kernel are you using? == | == Which kernel are you using? == | ||
Line 41: | Line 124: | ||
uname -a | uname -a | ||
− | * | + | * Kernels 2.6.22 and newer use /sys/class/rtc/rtc0/wakealarm - [[#Using /sys/class/rtc/rtc0/wakealarm|see "Using /sys/class/rtc/rtc0/wakealarm", next]] |
− | * | + | * Kernels 2.6.21 and older use /proc/acpi/alarm - [[#Using /proc/acpi/alarm|see "Using /proc/acpi/alarm", below]] |
Line 55: | Line 138: | ||
Beginning with kernel 2.6.22, ACPI uses /sys/class/rtc/rtc0/wakealarm. | Beginning with kernel 2.6.22, ACPI uses /sys/class/rtc/rtc0/wakealarm. | ||
− | # Instead of accepting a formatted time, wakealarm accepts the number of seconds since Jan 1, 1970 | + | # Instead of accepting a formatted time, wakealarm accepts the number of seconds since Jan 1, 1970 (this is known as "unix time", "POSIX time" or "epoch time"). |
− | + | # You have to make sure that your BIOS clock is set to UTC time - not localtime - otherwise it will wakeup at the wrong time. None the less it is still possible if the BIOS clock is set to localtime (likely if you also run windows), see the section below for how to set the alarm correctly when the BIOS clock is in localtime. | |
− | # You have to make sure that your | + | # If you want to change the wakealarm time, you will need to write the new wakealarm time to the BIOS. |
If you can't find /sys/class/rtc/rtc0/wakealarm, and you're running a modular kernel, it might be the case that the correct module is not loaded. In that case, make sure the rtc module is unloaded, and then load the rtc-cmos module: | If you can't find /sys/class/rtc/rtc0/wakealarm, and you're running a modular kernel, it might be the case that the correct module is not loaded. In that case, make sure the rtc module is unloaded, and then load the rtc-cmos module: | ||
Line 65: | Line 148: | ||
=== Initiate manually === | === Initiate manually === | ||
− | For an successful manual test you first need to | + | For an successful manual test you first need to verify your Linux kernel is 2.6.22 or newer and Disable HWclock updates as described in the above [[#Disable HWclock updates|section]] of this article. |
{{SUSE_head|Simple test to wake the machine 5 minutes from now}} | {{SUSE_head|Simple test to wake the machine 5 minutes from now}} | ||
sudo sh -c "echo 0 > /sys/class/rtc/rtc0/wakealarm" | sudo sh -c "echo 0 > /sys/class/rtc/rtc0/wakealarm" | ||
Line 74: | Line 157: | ||
cat /proc/driver/rtc | cat /proc/driver/rtc | ||
− | This should return a list of parameters. Check the alrm_time is 5 minutes into the future and the alrm_date is today. Shutdown your computer and see if it comes back up in ~5 min. | + | This should return a list of parameters. Check the "alrm_time" is 5 minutes into the future and the "alrm_date" is today. Shutdown your computer and see if it comes back up in ~5 min. Note that this command is a powerful debugging tool, letting you see what is currently in the BIOS. |
sudo shutdown -h now | sudo shutdown -h now | ||
− | {{SUSE_head|Sample to convert to | + | {{SUSE_head|Sample to convert to epoch and set date/time}} |
echo 0 > /sys/class/rtc/rtc0/wakealarm | echo 0 > /sys/class/rtc/rtc0/wakealarm | ||
date -u --date "Jul 1, 2008 10:32:00" +%s > /sys/class/rtc/rtc0/wakealarm | date -u --date "Jul 1, 2008 10:32:00" +%s > /sys/class/rtc/rtc0/wakealarm | ||
Line 91: | Line 174: | ||
{{SUSE_head|Setting alarm when bios clock is in localtime}} | {{SUSE_head|Setting alarm when bios clock is in localtime}} | ||
− | The | + | The BIOS clock is in localtime, however wakealarm must be given a UTC time. |
− | To get a UTC time in seconds since epoch for a local time that we want | + | To get a UTC time in seconds since epoch for a local time that we want mythTV to wake up we do the following. We pass the local time that we want to wake up as --date "2008-12-22 10:45:00", we indicate we want it reported as UTC time with -u, and we indicate we want it reported as seconds since epoch with +%s. |
date -u --date "2008-12-22 10:45:00" +%s | date -u --date "2008-12-22 10:45:00" +%s | ||
Line 133: | Line 216: | ||
periodic_freq : 1024 | periodic_freq : 1024 | ||
batt_status : okay | batt_status : okay | ||
+ | |||
=== Integrate into mythTV === | === Integrate into mythTV === | ||
Line 178: | Line 262: | ||
If you use your machine as a desktop and you do not want to keep the front end running while you use your computer for other things, create the following script | If you use your machine as a desktop and you do not want to keep the front end running while you use your computer for other things, create the following script | ||
{{Code box|/usr/bin/checklogin.sh|<pre> | {{Code box|/usr/bin/checklogin.sh|<pre> | ||
− | #Check to see if anyone is currently logged in. Return zero if not and 1 if so. | + | # Check to see if anyone is currently logged in. Return zero if not and 1 if so. |
− | #Echoed text appears in log file. It can be removed and --quiet added to the grep command once you are satisfied that mythTV is working properly | + | # Echoed text appears in log file. It can be removed and --quiet added to the |
+ | # grep command once you are satisfied that mythTV is working properly | ||
if | if | ||
last | grep "still logged in" | last | grep "still logged in" | ||
Line 201: | Line 286: | ||
This will prevent myth from shutting down when someone is logged in | This will prevent myth from shutting down when someone is logged in | ||
− | You must remember to log out rather than shut down when you are done with your session, allowing | + | You '''must''' remember to log out rather than shut down when you are done with your session, allowing the mythTV backend to shut off the computer when it is idle. This is because the mythTV shutdown sequence writes the wakealarm time to the BIOS just before shutting down the system. If, instead, you shut the system down, the mythTV backend is not able to update the BIOS with the correct wakealarm time. Failure to follow this procedure could interrupt a recording, or prevent the system from powering on for a later recording. |
Note that the Idle Timeout time is the time you have to type your username and password when logging in. It would be a good idea to make it long enough to log in before the system can shut itself off. | Note that the Idle Timeout time is the time you have to type your username and password when logging in. It would be a good idea to make it long enough to log in before the system can shut itself off. | ||
− | In the | + | In the BIOS, set your system to power on when power is restored. This will allow the system to recover after a power outage. Some systems will disable the wakealarm after a power outage, but even if it doesn't, if the power is off at the programmed wake time, the wakealarm could be missed. Powering up after a power outage allows mythTV to reset the wakealarm so that future recordings are not missed. |
== Troubleshooting /sys/class/rtc/rtc0/wakealarm == | == Troubleshooting /sys/class/rtc/rtc0/wakealarm == | ||
− | Getting | + | Getting your PC to wakeup using ACPI RTC can be challenging. Here's some tips on getting it working. |
Line 217: | Line 302: | ||
The wake-up function is provided on most modern boards by the ability to "wake from RTC alarm" - setting a date and time in BIOS will cause the computer to power itself on and boot at the set time. This setting is likely found under a sub-menu of "Power Management" "APM", or "Advanced" - you just need to poke around to find it. It will likely be called something like Wake from RTC, Wake From Alarm, RTC Resume, etc. | The wake-up function is provided on most modern boards by the ability to "wake from RTC alarm" - setting a date and time in BIOS will cause the computer to power itself on and boot at the set time. This setting is likely found under a sub-menu of "Power Management" "APM", or "Advanced" - you just need to poke around to find it. It will likely be called something like Wake from RTC, Wake From Alarm, RTC Resume, etc. | ||
− | |||
If you don't have an ACPI-compliant BIOS, you could use [[Shutdown_Wakeup|nvram-wakeup]] instead, | If you don't have an ACPI-compliant BIOS, you could use [[Shutdown_Wakeup|nvram-wakeup]] instead, | ||
which is a small program which modifies the BIOS settings memory (NVRAM) directly (this is no longer recommended). | which is a small program which modifies the BIOS settings memory (NVRAM) directly (this is no longer recommended). | ||
All modern BIOSes should support ACPI, however. | All modern BIOSes should support ACPI, however. | ||
+ | |||
=== Initiate manually === | === Initiate manually === | ||
− | see the | + | see the "Initiate manually" [[#Initiate_manually|section]] above |
− | |||
=== Fussy BIOS === | === Fussy BIOS === | ||
− | There are a lot of fussy BIOSes out there. If things are still not working for you...try the following: | + | There are a lot of fussy BIOSes out there. In some cases you need to disable the RTC alarm function in the bios to make things work. After you have set the RTC alarm from Linux, you might not see the changes in the BIOS, but it still works. If things are still not working for you ... try the following: |
− | + | {{SUSE_head|Disable/Enable RTC in BIOS}} | |
− | {{SUSE_head| | + | *In some cases you need to disable the RTC alarm function is the BIOS to make things work. |
− | In some cases you need to disable the RTC alarm function is the | ||
− | |||
* On many boards, when the RTC setting is enabled in the BIOS, it will wake only from a time set and saved from BIOS setup, and not from a time set outside of the BIOS setup environment - as we want. All of the boards the original author of this document needed this setting disabled to correctly wake with ACPI. This is the recommended starting point. | * On many boards, when the RTC setting is enabled in the BIOS, it will wake only from a time set and saved from BIOS setup, and not from a time set outside of the BIOS setup environment - as we want. All of the boards the original author of this document needed this setting disabled to correctly wake with ACPI. This is the recommended starting point. | ||
− | {{SUSE_head| | + | {{SUSE_head|Time/Date not visible in BIOS}} |
After you have set the RTC alarm from Linux, it could be that you not see changes in the BIOS but it still works. | After you have set the RTC alarm from Linux, it could be that you not see changes in the BIOS but it still works. | ||
− | + | Make use of the following command to determine if the relevant wakealarm BIOS contents are proper. | |
− | + | cat /proc/driver/rtc | |
− | |||
− | |||
=== HPET conflict === | === HPET conflict === | ||
− | In some kernels (2.6.27 and possibly others) and on some hardware, [http://en.wikipedia.org/wiki/HPET HPET] seems to conflict with | + | In some kernels (2.6.27 and possibly others) and on some hardware, [http://en.wikipedia.org/wiki/HPET HPET] seems to conflict with ACPI wakeup capabilities: calls to /sys/class/rtc/rtc0/wakealarm seem to behave normally but computer won't wake up. The solution is adding "hpet=disable" as kernel parameter at boot. |
For more information, see [http://bugzilla.kernel.org/show_bug.cgi?id=12013 upstream] or [https://bugs.launchpad.net/linux/+bug/307090 Ubuntu] bug. | For more information, see [http://bugzilla.kernel.org/show_bug.cgi?id=12013 upstream] or [https://bugs.launchpad.net/linux/+bug/307090 Ubuntu] bug. | ||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
Line 268: | Line 340: | ||
$powersave -S | $powersave -S | ||
ACPI | ACPI | ||
− | If powersaved is not installed on your system, do not install it, it may break other things. | + | If powersaved is not installed on your system, do '''not''' install it, it may break other things. Installing powersaved will uninstall powernow which will prevent some systems from controlling their processor speed, and bring up an unattributed message box on every boot telling you it is unable to control the processor clock. |
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
== S3 (Suspend to RAM) == | == S3 (Suspend to RAM) == | ||
Line 430: | Line 420: | ||
== Using /proc/acpi/alarm == | == Using /proc/acpi/alarm == | ||
+ | {{SUSE_head| /proc/acpi/alarm}} | ||
+ | * Kernels 2.6.21 and older use /proc/acpi/alarm | ||
+ | ls /proc/acpi/alarm | ||
− | Before making complex scripts, do a simple test to ensure that | + | ;format of /proc/acpi/alarm |
− | + | Year-month-day hour:min:sec - yyyy-MM-dd hh:mm:ss - (e.g. 2005-12-29 10:10:04) | |
+ | |||
+ | Before making complex scripts, do a simple test to ensure that a wakeup time can be written to the BIOS and that the computer correctly wakes up based on this time: | ||
=== Initiate manually === | === Initiate manually === | ||
Line 448: | Line 443: | ||
Shutdown your machine and wait for it to wakeup | Shutdown your machine and wait for it to wakeup | ||
shutdown -h now | shutdown -h now | ||
− | |||
Line 455: | Line 449: | ||
ACPI | ACPI | ||
− | Check that you have the alarm function in /proc/acpi/alarm. This prints out the RTC Alarm clock from the BIOS. | + | Check that you have the alarm function in /proc/acpi/alarm. This prints out the RTC Alarm clock from the BIOS. |
$cat /proc/acpi/alarm | $cat /proc/acpi/alarm | ||
Line 470: | Line 464: | ||
2005-*12-29 10:10:04 | 2005-*12-29 10:10:04 | ||
#shutdown -h now | #shutdown -h now | ||
− | |||
Line 480: | Line 473: | ||
=== Integrate into mythTV === | === Integrate into mythTV === | ||
− | |||
Remember, your bios time might be in UTC rather than local time using: | Remember, your bios time might be in UTC rather than local time using: | ||
Line 503: | Line 495: | ||
− | As you noticed the echo to the acpi-alarm is commented out by default, because it is really better to check first if everything is working correctly (time format the same on your | + | As you noticed the echo to the acpi-alarm is commented out by default, because it is really better to check first if everything is working correctly (time format the same on your BIOS and such). |
An alternative script to the above is the following: | An alternative script to the above is the following: | ||
Line 574: | Line 566: | ||
==== Initiate manually ==== | ==== Initiate manually ==== | ||
− | see the | + | see the "Initiate manually" [[#Initiate manually_3|section]] above. |
− | |||
Line 582: | Line 573: | ||
There are a lot of fussy BIOSes out there. If things are still not working for you...try the following: | There are a lot of fussy BIOSes out there. If things are still not working for you...try the following: | ||
+ | {{SUSE_head|Disable/Enable RTC in BIOS}} | ||
+ | Another possible glitch is, that the option "Resume By Alarm" (or whatever it is called) is set to Enabled but wake up using /proc/acpi/alarm only works if the option is set to Disabled. Sounds weird but works with some boards. | ||
− | {{SUSE_head| | + | {{SUSE_head|Required to write time/date two times}} |
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
Some users reported that their BIOS is only updated after writing 2 times to the alarm file. (reported with proc/acpi/alarm) | Some users reported that their BIOS is only updated after writing 2 times to the alarm file. (reported with proc/acpi/alarm) | ||
Line 599: | Line 582: | ||
=== Advanced: Compile your own kernel === | === Advanced: Compile your own kernel === | ||
For the ones that compile their own kernel, make sure ACPI is turned on. (Not required for standard distributions) | For the ones that compile their own kernel, make sure ACPI is turned on. (Not required for standard distributions) | ||
− | The setup of /proc/acpi/alarm is done in kernel file drivers/acpi/sleep/proc.c and controlled by the CONFIG_ACPI_SLEEP_PROC_FS flag. | + | The setup of /proc/acpi/alarm is done in kernel file drivers/acpi/sleep/proc.c and controlled by the CONFIG_ACPI_SLEEP_PROC_FS flag. You can test support for you architecture by going to you kernel source and do: |
− | You can test support for you architecture by going to you kernel source and do: | ||
$grep -r CONFIG_ACPI_SLEEP_PROC_FS arch/* | $grep -r CONFIG_ACPI_SLEEP_PROC_FS arch/* | ||
arch/x86_64/defconfig:CONFIG_ACPI_SLEEP_PROC_FS=y | arch/x86_64/defconfig:CONFIG_ACPI_SLEEP_PROC_FS=y |
Revision as of 22:24, 31 May 2009
System Wakeup |
Contents
Introduction
Most users tend to leave their mythTV system running 24 by 7. This page describes the options you have in Linux to shutdown and automatically wakeup your machine before a recording. A glance at your last electricity bill shows you just how expensive electricity is. You can save energy, money and reduce your carbon footprint. (read more)
- Your options
- Hardware time switch - a cheap power switch and a simple cronjob to shutdown the machine can do the job
- Wake On LAN - have another machine on your network wake your mythTV machine. (See the "Wake on LAN" mythTV HowTo)
- Use the BIOS - most machines have an option in the BIOS for time-controlled booting - this option is the subject of this HowTo
- Use the BIOS
MythTV has a great standard option to write the date and time of the next recording to the BIOS. This allows your machine to automatically shutdown (or suspend) and turn on again a few minutes before it needs to record again. The Advanced Configuration and Power Interface (ACPI) specification is an open industry standard first released in December 1996 developed by HP, Intel, Microsoft, Phoenix, and Toshiba that defines common interfaces for hardware recognition, motherboard and device configuration and power management.
The ACPI Real Time Clock (RTC) Alarm function can be used by your mythTV system to wake up your machine at a certain date and time.
- Steps to 'Use the BIOS' to access the ACPI RTC Alarm function
- Configure your BIOS
- Disable HWclock updates
- Configure mythTV
BIOS setup
If you want to use ACPI to wake up your mythTV system, you first need to ensure that your BIOS supports this functionality. Check your BIOS for the wakeup alarm function. This setting is likely found under a sub-menu of "Power Management Setup" "APM", or "Advanced" - you just need to poke around to find it. It will likely be called something like Wake From Alarm, Power-on by Alarm, Wake from RTC, RTC Resume, etc.
- UTC, localtime and BIOS date format
If supported by your BIOS, set the time to UTC (Coordinated Universal Time). If not supported in the BIOS you need to recalculate the time before you write it to the BIOS. (There are an integer number of hours difference between UTC and local time.)
Disable HWclock updates
On most machines it's required to make a small change to the Linux shutdown procedure. When your machine shuts down, most Linux distributions write the system time/data back to the BIOS. On MANY machines, the machine never wakes-up after this time/data update. It is recommended to make this change before you start.
The reason for this recommendation is that most Linux distributions write the current system time back to the BIOS when shutting down the machine, and with some BIOSes, the machine will not wake up if the hardware clock is modified after the wakeup alarm timer has been set. To avoid this, it is necessary to disable the writing of the current system time to the hardware clock in the system shutdown scripts. This is distribution specific, so here are some examples:
Set clock_systohc to "NO" in /etc/conf.d/clock
:
# Set CLOCK to "UTC" if your system clock is set to UTC (also known as # Greenwich Mean Time). If your clock is set to the local time, then # set CLOCK to "local". Note that if you dual boot with Windows, then # you should set it to "local". clock="UTC" # If you want to set the Hardware Clock to the current System Time # during shutdown, then say "YES" here. # You normally don't need to do this if you run a ntp daemon. clock_systohc="NO" # If you wish to pass any other arguments to hwclock during bootup, # you may do so here. Alpha users may wish to use --arc or --srm here. clock_args=""
modifying /etc/sysconfig/clock
holds a switch to write back system time to the hardware clock
# Set to "-u" if your system clock is set to UTC, and to "--localtime" # if your clock runs that way. # HWCLOCK="-u" SYSTOHC="no" # Is set to "yes" write back the system time to the hardware # clock at reboot or shutdown. Usefull if hardware clock is # much more inaccurate than system clock. Set to "no" if # system time does it wrong due e.g. missed timer interrupts. # If set to "no" the hardware clock adjust feature is also # skipped because it is rather useless without writing back # the system time to the hardware clock.
modifying /etc/default/rcS
with the following will fix this problem:
# # /etc/default/rcS # # Default settings for the scripts in /etc/rcS.d/ # # For information about these variables see the rcS(5) manual page. # # This file belongs to the "initscripts" package. TMPTIME=0 SULOGIN=no DELAYLOGIN=no UTC=no VERBOSE=no FSCKFIX=no ==> HWCLOCKACCESS=no
modifying /etc/init.d/halt
with the following will fix this problem:
==> ACPITIME=`cat /proc/acpi/alarm` [ -x /sbin/hwclock ] && action $"Syncing hardware clock to system time" /sbin/hwclock $CLOCKFLAGS ==> echo "$ACPITIME" > /proc/acpi/alarm
Which kernel are you using?
The ACPI interface in Linux changed with kernel 2.6.22 (released on 8 July 2007). You can determine your kernel version by entering the following command in a terminal window:
uname -a
- Kernels 2.6.22 and newer use /sys/class/rtc/rtc0/wakealarm - see "Using /sys/class/rtc/rtc0/wakealarm", next
- Kernels 2.6.21 and older use /proc/acpi/alarm - see "Using /proc/acpi/alarm", below
Using /sys/class/rtc/rtc0/wakealarm
- /sys/class/rtc/rtc0/wakealarm
Kernel 2.6.22 and newer use /sys/class/rtc/rtc0/wakealarm
ls /sys/class/rtc/rtc0/wakealarm
- format of the /sys/class/rtc/rtc0/wakealarm
Beginning with kernel 2.6.22, ACPI uses /sys/class/rtc/rtc0/wakealarm.
- Instead of accepting a formatted time, wakealarm accepts the number of seconds since Jan 1, 1970 (this is known as "unix time", "POSIX time" or "epoch time").
- You have to make sure that your BIOS clock is set to UTC time - not localtime - otherwise it will wakeup at the wrong time. None the less it is still possible if the BIOS clock is set to localtime (likely if you also run windows), see the section below for how to set the alarm correctly when the BIOS clock is in localtime.
- If you want to change the wakealarm time, you will need to write the new wakealarm time to the BIOS.
If you can't find /sys/class/rtc/rtc0/wakealarm, and you're running a modular kernel, it might be the case that the correct module is not loaded. In that case, make sure the rtc module is unloaded, and then load the rtc-cmos module:
rmmod rtc modprobe rtc-cmos
Initiate manually
For an successful manual test you first need to verify your Linux kernel is 2.6.22 or newer and Disable HWclock updates as described in the above section of this article.
- Simple test to wake the machine 5 minutes from now
sudo sh -c "echo 0 > /sys/class/rtc/rtc0/wakealarm" sudo sh -c "echo `date '+%s' -d '+ 5 minutes'` > /sys/class/rtc/rtc0/wakealarm" cat /sys/class/rtc/rtc0/wakealarm
Check
cat /proc/driver/rtc
This should return a list of parameters. Check the "alrm_time" is 5 minutes into the future and the "alrm_date" is today. Shutdown your computer and see if it comes back up in ~5 min. Note that this command is a powerful debugging tool, letting you see what is currently in the BIOS.
sudo shutdown -h now
- Sample to convert to epoch and set date/time
echo 0 > /sys/class/rtc/rtc0/wakealarm date -u --date "Jul 1, 2008 10:32:00" +%s > /sys/class/rtc/rtc0/wakealarm
- Sample to convert from epoc to readable date/time
date -d @1214908320 +%F" "%T 2008-07-01 12:32:00
- Setting alarm when bios clock is in localtime
The BIOS clock is in localtime, however wakealarm must be given a UTC time.
To get a UTC time in seconds since epoch for a local time that we want mythTV to wake up we do the following. We pass the local time that we want to wake up as --date "2008-12-22 10:45:00", we indicate we want it reported as UTC time with -u, and we indicate we want it reported as seconds since epoch with +%s.
date -u --date "2008-12-22 10:45:00" +%s
So to set the alarm we can do the following.
SECS=`date -u --date "2008-12-22 10:45:00" +%s` echo 0 > /sys/class/rtc/rtc0/wakealarm echo $SECS > /sys/class/rtc/rtc0/wakealarm
Then we can confirm that the alarm is set with the following.
cat /proc/driver/rtc
If the alarm is set then you should see something like this. If so then shutdown and see if it wakes up at the alarm date/time.
rtc_time : 13:40:26 rtc_date : 2008-12-21 alrm_time : 10:45:00 alrm_date : 2008-12-22 alarm_IRQ : yes alrm_pending : no 24hr : yes periodic_IRQ : no update_IRQ : no HPET_emulated : no DST_enable : no periodic_freq : 1024 batt_status : okay
If you see the alarm date similar to ****-12-21 then the alarm is set to a time in the past and it won't wake up.
rtc_time : 13:42:01 rtc_date : 2008-12-21 alrm_time : 13:46:59 alrm_date : ****-12-21 alarm_IRQ : no alrm_pending : no 24hr : yes periodic_IRQ : no update_IRQ : no HPET_emulated : no DST_enable : no periodic_freq : 1024 batt_status : okay
Integrate into mythTV
- mythtv-setup settings for your script
Block shutdown: (checked, if you run frontend and backend on 1 machine. Do not check if you do not automatically start the front end, and want the system to shut down after an automatic recording.)
Idle shutdown timeout (secs): 1200 (if you set this to 0, it will disable auto shutdown)
Max. wait for recording (min): 120
Startup before rec. (secs): 600 (If you have not disabled the occasional disk check on boot, make this time long enough to complete the boot & disk check before the recording should start)
Wakeup time format: time_t
Command to set Wakeup Time: sudo sh -c "/usr/bin/setwakeup.sh $time"
Server halt command: sudo shutdown -h now
Pre Shutdown check-command: (leave this blank)
- Write the startup script
You'll need to copy/paste the following into your editor:
#!/bin/sh #$1 is the first argument to the script. It is the time in seconds since 1970 #this is defined in mythtv-setup with the time_t argument echo 0 > /sys/class/rtc/rtc0/wakealarm #this clears your alarm. echo $1 > /sys/class/rtc/rtc0/wakealarm #this writes your alarm
Change the permissions of the file so that it can execute
sudo chmod +x /usr/bin/setwakeup.sh
Add the following line to your /etc/sudoers by running "sudo visudo" and pasting the line at the end of the file.
%mythtv ALL = NOPASSWD: /sbin/shutdown, /bin/sh, /usr/bin/setwakeup.sh
- Desktop users
If you use your machine as a desktop and you do not want to keep the front end running while you use your computer for other things, create the following script
# Check to see if anyone is currently logged in. Return zero if not and 1 if so. # Echoed text appears in log file. It can be removed and --quiet added to the # grep command once you are satisfied that mythTV is working properly if last | grep "still logged in" then echo Someone is still logged in! Don\'t shut down! exit 1 else echo Noone is logged in, ok to shut down. exit 0 fi
Change its attributes to executable
sudo chmod +x /usr/bin/checklogin.sh
Change the Pre Shutdown check-command in MythTV Backend setup to:
Pre Shutdown check-command: checklogin.sh
This will prevent myth from shutting down when someone is logged in
You must remember to log out rather than shut down when you are done with your session, allowing the mythTV backend to shut off the computer when it is idle. This is because the mythTV shutdown sequence writes the wakealarm time to the BIOS just before shutting down the system. If, instead, you shut the system down, the mythTV backend is not able to update the BIOS with the correct wakealarm time. Failure to follow this procedure could interrupt a recording, or prevent the system from powering on for a later recording.
Note that the Idle Timeout time is the time you have to type your username and password when logging in. It would be a good idea to make it long enough to log in before the system can shut itself off.
In the BIOS, set your system to power on when power is restored. This will allow the system to recover after a power outage. Some systems will disable the wakealarm after a power outage, but even if it doesn't, if the power is off at the programmed wake time, the wakealarm could be missed. Powering up after a power outage allows mythTV to reset the wakealarm so that future recordings are not missed.
Troubleshooting /sys/class/rtc/rtc0/wakealarm
Getting your PC to wakeup using ACPI RTC can be challenging. Here's some tips on getting it working.
Check your hardware
Check if your BIOS supports ACPI/RTC You will need to have a motherboard that supports both ACPI and a Real Time Clock Alarm Functions in the BIOS. Check your BIOS and look for a tab similar to "Advanced Power management".
The wake-up function is provided on most modern boards by the ability to "wake from RTC alarm" - setting a date and time in BIOS will cause the computer to power itself on and boot at the set time. This setting is likely found under a sub-menu of "Power Management" "APM", or "Advanced" - you just need to poke around to find it. It will likely be called something like Wake from RTC, Wake From Alarm, RTC Resume, etc.
If you don't have an ACPI-compliant BIOS, you could use nvram-wakeup instead, which is a small program which modifies the BIOS settings memory (NVRAM) directly (this is no longer recommended). All modern BIOSes should support ACPI, however.
Initiate manually
see the "Initiate manually" section above
Fussy BIOS
There are a lot of fussy BIOSes out there. In some cases you need to disable the RTC alarm function in the bios to make things work. After you have set the RTC alarm from Linux, you might not see the changes in the BIOS, but it still works. If things are still not working for you ... try the following:
- Disable/Enable RTC in BIOS
- In some cases you need to disable the RTC alarm function is the BIOS to make things work.
- On many boards, when the RTC setting is enabled in the BIOS, it will wake only from a time set and saved from BIOS setup, and not from a time set outside of the BIOS setup environment - as we want. All of the boards the original author of this document needed this setting disabled to correctly wake with ACPI. This is the recommended starting point.
- Time/Date not visible in BIOS
After you have set the RTC alarm from Linux, it could be that you not see changes in the BIOS but it still works.
Make use of the following command to determine if the relevant wakealarm BIOS contents are proper.
cat /proc/driver/rtc
HPET conflict
In some kernels (2.6.27 and possibly others) and on some hardware, HPET seems to conflict with ACPI wakeup capabilities: calls to /sys/class/rtc/rtc0/wakealarm seem to behave normally but computer won't wake up. The solution is adding "hpet=disable" as kernel parameter at boot.
For more information, see upstream or Ubuntu bug.
- ACPI enabled
Check if ACPI is enabled in your kernel and working.
$powersave -S ACPI
If powersaved is not installed on your system, do not install it, it may break other things. Installing powersaved will uninstall powernow which will prevent some systems from controlling their processor speed, and bring up an unattributed message box on every boot telling you it is unable to control the processor clock.
S3 (Suspend to RAM)
Some computers are unable to wake up from S5 (Soft Off) by an RTC alarm set through ACPI. For example some HP Compaq desktop computers allow you to set wakeup from BIOS at a specific time and at specific week days, however it ignored ACPI alarm. In this case you may want to try to see if it does wake up from S3 (Suspend to RAM) instead.
The following check needs pm-utils package to work. You may also want to turn off X windows, as quite a few drivers don't like suspend to RAM.
# Set the alarm to five minutes in the future echo 0 > /sys/class/rtc/rtc0/wakealarm echo `date '+%s' -d '+ 5 minutes'` > /sys/class/rtc/rtc0/wakealarm /usr/sbin/pm-suspend
If the computer wakes up after 5 minutes, then congratulations.
Because "suspend to RAM" may not be very stable with the exotic hardware that a lot of mythTV users have, we want to reboot after we wake up from suspend. In fact we can add an init.d script that will suspend the computer just before it physically reboots, on wake up the computer will then do the actual reboot.
I have included an example script for Ubuntu below that will check for an /wakeup file in the root filesystem which contains the time to wakeup (seconds since epoch). You will have to change the mythtv shutdown scripts to create this file and use reboot instead of shutdown.
#!/bin/sh ### BEGIN INIT INFO # Provides: wakeup # Required-Start: # Required-Stop: # Default-Start: # Default-Stop: 0 6 # Short-Description: Start NTP daemon ### END INIT INFO PATH=/sbin:/bin:/usr/sbin:/usr/bin . /lib/lsb/init-functions NAME=wakeup case $1 in stop) if [ -f /wakeup ] then WAKETIME=`cat /wakeup` CURTIME=`date +%s` if [ "$WAKETIME" -gt "$CURTIME" ] then log_daemon_msg "suspending with wakeup" "wakup" # Make it wakeup from ethernet ethtool -s eth0 wol g echo PCI0 >/proc/acpi/wakeup # Make it wakeup from alarm. echo 0 >/sys/class/rtc/rtc0/wakealarm echo $WAKETIME >/sys/class/rtc/rtc0/wakealarm /usr/sbin/pm-suspend log_daemon_msg "continuing with wakeup" "wakup" fi rm -f /wakeup fi ;; *) echo "Usage: $0 {stop}" exit 2 ;; esac
This script is linked to from the /etc/rc0.d and /etc/rc6.d directories at a position just before the /proc, /sys and / get unmounted.
ln -s ../init.d/wakeup /etc/rc0.d/S50wakeup ln -s ../init.d/wakeup /etc/rc6.d/S50wakeup
Using /proc/acpi/alarm
- /proc/acpi/alarm
- Kernels 2.6.21 and older use /proc/acpi/alarm
ls /proc/acpi/alarm
- format of /proc/acpi/alarm
Year-month-day hour:min:sec - yyyy-MM-dd hh:mm:ss - (e.g. 2005-12-29 10:10:04)
Before making complex scripts, do a simple test to ensure that a wakeup time can be written to the BIOS and that the computer correctly wakes up based on this time:
Initiate manually
The commands set the wakeup time to 5 minute from now, regardless of whether the RTC is in UTC or locatltime and then turns off the machine.
The following example will set the wakeup time to 5 minute from now, regardless of whether the RTC is in UTC or locatltime.
You may not see the change in the bios, but it should still work.
- if you are using the /proc/acpi/alarm interface
echo "+00-00-00 00:05:00" > /proc/acpi/alarm
Check that it was written, the format is YYYY-MM-DD HH:MM:SS
cat /proc/acpi/alarm
If the year part looks like "0007" instead of "2007", change +00 with +2000; Shutdown your machine and wait for it to wakeup
shutdown -h now
Here are the commands to check that you have ACPI working.
$powersave -S ACPI
Check that you have the alarm function in /proc/acpi/alarm. This prints out the RTC Alarm clock from the BIOS.
$cat /proc/acpi/alarm 2005-**-29 10:10:04
Check that you can write a new time to the RTC Clock Alarm (you will need to be Root) Format is YYYY-MM-DD HH:MM:SS
#echo "2005-12-29 10:10:04" >/proc/acpi/alarm
Check that it was written, shut down and wait for it to wakeup.
#cat /proc/acpi/alarm 2005-*12-29 10:10:04 #shutdown -h now
For example (Assuming bios is in localtime):
Wakeup time format: yyyy-MM-dd hh:mm:ss Set wakeuptime command: sudo sh -c 'echo $time > /proc/acpi/alarm'
Integrate into mythTV
Remember, your bios time might be in UTC rather than local time using:
# echo "+00-00-00 00:05:00" > /proc/acpi/alarm
will set the wakeup time to 5 minute from now, regardless of whether the RTC is in UTC or locatltime.
Since the wake-up time given by mythtv to the mythtv wakeup command is in local time, you need to do some bash handling of the obtained time to be able to setup the wakeup time in the bios in UTC (independent of daylight savings time and such). The following bash code might help here:
#!/bin/bash stamp_file=/home/mythtv/timestamp echo $1\ $2 > $stamp_file # If using mythwelcome you can try the next line instead on the one above. #echo $1 | sed "s/T/ /" >$stamp_file # Read the date in the locale time format and add the time-zone info to the stamp_file datum=$(/bin/date -f $stamp_file +%F\ %T\ %z) echo $datum > $stamp_file # reinterpret this in utc and write to alarm utcdatum=$(/bin/date -u -f $stamp_file +%F\ %T) echo $utcdatum > $stamp_file #rm -f $stamp_file #echo $utcdatum >/proc/acpi/alarm
As you noticed the echo to the acpi-alarm is commented out by default, because it is really better to check first if everything is working correctly (time format the same on your BIOS and such).
An alternative script to the above is the following:
#!/bin/bash stamp_file=/home/mythtv/timestamp #just log what we get as command line parameters echo $1 $2 $3> $stamp_file #I set mythtv to output the number of seconds since epoch #so I calculate the number of hours, minutes and seconds from #now the computer has to wakeup: sfn=$(($2 - `date +"%s"`)) # Offset from GMT as the awk function does timezone correction. tzone=3600 #and then send it to /proc/acpi/wakeup in the format we saw above y=`(echo $(($sfn - $tzone))|awk '{print strftime("+00-00-00 %H:%M:%S", $1)}')` echo "$y">/proc/acpi/alarm echo "$y">>$stamp_file echo "executed at `date`" >> $stamp_file exit
This works on a lot of different EPIA and ASUS Motherboards, and is not dependent on the timezone you use in the bios.
- Another contributed script
This acpi-alarm script will function with the new sys wakealarm interface or the old acpi/alarm interface
#!/bin/sh # $1 is the --settime switch that nvram-wakeup normally expects # $2 is the date/time in seconds since 1970 DATE=`date -d "1970-01-01 $2 sec" "+%F %H:%M:%S" -u` SECS=`date -d "1970-01-01 $2 sec" "+%s" -u` # Save the wakeup time echo "$*" > /myth.wakeup.args echo $DATE > /myth.wakeup.time echo $SECS > /myth.wakeup.secs if [ -e /sys/class/rtc/rtc0/wakealarm ]; then echo 0 > /sys/class/rtc/rtc0/wakealarm echo $SECS > /sys/class/rtc/rtc0/wakealarm fi if [ -e /proc/acpi/alarm ]; then echo $DATE > /proc/acpi/alarm fi
If leaving the RTC wakeup alarm on the BIOS worked with the old interface, you may need to disable it when migrating to the new interface.
rtc_cmos: probe of 00:03 failed with error -16The solution is to rebuild your kernel with the above two options excluded (find them under Drivers -> Character Devices) and the various RTC interfaces (found under Drivers -> Real Time Clock) included. From a .config point of view CONFIG_RTC and CONFIG_GEN_RTC must be unset and, at a minimum, RTC_INTF_SYSFS must be set.
Troubleshooting /proc/acpi/alarm
First, check the #Troubleshooting /sys/class/rtc/rtc0/wakealarm section above. The following tips are for /proc/acpi/alarm and older systems.
Check your hardware
If you don't have an ACPI-compliant BIOS, you could use nvram-wakeup instead, which is a small that modifies the BIOS settings memory (NVRAM) directly (not recommended). All modern BIOSes should support ACPI, however.
Initiate manually
see the "Initiate manually" section above.
Fussy BIOS
There are a lot of fussy BIOSes out there. If things are still not working for you...try the following:
- Disable/Enable RTC in BIOS
Another possible glitch is, that the option "Resume By Alarm" (or whatever it is called) is set to Enabled but wake up using /proc/acpi/alarm only works if the option is set to Disabled. Sounds weird but works with some boards.
- Required to write time/date two times
Some users reported that their BIOS is only updated after writing 2 times to the alarm file. (reported with proc/acpi/alarm)
Advanced: Compile your own kernel
For the ones that compile their own kernel, make sure ACPI is turned on. (Not required for standard distributions) The setup of /proc/acpi/alarm is done in kernel file drivers/acpi/sleep/proc.c and controlled by the CONFIG_ACPI_SLEEP_PROC_FS flag. You can test support for you architecture by going to you kernel source and do:
$grep -r CONFIG_ACPI_SLEEP_PROC_FS arch/* arch/x86_64/defconfig:CONFIG_ACPI_SLEEP_PROC_FS=y
( Processor type and features ---> [*] Support for hot-pluggable CPUs) so that "CONFIG_HOTPLUG_CPU=y" in the ".config" file. After this it is possible to set ([*] Sleep States) under ACPI support.
Links to additional information
User experience
Moosylog - March 2007: Works fine with MSI RS482M-IL and openSUSE 10.2 after I made the following change to /etc/sysconfig/clock.....SYSTOHC="yes" to SYSTOHC="no".
Turpie: Works great with the Asus M2NPV-VM. Rad: Yep, but needs a recent bios version
Murph - April 2007: Works also great with the Legend QDI Advance 5/133E.
mythwog: No problems with ECS PT890T-A. Simply wrote wake up time to /proc/acpi/alarm, halted, and system wakes up.
Fuchur - August 2007: Had to replace the wakeup script with the one from http://www.mythwiki.de/index.php?title=HOWTO_Mythwelcome as my mythshutdown produces another time format. Otherwise it seems to work so far.
Mattwire - September 2007: Works fine with MSI K8NGM2-FID and NC6120 laptop running Ubuntu Feisty and Gutsy. Both require modification to /etc/init.d/hwclock.sh to save the wakeup time.
Dumdideldum - September 2007: Works with Epox 8rda+ running Ubuntu Feisty. It is important to disable the wakeup on rtc in the Bios and editing the /etc/init.d/hwclock.sh as described in the Ubuntu guide linked in the section below.
Pkendall - September 2007: Works fine with MSI K9NBPM2-FID running Ubuntu Feisty. As above, edit the hwclock.sh file and make sure Bios RTC wakeup is disabled.
Jmwislez - September 2007: Problem with ASUS P5GD1 motherboard (BIOS v1.014). Writing 'echo "2007-09-09 14:15:00" > /proc/acpi/alarm' works perfectly, reading via 'cat /proc/acpi/alarm' yields the expected '2007-09-09 14:15:00', but the system doesn't start at the specified time. After a manually initiated boot, 'cat /proc/acpi/alarm' yields '2007-09-00 14:15:00', with '00' for the day.
Thewizzard - October 2007: Works with MSI K7N2 Delta-ILSR, be sure to use the hwclock.sh script and have it set the time two times.
Spitzbub - December 2007: Works with Biostar NF325-A7, be sure to modify your /etc/init.d/hwclock.sh script (or equivalent) to set the wake-up time again after the --systohc, as described above under Fussy Bios.
Per Olofsson - December 2007: Works very well with Asus P5GC-VM motherboard and Debian lenny with Linux 2.6.22. I don't use the "fussy BIOS" hack since I only suspend the system instead of shutting it down.
KIB - February 2008: Shuttle XPC model SS58G2 / SS58v10, motherboard FS58V10 works with Mythbuntu 7.10, kernel 2.6.22-14. Required BIOS settings - PM Wake Up Events -> IRQ8:enabled, PCIPME:enabled, Powerup by Alarm:disabled. I use /proc/acpi/alarm interface and the patch to hwclock.sh and hwclockfirst.sh is requred as above. Wake on LAN works as well - just add "ethtool -s eth0 wol umbg" to /etc/rc.local .
imcecil - April 2008: Work for Asus P5n-E SLI Gentoo 2.6.24 configured the Kernel as required above but used time_t as the wakeup time format (time since epoch) which seems to work when echoed straight to /sys/class/rtc/rtc0/wakealarm.
Cymen - April 2008: Works great for PCChips P53G but be sure to only have the rtc-cmos module loaded (not the rtc module -- if rtc module is loaded, unload both rtc and rtc-cmos and then load rtc-cmos again and the device will appear in /sys...). Blacklist the rtc module or don't compile it in (the option in under "character drivers" is the one to be excluded).
Moosylog - June 2008: Works fine with MSI RS482M-IL and openSUSE 11.0
Chaup - July 2008: Works with /proc/acpi/alarm on mythbuntu 8.04 running on Lenovo M55E. Had to disable BIOS wakeup for it to work - another fuzzy BIOS. I did update /etc/init.d/hwclock.sh as suggested.
kja999 - July 2008: Worked fine for me using Fedora 9 on an Intel Mac Mini. Use the /sys/class/rtc method ...
piratebab - July 2008: Works fine with debian lenny, kernel 2.6.18 and /proc/acpi/alarm. But with kernel 2.6.25 it dos not work; no /sys/class/rtc/rtc0/wakealarm available, only a /proc/driver/rtc .
bajjisw - August 2008: Wakeup works well with Mythdora 5 on Abit NF7S2, AMD AthlonXP, ATI AIW 9700 Pro for graphics and Aver A180 for tuner. 2.6.25.14-69.fc8 . Had to (1) Disable wakeup by alarm in bios. (2) patch /etc/init.d/halt, per instructions above. (3) Write wakeup time to /proc/acpi/alarm (4) Shutdown. The box wakes up per time set in (3) . October 2008: If you have ntpd running, Do the same changes to /etc/init.d/ntpd. Otherwise, wakeup happens, but BIOS time gets reset.
specto - September 2008: Works on Gentoo 2.6.24 kernel using /sys/class/rtc/rtc0/wakealarm on an Asus M3N-HT Deluxe/HDMI. Did not change BIOS RTC wakeup setting from default of 'disable'. Had to do some time hacking in the wake-up script as system clock is in local time. You can tell if the system thinks it needs to wake up by looking at /proc/driver/rtc - if 'alarm_IRQ' is "yes" then the system should wake up as scheduled. yunosh - Asus M3N78 PRO works fine too.
ronny - works like a charm on Gigabyte GA-MA69GM-S2H using /sys/class/rtc/rtc0/wakealarm on archlinux. Haven't changed any bios settings, neither had to override systohgstra. --Ronny 07:48, 20 November 2008 (UTC)
Gilles - works fine on a ASROCK K7VT2 using /sys/class/rtc/rtc0/wakealarm on mythbuntu kernel 2.6.27. Disabled RTC BIOS settings (they don't seem to be useful unless you want to wakeup your PC on a particular hardcoded time). Had to customize setwakeup.sh so that the wakeup time stays on the same year. If the wakeup time is on the next year, the rtc timer doesn't seem to respond well. --Gilles 19:18, 30 December 2008 (UTC)
zapp - works fine with my FOXCONN A74MX usuing /sys/class/rtc/rtc0/wakealarm on Ubuntu 8.10. RTC has to be disabled as well as HPET --zapp 13:27, 18 Jan 2009 (UTC)
Kroylar 02:03, 23 February 2009 (UTC) - I got this working on gentoo-sources-2.6.26-r3 on an Intel D865PERL motherboard only after applying the patch found on this linux-kernel mailing list entry. This patch has probably already been applied to newer kernels.
Pavol Zibrita 02:25, 21. March 2009 (UTC) - works fine with mythbuntu with kernel 2.6.27-11-generic on MSI's KT4AV-L mainboard. I'm using my machine as a storage server but I don't wanted to run it all the time. I configured the server to start using WOL when I turn on my notebook and I modyfied the check-command to check also if notebook is running or someone is logged in or at last mythshutdown --check is fine. Works great!
Henrik 13:30, 12. May 2009 (UTC) -Gigabyte GA-73PVM-S2H, works fine but needs HPET disabled in BIOS. ABIT I-N73HD works fine. Both boards tested with ubuntu 8.10.