How can I perform a graceful shutdown/reboot?

Discussion in 'TiVo Series 1 - UK' started by ciper, Aug 1, 2007.

  1. Aug 1, 2007 #1 of 22
    ciper

    ciper Active Member

    2,011
    1
    Nov 4, 2004
    I've been rebooting my Tivo ALOT lately (see http://www.tivocommunity.com/tivo-vb/showthread.php?t=360675 ) and would like to find a way to do it gracefully.

    Pulling the plug, using "restart the recorder" from the UI, running /sbin/restart or using the reboot binary all crash the system resulting in corruption on the var partition. I'm not surprised that people lose their hacks!

    Is there another binary or script that exists which will shutdown the Tivo properly? I always worry about the potential for database corruption that isn't reported since the partitions are not mounted normally.
     
  2. Aug 2, 2007 #2 of 22
    ColinYounger

    ColinYounger It wasn't me.

    1,381
    0
    Aug 9, 2006
    Southsea,...
    I've rebooted my TiVo plenty of times while tinkering with scripts, and have not once had fsck run. I've even used 'reboot' from the shell prompt and not seen a problem.

    So I'm wondering if your tinkering has made the TiVo unstable.

    Also - is your root partition set to read only before a reboot or RW? I'm wondering if rebooting while in RW mode is causing the problem.
     
  3. Aug 2, 2007 #3 of 22
    ciper

    ciper Active Member

    2,011
    1
    Nov 4, 2004
    Check your kernel log. e2fsck always runs even if the FS is clean. I tested this by pulling the drive and cleaning the var partition and then placing it back into the Tivo. I didn't mean mfsfix/gsod. The closest thing I can think of is running
    Code:
    sync ; reboot
    But even that still causes some corruption on var

    Here is an example of what to look for.
    Code:
    Jan  1 00:03:18 (none) kernel: Loading input section drivers
    Jan  1 00:03:18 (none) kernel: [b]Cleanup /dev/hda9 pass 1[/b]
    Jan  1 00:03:18 (none) kernel: ext2fs_check_if_mount: No such file or directory
    Jan  1 00:03:18 (none) kernel: /dev/hda9 was not cleanly unmounted, check force
    Jan  1 00:03:18 (none) kernel: Deleted inode 28712 has zero dtime.
    Jan  1 00:03:18 (none) kernel: Set dtime? yes
    Jan  1 00:03:18 (none) kernel:
    Jan  1 00:03:18 (none) kernel: Fix summary information? yes
    Jan  1 00:03:18 (none) kernel:
    Jan  1 00:03:18 (none) kernel: /dev/hda9: 505/32768 files (4.0% non-contiguous)
    Jan  1 00:03:18 (none) kernel: Cleanup /dev/hda9 pass 2
    Jan  1 00:03:18 (none) kernel: ext2fs_check_if_mount: No such file or directory
    Jan  1 00:03:18 (none) kernel: /dev/hda9: clean, 505/32768 files, 27338/131072
    Jan  1 00:03:18 (none) kernel: /dev/hda9 is clean after pass 2
     
  4. Aug 2, 2007 #4 of 22
    blindlemon

    blindlemon tivoheaven.co.uk

    5,577
    0
    May 12, 2002
    Malmesbury, UK
    Try "restart" :)
     
  5. Aug 2, 2007 #5 of 22
    ciper

    ciper Active Member

    2,011
    1
    Nov 4, 2004
    I edited my first post to include restart. It does it too. Here is the log entries from using /sbin/restart

    Code:
    Jan  1 00:03:19 (none) kernel: Loading input section drivers
    Jan  1 00:03:19 (none) kernel: Cleanup /dev/hda9 pass 1
    Jan  1 00:03:19 (none) kernel: ext2fs_check_if_mount: No such file or director
    Jan  1 00:03:19 (none) kernel: /dev/hda9 was not cleanly unmounted, check forc
    Jan  1 00:03:19 (none) kernel: Fix summary information? yes
    Jan  1 00:03:19 (none) kernel:
    Jan  1 00:03:19 (none) kernel: /dev/hda9: 529/32768 files (6.0% non-contiguous
    Jan  1 00:03:19 (none) kernel: Cleanup /dev/hda9 pass 2
    Jan  1 00:03:19 (none) kernel: ext2fs_check_if_mount: No such file or director
    Jan  1 00:03:19 (none) kernel: /dev/hda9: clean, 529/32768 files, 32223/131072
    Jan  1 00:03:19 (none) kernel: /dev/hda9 is clean after pass 2
    Jan  1 00:03:19 (none) kernel: Mounting /var
    I'm going to now try
    sync ; mount -o remount,ro /var ; restart
    even though it doesn't take car of the MFS partitions.
     
  6. Aug 2, 2007 #6 of 22
    mikerr

    mikerr TiVoCentral.co.uk

    2,599
    0
    Jun 2, 2005
    Lancashire, UK
    running restart at least tries to dismount /var ...

    umount -f /var
    gives the mesage that forced umounts aren't implemented yet :(

    fuser -km /var

    but fuser isn't on tivo series1, unless there is a binary floating around the net ?
     
  7. Aug 2, 2007 #7 of 22
    ciper

    ciper Active Member

    2,011
    1
    Nov 4, 2004
    Haha I was just going to post the exact same thing not including fuser.

    My attempt above using "sync ; mount -o remount,ro /var ; restart > /var/reboot.log" resulted in me getting stuck at a "mount: /var is busy" prompt and I cant undo it :(

    Ive been doing all my testing remotely using telnet and a slingbox so it seems I might be done for the night!
     
  8. Aug 2, 2007 #8 of 22
    aerialplug

    aerialplug Serious TiVo User

    1,181
    1
    Oct 20, 2000
    Swansea
    rebooting by pulling the plug or using the shutdown in the UI shouldn't lose /var.

    In my experience, what causes my /var partition is pulling the plug while a reboot is in progress or possibly immediately after TiVo has rebooted while system tasks are still being completed.
     
  9. Aug 2, 2007 #9 of 22
    ciper

    ciper Active Member

    2,011
    1
    Nov 4, 2004
    Even if thats the case any of the current methods of rebooting the system cause some type of errors on the partition and I dont like it. Try it yourself. Afterword search your kernel log for "cleanup"

    Looks like there was a discussion about something similar on the other forum http://xaddr.com/sh

    Edit: Hmm this is getting a little better but not quite http://forums.oztivo.net/showthread.php?t=962
     
  10. iankb

    iankb New Member

    6,468
    0
    Oct 9, 2000
    Reading, UK
    Your local electricity company can also do it remotely by cutting your power twice in quick succession.
     
  11. TCM2007

    TCM2007 New Member

    3,947
    0
    Dec 25, 2006
    Those error messages just seem to indicate that the "unmounted cleanly" flag (if that's what it's called) isn't set. I can't see this does any harm? /var is only wiped if it fails a second check.
     
  12. aerialplug

    aerialplug Serious TiVo User

    1,181
    1
    Oct 20, 2000
    Swansea
    Yes, I suffered this last December.
     
  13. boringgit

    boringgit New Member

    34
    0
    Jan 20, 2007
    Every now and again my Tivo appears to be interlaced.

    Recordings are fine, but entirely unwatchable until you reboot. Happens to me about once a fortnight...
     
  14. TCM2007

    TCM2007 New Member

    3,947
    0
    Dec 25, 2006
    What do you mean? TiVo's output is always interlaced.
     
  15. AMc

    AMc Active Member

    2,623
    0
    Mar 22, 2002
    East of England
    I stuck a cheap UPS on mine to prevent it all going to pot when the power goes out for a couple of minutes which was quite regular over winter. Pleased to learn this should save me more than the odd recording!

    I can recommend this 500VA one - you'll need to convert a power strip to a kettle lead connection.
    http://cpc.farnell.com/jsp/search/productdetail.jsp?SKU=CS1324907
    £33 inc VAT + delivery or free delivery if your exVAT order is over £40.
     
  16. mikerr

    mikerr TiVoCentral.co.uk

    2,599
    0
    Jun 2, 2005
    Lancashire, UK
    One of my tivos does that too... tivo seems to get its video output clock rate confused, all display including menus are all affected. Its like the effect you get when a PC is its outputting a scan rate the monitor can't handle (no picture roll though)

    Its been doing it once a week or so for the past 2 years, and hasn't got any worse. A reboot cures it, and recordings are unaffected.
     
  17. ciper

    ciper Active Member

    2,011
    1
    Nov 4, 2004
    The best solution I have found so far is to use
    Code:
    /bin/sync ; /sbin/restart
    This still results in the error on startup that the FS was not unmounted but at least there aren't other errors. The /sbin/restart binary tries to unmount var but is unable to because the FS is in use. I think tivoweb and mfs_ftp are to blame so I'm going try and create a scrip that syncs the disk, kills the offending app and then runs the combination sync;restart.

    Code:
    bash-2.02# sync ; restart
    Killing processes...
    Dismounting /var
    Couldn't dismount /var
    Restarting system...
    TmkLogger:
     
  18. mikerr

    mikerr TiVoCentral.co.uk

    2,599
    0
    Jun 2, 2005
    Lancashire, UK
    I've just found a post from yourself saying you have the fuser binary, so

    fuser -km /var

    kills any processes that are using /var
    then you should be able to unmount it.

    fuser -um /var

    would show which processes are using /var
     
  19. ciper

    ciper Active Member

    2,011
    1
    Nov 4, 2004
    Nice! Ill try that. Its kinda funny but I was planning to re enable mode0 on my tivo and after searching I found a post by myself that I didn't even remember writing that had all the settings in it LOL
     
  20. TCM2007

    TCM2007 New Member

    3,947
    0
    Dec 25, 2006
    Careful; forcibly killing a process running under tivosh which has the databse open can (and usually does) make the TiVo crash and reboot in anything but a nice way!

    That's why EndPad, mfs_ftp and other have these convoluted ways of unloading themselves, 'cause kill -9 ends up with the "Almost there..." screen.
     

Share This Page