LinHES Forums
http://forum.linhes.org/

Mythwelcome in R5.5 does not wake machine
http://forum.linhes.org/viewtopic.php?f=11&t=18587
Page 2 of 5

Author:  marc.aronson [ Tue Jul 29, 2008 7:12 pm ]
Post subject: 

heilig wrote:
Hi Marc,

my R5.5 does NOT include rtcwake (locate rtcwake does not find anything)

jens


Jens, thanks for the feedback. I've found another utility that I'm going to try this week. I found it at http://www.bessems.biz/wakeup/ -- I'll let you know if it works for me.

Marc

Author:  marc.aronson [ Tue Jul 29, 2008 8:20 pm ]
Post subject: 

Jens, I tried the wakeup tool on my R5F27 as follows:
Code:
root@mythhd:/myth/tmp/wakeup-1.0# ./wakeup 19:20:10
root@mythhd:/myth/tmp/wakeup-1.0# cat /proc/acpi/alarm
2008-07-30 02:20:10


So this tool is clearly setting the wakeup alarm successfully on R5F27. Based on what I've seen, I believe that the problem I am having is that my bios requires that the alarm be set twice in a row, and the "wakealarm" filesystem interface on r5.5 prevents this me from doing this, as described in my earlier post. I suspect (hope) that "wakeup" will be able to do the double-set without a problem. I'll let you know once I get a chance to re set up my test system.

Marc

Author:  marc.aronson [ Wed Jul 30, 2008 12:23 am ]
Post subject: 

OK, don't bother with "wakeup" -- I just tried it on R5.5 and realized that it simply writes to /proc/acpi/alarm, which of course doesn't exist on this version of the kernel.

I've played around some more and suddenly the wakealarm interface is working for me and doesn't seem to require the "fussy bios double set" actions. Very strange.

Author:  alien [ Wed Jul 30, 2008 1:39 am ]
Post subject: 

rtcwake is for suspend. Mythwelcome was designed to work with a powerdown. The problem is that to work, both mythwelcome and the backend must be started new on "resume". I'm sure there is a way to write post-resume scripts that restart them... If you can do it, I'm sure a lot of people would be interested.

As for recompiling the kernel with the old interface, you can take a look here:

http://www.linux-archive.org/ubuntu-ker ... -04-a.html

If your box needs two writes to enable a wakeup, have you tried writing 0, time, 0, time (i.e. writing four times)?

Cheers,

Allen

Author:  marc.aronson [ Wed Jul 30, 2008 8:13 am ]
Post subject: 

alien wrote:
If your box needs two writes to enable a wakeup, have you tried writing 0, time, 0, time (i.e. writing four times)?

Yes, that is one of the things I tried before I wrote my first post -- didn't solve the problem. The odd thing is that I ran some more experiments with the r5.5 wakealarm interface and now it is working for me, and it's working without requiring the double write. This happened after I (once again) toggled the bios RTC alarm setting from disabled to enabled. I had done this before without success. Now, the wakealarm will work properly irrespective of weather the bios interface is enabled or disabled. The only thing I can think of that I did differently this time is that when the bios alarm was enabled, I set an explicit wakeup time that was in the future (23:59:59, day = 31). In my previous experiment, I had left the alarm time to its default, which as I recall was the current time, day=all.
alien wrote:
rtcwake is for suspend. Mythwelcome was designed to work with a powerdown. The problem is that to work, both mythwelcome and the backend must be started new on "resume". I'm sure there is a way to write post-resume scripts that restart them... If you can do it, I'm sure a lot of people would be interested.


Actually, I don't use mythwelcome. Instead I have a process that monitors the mythfrontend, samba, sshd and some background jobs that I run occasionally. When all of these are idle for 25 minutes, it kills the frontend, at which point the backend will initiate the shutdown process. This way my family doesn't need to "remember" to exit the front end when they are done, and when they start the system they are presented with the myth front end, not mythwelcome.

I don't think that developing a suspend / restart script would be difficult. On suspend I think it would be best to kill the frontend, stop the backend and stop mysql, to ensure that all I/O is flushed before suspending. On resume, one would then start mysql, the backend and then the frontend.

I tried to initiate an S3 sleep under r5f27 a few months ago by setting a value in the appropriate /proc/acpi file (don't recall which one now), but it didn't work and then I think I read somewhere that R5F27 hadn't been configured to support S3 sleep. Do you know if R5.5 is configured to support S3 sleep? If it is, I will definitely see if I can pull together some scripts that support S3 sleep instead of the current shutdown process. It would reduce the restart time to a few seconds.

Marc

Author:  tatuirovka [ Wed Jul 30, 2008 8:30 am ]
Post subject: 

marc.aronson wrote:
Actually, I don't use mythwelcome. Instead I have a process that monitors the mythfrontend, samba, sshd and some background jobs that I run occasionally. When all of these are idle for 25 minutes, it kills the frontend, at which point the backend will initiate the shutdown process. This way my family doesn't need to "remember" to exit the front end when they are done, and when they start the system they are presented with the myth front end, not mythwelcome.


That sounds much better than using mythwelcome. Could you post the script?

Author:  alien [ Thu Jul 31, 2008 12:51 am ]
Post subject: 

marc.aronson wrote:
Actually, I don't use mythwelcome. Instead I have a process that monitors the mythfrontend, samba, sshd and some background jobs that I run occasionally. When all of these are idle for 25 minutes, it kills the frontend, at which point the backend will initiate the shutdown process. This way my family doesn't need to "remember" to exit the front end when they are done, and when they start the system they are presented with the myth front end, not mythwelcome.
How did you monitor the frontend for idle? That is one thing mythwelcome does not do and I would like to add that.

Author:  cliffsjunk [ Thu Jul 31, 2008 10:31 am ]
Post subject: 

It seems you may have tried this? I recall reading that you
need to set the wakeup in the BIOS and have it wake up
once that way for the Linux wakeup to work.

You also might just try (R5.5) adding "acpi=force" to the
"append=" string in /etc/lilo.conf and running "lilo". In R5F27
you may want to replace the "apm=whatever" with
"acpi=force".

Author:  marc.aronson [ Thu Jul 31, 2008 7:27 pm ]
Post subject: 

The scripts I have are not really in a releasable state at this time as there are parts of it that are specific to my overall environment. After I finish my upgrade to r5.5 I'll work on putting then into shape. Having said that, I can describe the basic method for tracking when the front end goes idle. I run a process that is launched at boot time. It wakes up every 2 minutes and measures the amount of CPU time used by the front end process. If the amount of CPU time does not change for 15 checks in a row, it declares that the front end is idle. I ran some tests, and as few as 3-4 clicks on my remote to navigate up or down on a menu will chalk up 1 second of CPU time on a Pentium D930 3.0 ghz processor, so it doesn't take much to make the front end look busy.

I did a quick cut down of the script, so this version is untested -- use at your own risk :-).
Code:
#! /bin/sh
log=/var/log/mfemon.log
stime=120
idle=15
echo "mfemon started `date`" > $log
while true
do
  sleep $stime
  xxx=`ps uU mythtv | egrep "mythfrontend" |  awk ' { print $1,$2,$10,$11 }'`
  if [ "$xxx" != "" ]; then
    echo "$xxx `date`" >> $log
    tail -$idle $log > $log.2
    mv -f $log.2 $log
    cnt=`cut -d" " -f1,2,3,4 $log | sort -u | wc -l`
    if [ $cnt = 1 ]; then
      pkill mythfrontend
      echo "Mythfrontend stopped `date`" >> $log
    fi
  fi
done


Marc

Author:  alien [ Fri Aug 01, 2008 1:17 am ]
Post subject: 

marc.aronson wrote:
I run a process that is launched at boot time. It wakes up every 2 minutes and measures the amount of CPU time used by the front end process. If the amount of CPU time does not change for 15 checks in a row, it declares that the front end is idle.
Nice Idea! I'm going set this up. I use my mythbox primarily for a jukebox and we sometimes to forget to turn it off after the playlist finishes.

Author:  marc.aronson [ Sun Aug 03, 2008 12:36 pm ]
Post subject: 

Jens, I found out something interesting that may help you to get ACPI wakeup to work. I re-installed r5.5 from scratch and once again could not get the wakeup to work. After some playing around, I found I had to do 3 things to get it to work:

1. Modify /etc/init.d/hwclock.sh to not update the hardware clock during a shutdown. You can do this by adding the line ' HWCLOCKACCESS="no" ' just before the last line of the script which currently reads ' hwclocksh "$@" '

2. Set your bios to wake up at 23:59:59 on July 31st. If you don't have a month or day field, then don't worry about setting those parameters. No matter what, set the hour/min/seconds as I have indicated.

3. As root execute "set_timer 1 120". Note that the use of set_timer is a one time event. You will not use it again.

4. As root execute "shutdown -h now"

5. Wait a bit more than 2 minutes.

6. Manually power your machine up.

7. Now try setting your wakeup time using the published method. At this point it works for me.

8. If it didn't work in step 7, go back into your bios, disable the wakeup event and try steps 6 & 7 again.

9. If it still doesn't work, then my apologies for suggesting something that didn't help. This does work on my ASUS P5P800 mobo.

Marc

Author:  jigawho [ Sun Aug 03, 2008 3:23 pm ]
Post subject: 

I've been messing around with this the last few days with my Asus P4G800 mobo, and I think I have a similar problem. I tried your steps marc, but it didn't change anything. I tried checking /tmp/alarm.log and it seems to have the right time for the alarm, the computer just never boots up.

With this method, should the time show up in the bios, like in nvram-wakeup? Are there any other intermediate steps I can check to try to figure it out?

Author:  marc.aronson [ Sun Aug 03, 2008 9:06 pm ]
Post subject: 

jigawho, I have not checked the bios so I don't know if it shows the designated time there. One suggest is to try to set the time in "wakealarm" directly and then doing a shutdown -h to see if that works.

Marc

Author:  marc.aronson [ Sun Aug 03, 2008 9:34 pm ]
Post subject: 

alien wrote:
marc.aronson wrote:
I run a process that is launched at boot time. It wakes up every 2 minutes and measures the amount of CPU time used by the front end process. If the amount of CPU time does not change for 15 checks in a row, it declares that the front end is idle.
Nice Idea! I'm going set this up. I use my mythbox primarily for a jukebox and we sometimes to forget to turn it off after the playlist finishes.

Alien,

I've found that the mythfrontend under r5.5 will use some CPU cycles even when idle. This was not the case in R5F27. On my machine it will use 2-5 seconds during a 2 minute idle period. So I've made two adjustments to my approach:

1. 6 seconds or less of CPU time during a 120 second sleep cycle is considered idle.

2. I monitor LIRC for input and treat the system as busy if any events are received. I do this by running "IRW > logfile" in the background. Any change to logfile's timestamp means that an input event has been received. This does not prevent myth from also seeing that same event.


Marc

Author:  nmcaullay [ Mon Aug 04, 2008 8:03 am ]
Post subject: 

Hi All,

I dont want to direct the thread, but i'm experiencing the same symptoms as the author, but my problem might be down to me using the restore.list to restore an R5F27 hwclock.sh onto my R5.5 system.

alien wrote:
Writing 0 into wakealarm is done by default in /etc/init.d/hwclock.sh. You can try commenting it out to see if it makes a difference with your MB.


Could someone post the proper R5.5 hwclock.sh file? or PM me it?

Cheers,

Nathan

Page 2 of 5 All times are UTC - 6 hours
Powered by phpBB® Forum Software © phpBB Group
http://www.phpbb.com/