[mythtv-users] Suspend not working if triggered by backend

Jan Schneider jan at horde.org
Wed Jan 5 11:37:47 UTC 2011


Zitat von Jan Schneider <jan at horde.org>:

> Hi,
>
> I'm currently trying to get suspend/resume working on a combined  
> FE/BE. All the pieces are working separately, but it fails for some  
> unknown reason when I put everything together. What works:
>
> - Shutdown and RTC wakeup with mythwelcome and backend idling
> - Running pm-suspend manually
>
>
> /etc/pm/sleep.d/mythtv-backend:
>
> #!/bin/sh
>
> case "$1" in
>         suspend|hibernate)
>                 /usr/bin/killall -STOP mythwelcome
>                 /usr/sbin/service mythtv-backend stop
>                 ;;
>         resume|thaw)
>                 /usr/sbin/service mythtv-backend start
>                 sleep 2
>                 /usr/bin/killall -CONT mythwelcome
>                 ;;
> esac
>
>
> /usr/local/bin/setwakeup.sh:
>
> #!/bin/bash
>
> echo 0 > /sys/class/rtc/rtc0/wakealarm      #this clears your alarm.
> echo $1 > /sys/class/rtc/rtc0/wakealarm     #this writes your alarm
>
> /usr/local/bin/mythsetlcd $1
>
>
> /usr/local/bin/mythsetlcd:
>
> #!/bin/bash
> DATE=$(date -d @$1 +"%A %H:%M")
> sed -e "82c\GoodBye=\"$DATE\"" /etc/LCDd.conf > /tmp/LCDd.conf
> cp /tmp/LCDd.conf /etc/
> /etc/init.d/LCDd restart
>
>
> mythtv-setup configured shutdown/wakeup scripts:
> mythshutdown --setwakeup $time
> mythshutdown --shutdown
> mythshutdown --check
>
>
> mythwelcome configured shutdown scripts:
> sudo sh -c "/usr/local/bin/setwakeup.sh $time"
> sudo shutdown -P now
>
>
> At this point, everything works fine. But as soon as I replace the  
> shutdown script in either the backend (mythshutdown --shutdown) or  
> the mythwelcome (sudo shutdown -P now) configuration with "sudo  
> pm-suspend", the suspending doesn't finish. It starts suspending but  
> somehow stops somewhere, leaving the system in an unusable state. I  
> have to remotely kill Xorg and sometimes restart the backend to get  
> the system back.
>
> This is from mythbackend.log:
>
> 2010-12-29 18:29:55.238 I'm idle now... shutdown will occur in 240 seconds.
> 2010-12-29 18:29:56.855 UPnpMedia: BuildMediaMap - no  
> VideoStartupDir set,  skipping scan.
> 2010-12-29 18:30:01.876 MainServer::ANN Monitor
> 2010-12-29 18:30:01.876 adding: htpc as a client (events: 0)
> 2010-12-29 18:30:02.641 MainServer::ANN Monitor
> 2010-12-29 18:30:02.641 adding: htpc as a client (events: 2)
> 2010-12-29 18:30:53.133 PID 0x202 status: Encrypted
> 2010-12-29 18:30:54.288 PID 0x201 status: Encrypted
> 2010-12-29 18:31:10.146 AutoExpire: CalcParams(): Max required Free  
> Space: 1.0 GB w/freq: 15 min
> 2010-12-29 18:33:54.421 MainServer::ANN Monitor
> 2010-12-29 18:33:54.421 adding: htpc as a client (events: 0)
> 2010-12-29 18:33:54.422 MainServer::ANN Monitor
> 2010-12-29 18:33:54.422 adding: htpc as a client (events: 1)
> 2010-12-29 18:33:54.490 CheckShutdownServer returned - OK to shutdown
> 2010-12-29 18:33:54.493 Running the command to set the next  
> scheduled wakeup time :-
>                                                 mythshutdown  
> --setwakeup 2010-12-29T19:47:00
> 2010-12-29 18:33:54.592 Running the command to shutdown this computer :-
>                                                 mythshutdown --shutdown
> Restarting LCDd: Stopping LCDd: LCDd.
> Starting LCDd: LCDd.
>
>
> This from pm-suspend.log:
>
> Mi 29. Dez 18:33:55 CET 2010: Running hooks for suspend.
> /usr/lib/pm-utils/sleep.d/000kernel-change suspend suspend:success.
> /usr/lib/pm-utils/sleep.d/00logging suspend suspend:Linux htpc  
> 2.6.32-27-generic
>  #49-Ubuntu SMP Wed Dec 1 23:52:12 UTC 2010 i686 GNU/Linux
> Module                  Size  Used by
> snd_hda_codec_nvhdmi     3840  1
> snd_hda_codec_realtek   203344  1
>
> [...]
>
> pata_amd                8766  0
> ahci                   32200  4
>              total       used       free     shared    buffers     cached
> Mem:       1801628    1599960     201668          0      81780    1008876
> -/+ buffers/cache:     509304    1292324
> Swap:       995988      48088     947900
> success.
> /usr/lib/pm-utils/sleep.d/00powersave suspend suspend:success.
> /etc/pm/sleep.d/10_grub-common suspend suspend:success.
> /etc/pm/sleep.d/10_unattended-upgrades-hibernate suspend suspend:success.
> /usr/lib/pm-utils/sleep.d/49bluetooth suspend suspend:not applicable.
> /usr/lib/pm-utils/sleep.d/55NetworkManager suspend suspend:not applicable.
> /usr/lib/pm-utils/sleep.d/75modules suspend suspend:success.
> /usr/lib/pm-utils/sleep.d/90clock suspend suspend:not applicable.
> /usr/lib/pm-utils/sleep.d/94cpufreq suspend suspend:success.
> /usr/lib/pm-utils/sleep.d/95led suspend suspend:not applicable.
> /usr/lib/pm-utils/sleep.d/98video-quirk-db-handler suspend suspend:success.
> /usr/lib/pm-utils/sleep.d/99video suspend suspend:kernel.acpi_video_flags = 0
> success.
> /etc/pm/sleep.d/action_wpa suspend suspend:success.
> /etc/pm/sleep.d/mythtv-backend suspend suspend:
>
>
> And that's the only hint about what's going wrong. There is nothing  
> after the last pm-suspend.log entry. If I run pm-suspend manually,  
> the log continues with:
>
> /etc/pm/sleep.d/mythtv-backend suspend suspend:mythtv-backend stop/waiting
> success.
> Mi 29. Dez 18:45:56 CET 2010: performing suspend
>
>
> Any ideas are more than welcome, especially what might be wrong with  
> my /etc/pm/sleep.d/mythtv-backend so that it doesn't seem to finish  
> when suspending through mythwelcome.

I guess there must be more people out there using suspend +  
mythwelcome? Does it work for you without problems? If yes, how does  
your setup differ from mine? Don't you have to unload drivers and thus  
stop the backend for suspend to work?

I'm still trying to understand what exactly is happening in my system  
if I try to suspend through MythTV. Is it possible that stopping  
STOPing mythwelcome before shutting down mythbackend is also stopping  
pm-suspend, because it's exec'ed from mythwelcome? If this is the  
case, how can I avoid this deadlock?

Jan.

-- 
Do you need professional PHP or Horde consulting?
http://horde.org/consulting/



More information about the mythtv-users mailing list