# Bash Prompt



## Graham V (Jun 26, 2002)

Due to the old hard drive giving up the ghost, I have just had to install a new drive into my Tivo.
I thought I may as well do a fresh install of TivowebPlus rather than use the backup from the old drive and it all now works swimmingly, apart from one small frustration 

Due to an intermittent problem with Tivowebplus, I always shut it down after use and restarted it when needed. I use Windows XP Telnet to get to the Tivo Bash prompt, and when I used to press the 'Up' arrow key at the prompt it used to automatically bring up the full command to start Tivoweb. Now, since the reinstall, pressing the 'Up' key brings up some of the commands I used to install Tivoweb and some of its modules, and it always the same commands each time. I am using the same version of TWP and all the same modules.
I presume the command lines are stored somewhere in Tivo, but where are they stored and is there any way of changing them.


----------



## Richard Loxley (Jun 4, 2002)

Pressing the up arrow in bash just scrolls through all the previous commands you issued.

If you keep scrolling up you may find the command you want.

Or you can type 'history' to see all the previous commands. If you see the one you want you can type ! followed by the number of the command to execute it, e.g. !223 to execute command number 223.

This is all stored in a file called '.bash_history' which is probably stored in /root/.bash_history. But you shouldn't ever need to touch that file, it is generated automatically as you execute commands.


----------



## mikerr (Jun 2, 2005)

As richard said, its stored on /.bash_history which is set to read-only in normal tivo use.
Only /var and /tmp are writeable normally.

You only add items to the history if you are working with the filesystem set to r/w

So

a) set the filesystem to r/w while you type a few commands to be remembered 
*mount -o remount,rw / *

or

b) Fix it permanently by making a link from the history file into the /var partition:

*mount -o remount,rw / 
mv /.bash_history /var
ln -s /var/.bash_history /.bash_history
mount -o remount,ro / *

run the above once only from the command line


----------



## Pete77 (Aug 1, 2006)

mikerr said:


> b) Fix it permanently by making a link from the history file into the /var partition:


Is that "permanently" as in until your Tivo randomly decides to delete your /var directory for no particular reason.


----------



## mikerr (Jun 2, 2005)

It's not random, tivo deletes /var if the startup filesystem check fails to complete twice in a row.

E.g. you have pulled the plug while its starting up.


----------



## Pete77 (Aug 1, 2006)

mikerr said:


> It's not random, tivo deletes /var if the startup filesystem check fails to complete twice in a row.
> 
> E.g. you have pulled the plug while its starting up.


I'm still unable to account for my recent /var wipeout though as although I had taken it off the UPS (worried it was defective due to nasty clicking and buzzing sounds occasionally) a month or two earlier nothing else that is reset by a mains outage or blip (eg digital clock on oven in kitchen) was flashing when I got back home on the day it happened.

The two HA250JC hard drives are of course three years old, although smartctl still finds nothing wrong with them.

Can you remind me what are the arguments against installing Tivoweb in a non wipeable area of Tivo's hard drive? Is there not enough space there for instance? Especially if you have Tivoweb and Tivowebplus and a lot of hacks?


----------



## Graham V (Jun 26, 2002)

Thanks to Richard and mikerr, the problem is now sorted. 

I think the file system was set to Read Write briefly when installing a Tivoweb module and the history had been written during that time and then locked when the file system was set to Read Only.
I set the file system to RW, typed the command a couple of times just to make sure, then rebooted the Tivo. Hey presto, with the command comes up.


----------



## Pete77 (Aug 1, 2006)

Mike or whoever,

After my recent /var/hack wipeout and Tivoweb reinstall I tried following some online instructions to edit my ./ profile file. The first time I did this I inadvertently forgot to remount the file system as rewrite before doing so but despite this my edit attempt of ./profile seems to have done something odd and remounting the drive as rw and editing ./profile does not fix it.

The oddness is that every time I now telnet 192.168.0.4 and get the bash prompt I also first get something called the Tivo Prom Monitor version 1.88mojo listing a whole lot of declare -x statements such as DEBUG, HOSTNAME, SHELL, OSTYPE and PROMVERSION. There are two lots of these declare -x statements. The first lot start DEBUG_BOARD and end with PROMVERSION= and the second lot start with PWD= and end in varpartition =. In addition after all this Tivo PROM declare stuff bash-2.02# is then shown twice rather than once. Presumably something to do with my editing of /.profile has caused this as I have never had this behaviour at bash using telnet before.

In addition I cannot connect to the Tivo with Ty*too*s because I cannot start tserver in the said program (I do not start it in rc.sysinit.author.edit) and when I try to run ./tserver after changing to cd /var/hack I now get the message "Segmentation fault" returned.

Yet despite these disturbing problems my Tivoweb 1.9.4 and TivoWebPlus 2.1.0 installs and add on modules (including the demanding DailyMailJazz app run daily by cron) all seem to work normally.

Can anyone shed any light on what they think I have done wrong when reinstalling Tivoweb and what the Segmentation fault message is all about?


----------



## verses (Nov 6, 2002)

Pete77 said:


> I tried following some online instructions to edit my ./ profile file.


Can you point us to these instructions to give us an idea of what edits you made?
Also you start out referring to ./profile and end up referring to /.profile - which one is it? I assume the latter.
By default I think /.profile is empty, you could try renaming it /.profile.old and creating a new empty /.profile then logging in again and seeing if the problems go away, that would pin-point it as being related to the /.profile file (or not).



Pete77 said:


> bash-2.02# is then shown twice rather than once


I would guess you're using PuTTY as a telnet client. There's a setting in there, somewhere that tells it not to do this, although I'm stuffed if I can remember what it is.



Pete77 said:


> In addition I cannot connect to the Tivo with Ty*too*s because I cannot start tserver in the said program (I do not start it in rc.sysinit.author.edit) and when I try to run ./tserver after changing to cd /var/hack I now get the message "Segmentation fault" returned.


I would guess it's been FTP'd in ASCII mode rather than Binary.

Ian

EDIT: Actually, in the putty settings, go to Connection -> Telnet and tick the "Return key sends Telnet New Line instead of ^M" option. I think that's the setting that stops the double bash prompt.


----------



## Pete77 (Aug 1, 2006)

verses said:


> Can you point us to these instructions to give us an idea of what edits you made?


See www.tivohelp.com/archive/tivohelp.swiki.net/24.html



> Also you start out referring to ./profile and end up referring to /.profile - which one is it? I assume the latter.


Yes the latter. The first was my careless typo.



> By default I think /.profile is empty, you could try renaming it /.profile.old and creating a new empty /.profile then logging in again and seeing if the problems go away, that would pin-point it as being related to the /.profile file (or not).


I found what the problem was when I went to edit my /.profile Profile file again with Joe. The export statement had been separated from the PATH=$PATH statment in to two different lines in the file. It was this fault that was then tripping the bash shell to list all possible commands and report the bash prompt twice as the ./profile file now had two lines. Since reuniting export with PATH on one line all has returned to normal and I get a single bash prompt without all the other stuff.:up:



> I would guess you're using PuTTY as a telnet client. There's a setting in there, somewhere that tells it not to do this, although I'm stuffed if I can remember what it is.


I just type telnet 192.168.0.4 at Windows XP Home's Start/Run option. I have not heard of PuTTY before. Is it any good or does it offer more features than the built in Microsoft Telnet client?



> I would guess it's been FTP'd in ASCII mode rather than Binary.


You guessed wrong. I always have Filezilla (which I have always found much superior to Cute FTP when used with file transfer to the Tivo) set to binary transfer by default.

The problem was actually that the copy of t*server in my /var/hack directory did not match with the one in my last backup of /var/hack. Since replacing it with the copy of tserver I had backed up T*y*Tool is now running fine. I think the rogue copy of t*server may have been installed by the Linux installer for Tivowebplus 2.1.0 as I'm blowed if I can see how else it got in to my /var/hack directory.

I also replaced httpd-tt.tcl with the copy I had on my last good backup of my hack directory and I now have an IP address access attempt sitting in my httpd log file.:up:

I'm now looking at whether I couldn't put the whole /var/hack directory and subdirectories in the permanent part of the Tivo file system (as reinstalling Tivoweb for any reason short of it being essential following a hard drive failure is a big pain that wastes a lot of time) although in the interim I have now put the Tivo back on the UPS. I'm deciding whether or not I want to pay APC 15 quid delivered for a new battery (they are the cheapest as there are no cheap Ebay suppliers for this battery model) though as I only paid 9.95 for the whole UPS when Office World were clearing it, even though the normal price of the BE325-UK unit is around 50 quid.

The battery is still holding power for two or three minutes with a Tivo and a Sky Digibox and Freeview box and an RF to Scart converter running on it but I was getting some strange clicking switch outs when I previously decided to take it out of use (I was going away abroad for 3 weeks at the time and worried about any fire risk) as though there had been a mains failure even though my lights didn't dip and my kitchen cooker clock didn't drop to flashing (as it normally does after even only a second long mains blip). However perhaps the APC device was responding to surge activity on the mains not visible to the naked eye or therefore affecting more basic devices like 18 year old fluorescent display Neff kitchen cooker clocks.

Anyhow thanks verses for your various suggestions as they pointed me along the right lines for self diagnosis, even though at the time I thought that I had checked all the obvious stuff.


----------



## verses (Nov 6, 2002)

Pete77 said:


> I just type telnet 192.168.0.4 at Windows XP Home's Start/Run option. I have not heard of PuTTY before. Is it any good or does it offer more features than the built in Microsoft Telnet client?


I find PuTTY invaluable, it's a very handy tool for telnet-ing and ssh-ing to other systems allowing you to save server-specific settings eg.
- Simple things like telnet-ing to TiVo has a light-blue background where as my web host has a red background so they're easily recognisable from one another.
- To more complex things such as automatically setting up ssh-tunnels when connecting to secure servers.

I assumed you were using it as it's sometimes mentioned in connection with TiVo's double bash prompt issue. Although it appears Windows Telnet does this too.

It's fair to say though that the majority of TiVo hackers will probably be happy just using Windows Telnet. It's only really of benefit to people who regularly connect to lots of different servers or require more advanced options.

Ian


----------



## Pete77 (Aug 1, 2006)

verses said:


> It's fair to say though that the majority of TiVo hackers will probably be happy just using Windows Telnet. It's only really of benefit to people who regularly connect to lots of different servers or require more advanced options.


I only use Telnet here at my home address for the Tivo. Hence I suppose being happy with the Microsoft Freebie. The only other time I have used it is at my mother's house to Telnet to my mother's Thomson router (Be Box) which has a firmware glitch that means certain critical operations (forget which it was at this moments as it was ages ago) can only be done by Telnet and not via Thomson's pretty but utterly illogical and mad router http GUI.

I am however surprised that some people try to struggle on with using the Windows FTP client rather than Filezilla or something similar as file manipulation operations via FTP on a Tivo are usually a lot more complex than those involving Telnet.


----------



## johala_reewi (Oct 30, 2002)

Pete77 said:


> bash-2.02# is then shown twice rather than once


If you get a double bash prompt every time you hit enter you need change the stty settings.

At the bash prompt type *stty igncr*

You will have to do this each time you telnet to tivo.
If your telnet client has a macro faciility, you can code this in as part of the connection setup.


----------



## Pete77 (Aug 1, 2006)

johala_reewi said:


> If you get a double bash prompt every time you hit enter you need change the stty settings.


Luckily I don't have a double bash prompt any more as it was caused by the path command in my /.profile file inadvertently having become separated over two lines with a carriage returning splitting what should have been a one line command in two. When I corrected the error in my/.profile file the double bash prompt went away.:up:


----------

