Bash Shell Prompt change after 11.3

Rolfieo

Cadet
Joined
Jul 16, 2013
Messages
5
I have just upgraded my FreeNAS 11.2-U7 machines to 11.3-U1

What i noticed is that when i now connect to SSH, my shell promt is different for my account.


NAS% echo $PS1
NAS%
NAS%
ps
PID TT STAT TIME COMMAND
4728 0 Ss 0:00.01 -bash (bash)
5148 0 R+ 0:00.00 ps
NAS% bash
[USERNAME@NAS ~]$ ps
PID TT STAT TIME COMMAND
4728 0 Ss 0:00.01 -bash (bash)
5149 0 S 0:00.00 bash
5150 0 R+ 0:00.00 ps
[USERNAME@NAS ~]$ echo $PS1
[\u@\h \w]\$


So uses bash, but if i start another bash shell, it shows correct. As it was always USERNAME@HOSTNAME.

I have checked my account, but it still has the bash as the shell, both in the GUI and and /etc/password file.

I could not find anything in the releasenotes that could point to this.

Anobody has some ideas?
 

RichR

Explorer
Joined
Oct 20, 2011
Messages
77
I got a brand new FreeNAS mini, and it's doing the exact same thing.
 

SweetAndLow

Sweet'NASty
Joined
Nov 6, 2013
Messages
6,421
Probably a difference in bashrc vs bash_profile. Bashrc gets sourced when you typed bash. Bash_profile gets sourced when you log in.
 

SweetAndLow

Sweet'NASty
Joined
Nov 6, 2013
Messages
6,421
...neither exists (at least in mine)
yeah that's the problem. create a bashrc or bash_profile for your user that you are logging in with. If you don't it uses the system default.
 

RichR

Explorer
Joined
Oct 20, 2011
Messages
77
Just to document, with about 8 years of using FreeNAS/TrueNAS, I've never had to do this before.

I totally get that it's not a big deal, but it's an undocumented change (at least not documented in the release notes that I could find).

For future folks that may find this thread useful, FreeNAS 11.3U2 (on a brand new MINI-3.0-E (I'd assume the same for FreeNAS regardless of hardware). In order to get your prompt to "look the same" as it used to, with "[user@hostname pwd]$"

Code:
    Go to your home directory.
nano .bash_profile
    (add a line)
PS1="[\u@\h \w]\$"
    (save then quit [control +o, then control +x])
. .bash_profile
    or
source .bash_profile
   
    log out, log in
 

Da Fox

Dabbler
Joined
Oct 25, 2016
Messages
13
Thanks for the pointers. To fix it for all users at once without requiring everyone to do this themselves:

Code:
--- /etc/profile.template       2020-06-08 17:52:32.618667044 +0200
+++ /conf/base/etc/profile.template     2020-06-08 20:22:33.522385125 +0200
@@ -25,6 +25,7 @@
 PAGER=less;     export PAGER
 BLOCKSIZE=K;    export BLOCKSIZE

+PS1="[\u@\h \w]"
 if [ `id -u` = 0 ]; then
     set -o emacs
     PATH=/sbin:/bin:/usr/sbin:/usr/bin:/usr/games:/usr/local/sbin:/usr/local/bin:~/bin:/usr/local/fusion-io
@@ -36,11 +37,11 @@

     # History file since / is read-only (see #4776)
     HISTFILE=/tmp/.hist$$
-    PS1="`hostname -s`# "
+    PS1="${PS1}# "

     # set ENV to a file invoked each time sh is started for interactive use.
     ENV=$HOME/.shrc; export ENV
 else
-    PS1="`hostname -s`% "
+    PS1="${PS1}$ "
 fi

 
Top