Bugs item #1612257, was opened at 2006-12-09 18:30
Message generated for change (Comment added) made by mennucc
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=446895&aid=1612257&group_id=46652
Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: plugins
Group: 1.6.1
Status: Open
Resolution: Accepted
Priority: 5
Private: No
Submitted By: A C G Mennucc (mennucc)
Assigned to: Nobody/Anonymous (nobody)
Summary: many autoshutdown issues
Initial Comment:
hi
I just upgraded from freevo 1.5.4 to 1.6.1; in 1.5.4 I had installed the
wakeupshutdown plugin, and I see that now the autoshutdown plugin is supposed
to do the same; but I found some bugs; I propose a patch; here is a description.
The variables
WARN_SHUTDOWN
BOOTTIME_PADDING
USE_NVRAM_WAKEUP
NVRAM_WAKEUP_CMD
NVRAM_REBOOT_FLAG
are contained in freevo_config.py but not used anywhere
'nvram-wakeup' already defaults to a 5 minutes boottime padding; I added '-w 0'
to the command
The nvram-wakeup command has a return code of 1 when the computer needs to be
rebooted; this is now ignored; I (re)implemented it and changed the semantic of
AUTOSHUTDOWN_BIOS_NEEDS_REBOOT.
I also add a feature:
# WHILE_LOGGED
# The system may automatically shutdown even if someone
# is logged in (as reported by 'who' )
AUTOSHUTDOWN_WHILE_USER_LOGGED=True
(I hate when freevo shuts down while I am doing remote mantainance)
And I added 'mencoder' to the programs that will pause automatic shutdown.
btw: the path in Debian is /usr/sbin/nvram-wakeup
a.
ps: there are other improvements needed; basically, autoshutdown should have a
kind of 'fallback', for when nvram-wakeup fails, or when blackout occours, etc
etc
----------------------------------------------------------------------
>Comment By: A C G Mennucc (mennucc)
Date: 2006-12-19 13:43
Message:
Logged In: YES
user_id=79281
Originator: YES
hi
I also found a problem with dates and locale; I googled and found SVN
r8658 addressing the same exact problem, by wrapping time.strftime into
Unicode() ; so I did the same , and I tested it both with a it_IT.UTF-8
locale and with it_IT , and it works ; the patch is incremental w.r.t. the
other patch I already put here
a.
File Added: freevo-1.6.1-autoshutdown-locale.diff
----------------------------------------------------------------------
Comment By: A C G Mennucc (mennucc)
Date: 2006-12-10 10:40
Message:
Logged In: YES
user_id=79281
Originator: YES
>Not all motherboards need a reboot to set the wakeup alarm, some need it
>...
>The idea behind this is if nvram-wakeup decides that we need to reboot,
it
>will exit with exit status 1 (instead of 0). So the script which runs
>nvram-wakeup could react on this.
I was aware of all this; ( actually, yesterday evening I was writing a
long explanation as you wrote, but then I got a different problem, and it
got lost)
indeed go'ol' wakeupshutdown did behave as above; whereas, when I saw
was that 'autoshutdown' was not looking into the return value, I added some
code in my patch that does look into the return value.
moreover I agree that the variable AUTOSHUTDOWN_BIOS_NEEDS_REBOOT is in a
sense useless: indeed, either nvram-wakeup autodetects properly the M/B ,
or , if it does not, then the best solution is to study the docs and create
a proper nvram-wakeup.conf file . Indeed wakeupshutdown did not have such
a variable. So, if the variable is still there in SVN, I recommend that the
default value should be 'auto'.
----------------------------------------------------------------------
Comment By: Duncan Webb (duncanwebb)
Date: 2006-12-10 08:18
Message:
Logged In: YES
user_id=104395
Originator: NO
In freevo 1.6.1 svn (rel-1-6) at r8709 most of the changes have been
applied. These have been merged to rel-1 at r8710.
The debian specific stuff should be in the local_conf.py
----------------------------------------------------------------------
Comment By: Duncan Webb (duncanwebb)
Date: 2006-12-10 07:40
Message:
Logged In: YES
user_id=104395
Originator: NO
Not all motherboards need a reboot to set the wakeup alarm, some need it
when certain settings have changed and others need it every time. You can
tell nvram-wakeup what the criteria is by adding need_reboot to the
nvram-wakeup.conf file.
If a reboot is needed then grub or lilo need to have extra menu options,
so the user needs to know if a reboot is required and this is either true
or false.
from the nvram-wakeup.conf man page.
need_reboot = (OFF|ON_STAT|ON_SEC|ON_MIN|ON_HOUR
|ON_DAY|ON_MON|ON_WDAYS|ON_ANY_CHANGE|...),
default: OFF
...
The idea behind this is if nvram-wakeup decides that we need to reboot, it
will exit with exit status 1 (instead of 0). So the script which runs
nvram-wakeup could react on this. We also print it to stderr, so if
nvram-wakeup is run directly on the command line, the user could react
appropriately.
What this means, is that the script doesn't really need
AUTOSHUTDOWN_BIOS_NEEDS_REBOOT at all because the return value from the
__syscall tells it if a reboot is required.
0 no
1 yes
2+ error.
I would leave AUTOSHUTDOWN_BIOS_NEEDS_REBOOT alone, if it is true then a
reboot is required. If it is false then the return value determines what to
do.
If nvram_wakeup has not been correctly set up, this is not a freevo
problem and so it should report the error and do nothing else.
----------------------------------------------------------------------
Comment By: A C G Mennucc (mennucc)
Date: 2006-12-09 23:44
Message:
Logged In: YES
user_id=79281
Originator: YES
> I don;t really think it is necessary to do this change, because needs
> reboot is hardware specific, it's either true or false. It needs to be
know
> by the user for them to set grub or lilo up correctly.
I do not really understand... may you elaborate?
----------------------------------------------------------------------
Comment By: A C G Mennucc (mennucc)
Date: 2006-12-09 23:22
Message:
Logged In: YES
user_id=79281
Originator: YES
last fix to patch (hopefully)
File Added: freevo-1.6.1-autoshutdown.diff
----------------------------------------------------------------------
Comment By: A C G Mennucc (mennucc)
Date: 2006-12-09 22:55
Message:
Logged In: YES
user_id=79281
Originator: YES
I also added a 'raise ExInternalError' in the code; it triggers when
nvram fails ; it also triggers if AUTOSHUTDOWN_WAKEUP_CMD is not set
correctly (and this is why my freevo box was not waking up)
Moreover, I eventually set
AUTOSHUTDOWN_BIOS_NEEDS_REBOOT = 'auto|always|never'
and again I added code that complains if the value is not in that list of
choices.
----------------------------------------------------------------------
Comment By: Duncan Webb (duncanwebb)
Date: 2006-12-09 22:53
Message:
Logged In: YES
user_id=104395
Originator: NO
I don;t really think it is necessary to do this change, because needs
reboot is hardware specific, it's either true or false. It needs to be know
by the user for them to set grub or lilo up correctly.
There is another way to set the wake up time and that is by using acpi and
sending the time there.
----------------------------------------------------------------------
Comment By: A C G Mennucc (mennucc)
Date: 2006-12-09 22:50
Message:
Logged In: YES
user_id=79281
Originator: YES
> The idea of someone being logging is pausing shutdown is a really good
> one, but I have a question what are four bytes that are return when
nobody
> is logging?
hi
I use Debian GNU/Linux; here, when nobody is logged, 'who' returns just a
empty string. So I applied a similar patch to 'wakeupshutdown' in freevo
1.5.4; in that case, I was just testing
if os.popen("/usr/bin/who").read()
and it worked fine
but I cannot exclude that , maybe in other Unix'es it may return a single
newline
4 chars was just a wild guess, something in between a full line such as
root pts/0 2006-12-09 21:48 (:0.0)
and a single newline.
----------------------------------------------------------------------
Comment By: A C G Mennucc (mennucc)
Date: 2006-12-09 22:40
Message:
Logged In: YES
user_id=79281
Originator: YES
correction to the patch
File Added: freevo-1.6.1-autoshutdown.diff
----------------------------------------------------------------------
Comment By: A C G Mennucc (mennucc)
Date: 2006-12-09 22:15
Message:
Logged In: YES
user_id=79281
Originator: YES
sorry I had noted that mistake ( = instead of == ) ; but also I found out
that my Freevo box is not waking up when it should ... so I have been
debugging this for 3 hours now; as soon as I fix this as well, I will post
an updated patch; I will also set AUTOSHUTDOWN_BIOS_NEEDS_REBOOT to
required,
not_required and dont_know.
----------------------------------------------------------------------
Comment By: Duncan Webb (duncanwebb)
Date: 2006-12-09 22:09
Message:
Logged In: YES
user_id=104395
Originator: NO
The variable WARN_SHUTDOWN, etc are a bit of history, I'll get grid of
these, thanks.
mencoder, should be in the list of pausing programs.
nvram_wakeup does not have a -w option in all builds, this may be a debian
extension at the five minutes is hardcoded in one of the header files.
The idea of someone being logging is pausing shutdown is a really good
one, but I have a question what are four bytes that are return when nobody
is logging?
I don't like the implementation of AUTOSHUTDOWN_BIOS_NEEDS_REBOOT=auto,
True, False and auto don't really go together, better with required,
not_required and dont_know. What do you think?
+ ec = __syscall(cmd)
+ if config.AUTOSHUTDOWN_BIOS_NEEDS_REBOOT != False and \
+ (ec == 256 or config.AUTOSHUTDOWN_BIOS_NEEDS_REBOOT =
True):
the last line should be:
+ (ec == 256 or config.AUTOSHUTDOWN_BIOS_NEEDS_REBOOT
== True):
IIRC nvram_wakeup can return 1 if it needs a reboot, this can be set up in
the nvram_wakeup config file.
Many thanks
----------------------------------------------------------------------
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=446895&aid=1612257&group_id=46652
-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Freevo-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/freevo-devel