# Its all gone?..>AHH



## benallenuk (Aug 1, 2005)

I dont know what happened, but tivoweb now doesnt work. I can still telnet, but the command ls doesnt work. I can ftp, but my var directory is empty. I have a backup, but think its pretty old. Whats happened??


----------



## ciper (Nov 4, 2004)

From the description it sounds like a VAR wipe. It surprises me that you havn't heard of it before though. Its a somewhat "common" issue.

Think of it this way, you can now rehack the unit cleanly and put the hacks in a place that wont get erased.


----------



## cwaring (Feb 12, 2002)

ciper said:


> ..that wont get erased.


Until next time it happens anyway


----------



## mikerr (Jun 2, 2005)

No, if you put your hacks in the "main" filesystem, they will NEVER get erased.
It's only the directory /var and everything under it that gets wiped in certain circumstances.

...or you could just have a backup of /var on the main filesystem that auto-restores on a /var wipe


----------



## AMc (Mar 22, 2002)

To the OP - this guide helped me a great deal when I needed to install hacks the first time around, not just "how to" but "why" as well.
http://tivo.stevejenkins.com/network_cd.html

I use information from this thread to make a backup of /var which I hive off to my PC for safe keeping. I also keep a copy of rc.sysinit.author
http://www.tivocommunity.com/tivo-vb/showthread.php?p=3844640#post3844640

To Mikerr, ciper et al - is there any advantage to using /var over creating hacks in the main file system. I assume I'd need to set rw to change stuff and it would be blitzed if we got new software (stop laughing in the back). Any other issues to be aware of?


----------



## verses (Nov 6, 2002)

/var is used to cater for circumstances whereby if you had added a hack that was causing problems that stopped TiVo from booting, it would be wiped automatically by the Tivo following a few boot failures.

If the hack was in the main file system then recovering the system from a serious failure would be a lot less straight-forward. However, as the stability/impact of many hacks/3rd-party-commands is minimal (ls for example) storing them in the main file-system is relatively low risk.

Cheers,

Ian


----------



## Ian_m (Jan 9, 2001)

I have the following TCL script in my /var directory which I run occasionally to create a hack.tar.gz file which I then FTP to my PC. Note also included the restore instructions in the script as well.

Yes I have had to have recreate the hack directory once, most annoying bit was you loose the "tracker" module database and thus start recording programmes that have been recorded before.

```
/var/hack/bin/tar -cvh hack | gzip > hack.tar.gz

# Restore with
# gzip -d hack.tar.gz
# cpio -H tar -i < hack.tar
```
I also experimented with CRON and running the script every day at say 5.30am (just after tracker has run) and then scheduling an FTP task on my PC to copy to PC for safe keeping.


----------



## PhilG (Jan 15, 2002)

I like the bit about running a backup fairly regularly via cron, but is it possible to store the backup file somewhere "safe" on the Tivo?

Then it could be made totally auomatic

As an alternative, if the backup file is not too humungous, has anyone got a script that'd eMail it out (a la dailymail)??

Thanks


----------



## mikerr (Jun 2, 2005)

If you have a stable system you can automate it just by placing the backup in the main filesystem, and restoring it if /var/hack disappears.

It's not a good idea to do that if you regularly install new hacks (or write dodgy ones yourself ! ) as the /var wipe after one or two failed restarts is a good failsafe.


----------



## Prof. Yaffle (Aug 2, 2002)

I've got mine set to create a backup file every Sunday and then my PC set to FTP it from TiVo to my PC a few minutes later. There's a script knocking about this forum somewhere to do it.


----------



## PhilG (Jan 15, 2002)

Prof. Yaffle said:


> I've got mine set to create a backup file every Sunday and then my PC set to FTP it from TiVo to my PC a few minutes later. There's a script knocking about this forum somewhere to do it.


Snag is, my pc spends most of it's time either off, or in a secure VPN tunnel from where I can't see Tivo - which is why I was asking about a mailed backup......


----------



## ciper (Nov 4, 2004)

Why not have the Tivo FTP it up to a host on the internet then?


----------



## PhilG (Jan 15, 2002)

ciper said:


> Why not have the Tivo FTP it up to a host on the internet then?


Now THAT sounds like a useful possibility

For a Linux novice, what does a Tivo FTP command to send a file to an external website look like - and I assume I could just bury this in crontab somewhere too??

Thanks for the idea - it had never ocurred to me

Phil G


----------



## PhilG (Jan 15, 2002)

I knew I should have been working, but this is FAR more interesting 

Anyway, I now have a couple of comamnds that TAR up my var/hack to a 21Mb .tar file and then gzips it to a 4Mb "scrunched" version

I also have a web site ready to host said scrunched .tar file

Snag is, try as I might I just can't get the hang of a command line FTP

Using my trusty FTP explorer, I can do the transfers so I know I am not hitting any authorisation errors or the like, but from cron I'd obviously need a single line FTP command. It's further complicated by my needing to log on to my target FTP site too

So, a plea for help from an FTP expert please, but be gentle with me 

Thanks


----------



## mikerr (Jun 2, 2005)

Something like the following in cron:

ftp < /var/hack/ftpscript > /var/log/ftp

where ftpscript is a file containing:

open 158.152.1.58
username 
password 
bin
put backup.tar.gz
quit

Remember tivo has no DNS as standard, so you have to use the ip address of the ftp server. Type "ping servername.com" to find the ip address.


----------



## PhilG (Jan 15, 2002)

mikerr said:


> Something like the following in cron:
> 
> ftp < /var/hack/ftpscript > /var/log/ftp
> 
> ...


Sounds good, thanks

One last question - how do I specify a location on the target server where I want the file to be ftp'd to?


----------



## ColinYounger (Aug 9, 2006)

add a line saying:

cd <path>

Which will change to the location on the remote server. FWIW,

lcd <path>

Will change the location on your local machine. So a more explicit script might be:

open 158.152.1.58
username
password
bin
cd /remote/directory/structure
lcd /where/your/file/is/on/TiVo
put backup.tar.gz
quit


----------



## PhilG (Jan 15, 2002)

OK - slightly more basic question (oops)

WHERE can I find an FTP client for Tivo??

For some reason I thought I already had one, but can't find it in the usual places


----------



## ciper (Nov 4, 2004)

If your Tivo is hacked there is a good chance you have a copy of tivoftpd in the /var/hack folder.
If not here is an old copy of the hack files that should have it http://tivo.stevejenkins.com/downloads/tivobin.tgz

Also in case you didn't know you should be able to combine the compression step into one line. For example:
tar -cvh hack | gzip > hacks.tar.gz


----------



## PhilG (Jan 15, 2002)

ciper said:


> If your Tivo is hacked there is a good chance you have a copy of tivoftpd in the /var/hack folder.
> If not here is an old copy of the hack files that should have it http://tivo.stevejenkins.com/downloads/tivobin.tgz
> 
> Also in case you didn't know you should be able to combine the compression step into one line. For example:
> tar -cvh hack | gzip > hacks.tar.gz


Nope - I don't have it (despite having a very hacked Tivo) 

and it's not in that tivobin.gz file either 

Thanks for the tar/gzip hint - VERY useful

Phil G


----------



## TCM2007 (Dec 25, 2006)

tivoftpd is an FTP server not an FTP client.

IIRC httpput is on a TiVo as standard; with the right server at the other end you could use that.


----------



## ciper (Nov 4, 2004)

TCM2007 said:


> tivoftpd is an FTP server not an FTP client.


Oops... you are exactly right! Hehe

Find links to standalone and shared library versions of FTP and other internet utilities http://homepage.ntlworld.com/maxwells.daemon/tivo/ports.html#inetutils


----------



## PhilG (Jan 15, 2002)

Surely someone has a favourite FTP client (oops!) that they use on their Tivo??


----------



## BrianHughes (Jan 21, 2001)

An FTP client is what you want. I don't know of any myself - but that doesn't mean anything as I haven't tried to do this. 

I keep an old Windows 98 laptop (64MB ram!!!) going in a corner which downloads podcasts, records radio etc and is on all the time. Anything I want to happen automatically is kicked off from there. It cost me absolutely nothing as it has a damaged screen and was given to me by a mate. I don't need the screen to work as I vnc into it when I need to change anything.


----------



## TCM2007 (Dec 25, 2006)

Alternatively, run the scheduled FTP job on a PC to copy the file FROM the Tivo to a local directory.


----------



## PhilG (Jan 15, 2002)

The only computer I have in the house that's running all the time IS Tivo

That's why I am asking for an FTP client......


----------



## TCM2007 (Dec 25, 2006)

I've not heard of an ftp client for TiVo.


----------



## PhilG (Jan 15, 2002)

TCM2007 said:


> I've not heard of an ftp client for TiVo.


OK, back to my original question then

Anyone able to help me eMail out a gzipped backup of my var/hack??

Thanks


----------



## mikerr (Jun 2, 2005)

There's a tivo ftp client on the link cipher gave above, in with lots of other utilities - I've separated it out and attached it.


----------



## ciper (Nov 4, 2004)

Did everyone completely skip over post 22 of this thread where I linked to an ftp client?



TCM2007 said:


> I've not heard of an ftp client for TiVo.


WHAT?! With the multiple compilers available for the S1 I have seen nearly any type of program available for the Tivo. Hell I even have a web browser on mine with DNS support.


----------



## mikerr (Jun 2, 2005)

Yeah, there is lynx, but thats only in a telnet session, so a bit pointless really?


----------



## TCM2007 (Dec 25, 2006)

Didn't realise your link pointed to one!


----------



## ciper (Nov 4, 2004)

mikerr said:


> Yeah, there is lynx, but thats only in a telnet session, so a bit pointless really?


Not pointless. It lets you access TWP locally through the loopback adapter.


----------



## PhilG (Jan 15, 2002)

ciper said:


> Oops... you are exactly right! Hehe
> 
> Find links to standalone and shared library versions of FTP and other internet utilities http://homepage.ntlworld.com/maxwells.daemon/tivo/ports.html#inetutils


Typical - I read every post APART from the one that answered my question - apologies ciper

Anyway - I KNOW HAVE FTP ON MY TIVO - Whoopee


----------



## PhilG (Jan 15, 2002)

I knew I shouldn't have got too excited

I did an

open
bin
cd ....
lcd ...

and a

put

ftp went away and twiddled it's thumbs for a while and then came back with 

"421 No Transfer Timeout (300 seconds): closing control connection."

So what did I do wrong 

It was going so well too 

I'm trying to ftp out around 6Mb (across a 10mbps wireless link to my 400kbps upstream adsl) if that's helpful.....

PS I just tried with a 300 byte file - that also times out. And YES, I can ftp to the remote server using my Windows ftp program no problems, so it does seem to be an "ftp'ing out of Tivo" problem

PPS From a Windows command prompt ftp, I see PORT, Opening and transfer complete messages - I don't see ANY of these on my Tivo ftp so it looks like it's not even trying to start the transfer (or the PORT command is failingm, whatever THAT does?)


----------



## PhilG (Jan 15, 2002)

OK, found a debug switch THAT helped

My Tivo ftp dies issuing

PORT 192,168,0,222,4,181

where 192.168.0.222 is indeed the IP address of Tivo

I assume the 4 and 181 are port numbers. ALL outbound services are enabled in my router/firewall - do I have to do something in Tivo to enable outgoing ports??


----------



## SPR (Nov 28, 2001)

Can you ftp from TiVo to your windows machine? Wanted to check whether it was a router/firewall issue rather than an out of TiVo problem...


----------



## SPR (Nov 28, 2001)

Sorry - hadn't refreshed my screen before replying before. Firewalling already seemed ok before my response...

Have you installed the C & ncurses libraries?


----------



## PhilG (Jan 15, 2002)

SPR said:


> Sorry - hadn't refreshed my screen before replying before. Firewalling already seemed ok before my response...
> 
> Have you installed the C & ncurses libraries?


errr No....

and you're in danger of losing me now, so please make it simple

what else do I need. Given the choice of "shared" and "no-shared" library versions of ftp, I went for "non-shared" thinking that I'd only have to put the ftp executable on my Tivo - was there more I should have done?


----------



## PhilG (Jan 15, 2002)

SPR said:


> Can you ftp from TiVo to your windows machine? Wanted to check whether it was a router/firewall issue rather than an out of TiVo problem...


I get "connection refused" when I try to open my Windows IP address


----------



## PhilG (Jan 15, 2002)

I'm sure this is irrelevant, but when I start FTP it says "While opening UTMP file: No such file or directory"


----------



## PhilG (Jan 15, 2002)

PhilG said:


> OK, found a debug switch THAT helped
> 
> My Tivo ftp dies issuing
> 
> ...


Just trying this again,

NOW the PORT command that's failing is PORT 192,168,0,222,4,200

Just what IS a "PORT" command anyway?


----------



## PhilG (Jan 15, 2002)

WHOOHOOO!!!

Aparrently I need to use "passive" ftp (it seems the default FTP expects to have a conversation with the other computer and that was failing, probably due to my firewall)

Adding the "passive" command and it now works like a charm


----------



## PhilG (Jan 15, 2002)

mikerr said:


> Something like the following in cron:
> 
> ftp < /var/hack/ftpscript > /var/log/ftp
> 
> ...


Despite redirecting input to come FROM a command file (as above) I am STILL being prompted for a password when I run this from a telnet session

ie I do

ftp < /var/hack/ftpscript > /var/log/ftp

and ftp opens the target server, passes the login id and then a PASSWORD prompt pops up

I am a little concerned about running this from cron in case the same thing happens.......


----------



## PhilG (Jan 15, 2002)

Anyone??

I've tried everything I can think of and although I redirect input to FTP to some from a command file, it ALWAYS prompts at the terminal for the remote host password - even if I background it by appending a "&" to the end of the command 

I am SO close this is driving me CRAZY 

Many thanks for any suggestions

Phil G


----------



## Richard Loxley (Jun 4, 2002)

My guess would be that the ftp client is hard-coded to always take the password from the console rather than from standard input - I've seen programs written that way before.

If anyone can point me to the source code for the ftp client I can confirm or deny this - and I could probably recompile a version for you to do what you want.

I'll have a look round to see if I can find some source code myself...


----------



## Richard Loxley (Jun 4, 2002)

I've just looked at the version of ftp on my Debian distribution, and it looks at a .netrc file in your home directory for a password before prompting for user input. See http://www.cs.biu.ac.il/cgi-bin/man?netrc+4 for the format.

I don't know if the Tivo version of ftp has this functionality but it might be worth a try?


----------



## ColinYounger (Aug 9, 2006)

bump...

.netrc seems to have no effect. I assume no-one has managed to get around the prompt problem?


----------

