[mythtv-users] MythTv BE/FE go to sleep but doesn't wake up
ganassa
ganassa at gmail.com
Sun Feb 12 17:56:54 UTC 2012
>
> Date: Sun, 12 Feb 2012 15:51:45 +0100
> From: ganassa <ganassa at gmail.com>
> Subject: [mythtv-users] MythTv BE/FE go to sleep but doesn't wake up
>
> Hi
>
> I have a problem in setting up ACPI WakeUp on my MythTv BE/FE on Ubuntu
> 10.10
>
[cut]
>
> Date: Sun, 12 Feb 2012 10:10:15 -0500
> From: Marco Quezada <mellamanjefe at gmail.com>
> Subject: Re: [mythtv-users] MythTv BE/FE go to sleep but doesn't wake
> up
> To: Discussion about MythTV <mythtv-users at mythtv.org>
> Message-ID:
> <CA+qgVUYUB6804biLJmMma4f6bB-4SvFsLYj-XkduLwC7vix01w at mail.gmail.com
> >
> Content-Type: text/plain; charset=UTF-8
>
> On Sun, Feb 12, 2012 at 9:51 AM, ganassa <ganassa at gmail.com> wrote:
> > Hi
> >
> > I have a problem in setting up ACPI WakeUp on my MythTv BE/FE on Ubuntu
> > 10.10
> > It's a log time I'm trying to setting it up correctly but I gave up
> several
> > times.
> > Now I've discovered that I made a small but important error, by setting
> up
> > in mythtv-setup the time format in:
> >
> > 'yyyy-MMddThh:mm:ss'
> >
> > instead than
> >
> > 'yyyy-MM-ddThh:mm:ss'
> >
> > So, previously the Mythwelcome screen shows countdown but, when it
> reached
> > to 0, it restarted, because of the check of time format.
> >
> > Now, after correcting the error, MythWelcome shuts down. But it doesn't
> wake
> > up.
> > Because of the several different informations found on the web, I think I
> > made a mess and now I really need an help to get the work done.
> >
> > First of all: I've setted up my sistem following both:
> >
> > http://www.mythtv.org/wiki/ACPI_Wakeup
> >
> > and
> >
> > http://www.mythtv.org/wiki/Mythwelcome
> >
> >
> > ACPI WAKEUP SETTINGS
> > Follwing:
> >
> > http://www.mythtv.org/wiki/ACPI_Wakeup:
> >
> >
> > My system can wake up from S4:
> >
> > $ grep -i rtc /var/log/kern.log
> > Feb 12 14:12:56 multisala kernel: [ ? ?0.787284] rtc_cmos 00:03: RTC can
> > wake from S4
> >
> >
> > HWclock updates are disabledm both for the Ubuntu 8.04 version ad earlier
> > (my Ubuntu came from 8.04 version) by setting up HWCLOCKACCES to "no" in
> the
> > proper file
> >
> > $ cat /etc/default/rcS |grep HWCLOCKACCESS
> > HWCLOCKACCESS=no
> >
> >
> > and for the?Ubuntu 9.10 and later by commenting out "exec" line in the
> > proper file
> >
> > $ cat /etc/init/hwclock-save.conf |grep exec
> > # ? ?exec hwclock --rtc=/dev/rtc0 --systohc $tz --noadjfile $badyear
> >
> >
> > kernel is newer than 2.6.22
> >
> > $ uname -a
> > Linux multisala 2.6.35-32-generic #65-Ubuntu SMP Tue Jan 24 13:48:14 UTC
> > 2012 i686 GNU/Linux
> >
> >
> > so it use?/sys/class/rtc/rtc0/wakealarm
> >
> > $ ls /sys/class/rtc/rtc0/wakealarm
> > /sys/class/rtc/rtc0/wakealarm
> >
> > consequentiely, wakealarm should accept time format in epoch time
> >
> > TESTING
> > Now, it's time to test it by following
> >
> > http://www.mythtv.org/wiki/ACPI_Wakeup#Manually_test_wakealarm
> >
> >
> > $ 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
> > $ cat /proc/driver/rtc
> > rtc_time ? ? ? ?: 15:45:14
> > rtc_date ? ? ? ?: 2012-02-12
> > alrm_time ? ? ? : 15:50:06
> > alrm_date ? ? ? : ****-**-12
> >
> > PROBLEM!
> > date is
> > ****-**-12
> >
> > I've read somewhere that **** somewhere in date means: wakeup time was
> set
> > up in the past, and it won't wake up. In fact, it doesn't wake up at all.
> >
> > SECOND TEST
> > still according to
> > http://www.mythtv.org/wiki/ACPI_Wakeup#Manually_test_wakealarm?(Exampleto
> > convert to epoch time and set date/time)
> > I've tried to make a further test by:
> >
> > $ echo 0 > /sys/class/rtc/rtc0/wakealarm
> > -bash: /sys/class/rtc/rtc0/wakealarm: Permission denied
> >
> >
> > It looks like I don't have permission to do that. Let's try with sudo:
> >
> > $ sudo echo 0 > /sys/class/rtc/rtc0/wakealarm
> > -bash: /sys/class/rtc/rtc0/wakealarm: Permission denied
> >
> >
> > still no permission! let's root:
> >
> > $ sudo su
> > $?echo 0 > /sys/class/rtc/rtc0/wakealarm
> > $?date -u --date "Feb 12, 2012 16:00:00" +%s >
> /sys/class/rtc/rtc0/wakealarm
> > $?cat /proc/driver/rtc
> > rtc_time ? ? ? ?: 15:50:12
> > rtc_date ? ? ? ?: 2012-02-12
> > alrm_time ? ? ? : 16:00:00
> > alrm_date ? ? ? : 2012-02-12
> >
> >
> > I've got it! Time is now setted up and, if I do a
> >
> > sudo shutdown -P now
> >
> >
> > My BE/FE shuts down and wake up at 16:00:00 UTC time (15:00:00 local
> time)
> >
> > Now: reading the next paragraph (Setting alarm when BIOS clock is in
> > localtime)
> > I've learned that "The BIOS clock is in localtime, however wakealarm
> must be
> > given a UTC time"
> > But my BIOS *SHOULD BE* in UTC time, because of the difference between
> date
> > result and BIOS query:
> >
> > $ date
> > Sun Feb 12 14:58:17 CET 2012
> > $ cat /proc/driver/rtc
> > rtc_time ? ? ? ?: 15:58:20
> >
> >
> > By the way: let's go with next check as suggested in Wiki:
> >
> > $ SECS=`date -u --date "2012-01-12 17:00:00" +%s`
> > $ echo 0 > /sys/class/rtc/rtc0/wakealarm
> > -bash: /sys/class/rtc/rtc0/wakealarm: Permission denied
> >
> >
> > Whoops, I'm not a sudoers? (but the setwakeup.sh script is, see later).
> > Anyway, let's sudo:
> >
> > $ sudo su
> > $ SECS=`date -u --date "2012-02-12 17:00:00" +%s`
> > $ echo 0 > /sys/class/rtc/rtc0/wakealarm
> > $ echo $SECS > /sys/class/rtc/rtc0/wakealarm
> > $ cat /proc/driver/rtc
> > rtc_time ? ? ? ?: 16:08:32
> > rtc_date ? ? ? ?: 2012-02-12
> > alrm_time ? ? ? : 17:00:00
> > alrm_date ? ? ? : 2012-02-12
> >
> >
> > Double-check: let's face the "sudo" problem, by going directly to
> > the?setwakeup.sh, to clean any doubt on the permission thing:
> >
> > $ time=`date -u --date "2012-02-12 18:00:00" +%s`
> > $ sudo sh -c "/usr/bin/setwakeup.sh $time"
> > $ cat /proc/driver/rtc
> > rtc_time ? ? ? ?: 16:12:36
> > rtc_date ? ? ? ?: 2012-02-12
> > alrm_time ? ? ? : 18:00:00
> > alrm_date ? ? ? : 2012-02-12
> >
> > So: all checks are checked out.
> >
> > INTEGRATE INTO MYTHTV
> >
> > As seen in the latest check, I've already created the?setwakeup.sh
> script as
> > suggested in the Wiki, and my mythtv user is a sudoers of it, so let's
> > integrate it in MythTv:
> >
> > I use MythWelcome, so - despite the fact I've read all the Wiki page -
> I'll
> > skip to "Mythwelcome users" paragraph.
> > I see two settings related to my problem:
> >
> > mythbackend Shutdown/Wakeup Options (mythtv-setup)
> >
> >
> > Wakeup time format ? ? ? ? ? ? ? ? ? ? : yyyy-MM-ddThh:mm:ss (Must be
> this
> > format for mythshutdown)
> >
> >
> > that's it (I miss "T" meanings, but I'm just RTFMing)
> >
> > Command to set Wakeup Time ? ? ? ? ? ? : mythshutdown --setwakeup $time
> >
> >
> > all checked.
> >
> > BEGIN NOTE:
> > It would be kind to double-check it by query the "settings" table in the
> > database, but for un unknown reason it doesn't show up in the database:
> >
> > for the Wakeup time format thing, it only contains a format related to
> > MythWelcome (and it doesn't have any relation to the MythWelcome
> settings,
> > see below in this post when I'll get to the MythWelcome settings)
> >
> > mysql> SELECT value, data FROM settings where hostname ='multisala' and
> data
> > like ?'%yyyy%' order by value;
> >
> > +-----------------------+------------------+
> >
> > | value ? ? ? ? ? ? ? ? | data ? ? ? ? ? ? |
> >
> > +-----------------------+------------------+
> >
> > | MythWelcomeDateFormat | dddd
> >
> > dd MMM yyyy |
> >
> > +-----------------------+------------------+
> >
> > 1 row in set (0.00 sec)
> >
> >
> > for the Command to set Wakeup time, no data corresponding to what I've
> just
> > set up:
> >
> > mysql> SELECT value, data FROM settings where hostname ='multisala' and
> data
> > like ?'%mythshutdown%' order by value;
> >
> > Empty set (0.00 sec)
> >
> >
> > END NOTE;
> >
> >
> > MythShutdown/MythWelcome Settings (mythwelcome --setup or F11 in
> > mythwelcome)
> >
> > Command to set wakeup time ? ? ? ? ? ? : sudo /usr/bin/setwakeup.sh $time
> > Wakeup time format ? ? ? ? ? ? ? ? ? ? : time_t
> > nvram-wakeup Restart command ? ? ? ? ? : (Must be blank)
> > Command to shutdown ? ? ? ? ? ? ? ? ? ?: sudo shutdown -h now (some
> systems
> > may need "sudo shutdown -P now"
> > ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?instead (-h may cause system to
> > restart))
> > Command to start the frontend ? ? ? ? ?: /usr/bin/mythfrontend
> >
> >
> > Now i can check them via mysql:
> >
> > mysql> SELECT value, data FROM settings where hostname ='multisala' and
> > value like '%shutdown%' order by value;
> > +-----------------------------+----------------------------------+
> > | value ? ? ? ? ? ? ? ? ? ? ? | data ? ? ? ? ? ? ? ? ? ? ? ? ? ? |
> > +-----------------------------+----------------------------------+
> > | AllowQuitShutdown ? ? ? ? ? | 4 ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?|
> > | MythShutdownNvramCmd ? ? ? ?| sudo /usr/bin/setwakeup.sh $time |
> > | MythShutdownNvramRestartCmd | ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?|
> > | MythShutdownPowerOff ? ? ? ?| sudo shutdown -h now ? ? ? ? ? ? |
> > | MythShutdownReboot ? ? ? ? ?| sudo shutdown -h -r now ? ? ? ? ?|
> > | MythShutdownWakeupTimeFmt ? | time_t ? ? ? ? ? ? ? ? ? ? ? ? ? |
> > | MythShutdownXTermCmd ? ? ? ?| xterm ? ? ? ? ? ? ? ? ? ? ? ? ? ?|
> > +-----------------------------+----------------------------------+
> >
> > 7 rows in set (0.00 sec)
> >
> >
> > the setwakeup.sh script is allright:
> >
> > $ cat /usr/bin/setwakeup.sh
> > #!/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
> >
> >
> > UTCBIOS=true
> >
> > if $UTCBIOS
> > then
> > ? ? #utc bios - use supplied seconds
> > ? ? SECS=$1
> > else
> > ? ? #non utc bios - convert supplied seconds to seconds from
> > ? ? #epoch to local time
> > ? ? SECS=`date -u --date "\`date --date @$1 +%F" "%T\`" +%s`
> > fi
> >
> > echo 0 > /sys/class/rtc/rtc0/wakealarm #this clears your alarm.
> > echo $1 > /sys/class/rtc/rtc0/wakealarm #this writes your alarm
> >
> >
> > and so /etc/sudoers is:
> >
> > $ sudo cat /etc/sudoers |grep mythtv
> > %mythtv ALL = NOPASSWD: /sbin/shutdown, /usr/bin/setwakeup.sh,
> > /usr/bin/mythshutdown
> >
> >
> > ALL CHECK FINISHED, NOW WHAT?
> >
> > After all those checks:
> > Working:
> > - MythWelcome shuts down my BE/FE according to time parameters
> > Not working:
> > - The MythTv BE/FE doesn't wake up
> >
> > I was thinking that the problem could be related to
> >
> > the UTC/local time thing
> >
> > or
> >
> > the time_t/yyyy-MM-dd hh:mm:ss thing
> >
> > but, after trying to read all the forum posts, mailing list messages,
> blog
> > suggestions, Ubuntu documents, MythTv Wikis, now I am in a big mess: I
> can't
> > understand where I'm doing wrong things.
> >
> > I've made several attempt to change parameters (UTC, time formats) but
> the
> > test are not so easy (I have to make let the BE shuts down and wait for a
> > program to check if it wake up, and in the meantime I am using my BE to
> > record things, so it's a long process with a "production" system ;) ) and
> > now I'm not sure I've tried all the possible combinations done.
> >
> > If any of you can point me in the right direction, I'll be grateful :)
> >
> > _______________________________________________
> > mythtv-users mailing list
> > mythtv-users at mythtv.org
> > http://www.mythtv.org/mailman/listinfo/mythtv-users
> >
>
> I've been battling the other side of this (getting the system to shut
> down) but just last night I followed the same wiki article you did and
> my system is now working.
>
> One thing I had to fix in mine (a long time ago) was that the user
> running the backend was not the same as the user running the frontend.
> I have a user called mythtv, it runs the backend wchich starts
> automatically when the machine boots up. Then there is a user called
> mitotv and it is the one the system uses to auto-login to X (Ubuntu
> desktop) and this is the user that runs mythwelcome and mythfrontend.
> So I had to add mitotv to the mythtv users group so that it could use
> the commands listed in the sudoers file under the mythtv group. I
> can't tell from your post if you have a similar situation (different
> users running different portions of mythtv) but if you do it could be
> that the user running mythwelcome/mythshutdown does not have
> permission to write to the RTC alarm. In this case the system can
> initiate a shutdown but when it tries to write to the RTC the step
> fails, however the shutdown continues and now the machine has no alarm
> set up to wake it up.
>
> If you manually bring up the machine, after mythwelcome/mythshutdown
> automatically shut it off, can you query the rtc (cat
> /proc/drivers/rtc) and confirm that the alarm was properly set top the
> time mythshutdown expected and there are no **** in it?
>
> -Marco
>
>
>
Hi
When I told:
> Command to set Wakeup Time ? ? ? ? ? ? : mythshutdown --setwakeup $time
>
>
> all checked.
I was telling a lie: reading the wiki and writing this mail step-bt-step,
in fact, I realized that something in my configuration was different.
In this case, the "Command to set Wakeup Time" was set to
sudo sh -c "/usr/bin/setwakeup.sh $time"
instead than
mythshutdown --setwakeup $time
also
sudo sh -c "/usr/bin/setwakeup.sh $time"
was used in MythWelcome setup instead than
sudo /usr/bin/setwakeup.sh $time
So I changed them while writing, thiking that they should'nt be
significants.
On the contrary, they are. Or, at least, I think that the former one is: in
fact, about one half an hour after I wrote here - and those parameters was
fixed - the MythTv BE/FE started up to record a test program I scheduled.
So, thank you anyway: I could sove the problem just by having someone
reading my blethers ;-)
About your experience: both my backend and frontend are running on a same
user. It's not the "mythtv" user - I had to change some settings -
permissions and their default - in the past to make it work correctly - but
they are using my usual linux username, so this should not be a problem.
Now my next steps are:
- waking up while feeding xmltv - I don't know how to tell mythtv that
crontab is set at a specific hour
- waking up from remote requests - it will be hard because the BE/FE is
wireless-connected to the router, and no Wake Up on LAN feature on my WiFi
USB dongle.
But for now I am satisfied.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.mythtv.org/pipermail/mythtv-users/attachments/20120212/1e214f44/attachment.html
More information about the mythtv-users
mailing list