Forum Discussion

Zuke_254875's avatar
Zuke_254875
Icon for Altostratus rankAltostratus
Mar 29, 2018

Bash shell prompt is displaying odd

When I SSH into one of my guests, instead of getting the usual bash prompt, like so:

MBP $ ssh 10.10.10.20
Last login: Thu Mar 29 19:42:38 2018 from 172.16.0.1
[username@f5-prod:/S1-green-P:Active:In Sync] ~ 

I'm getting a strange bash line output:

MBP $ ssh 10.10.10.100
Last login: Thu Mar 29 19:42:38 2018 from 172.16.0.1
-bash-4.1

I'm able to switch to TMSH normally. Any idea what might be causing this or what I need to do to fix it?

  • Your .bashrc profile is deleted some how. There would have been a recent change or event happened on your server, you can investigate it. Or a simple fix have it copied from a server where it exists to this server or manually create it.

    If you login to your server, run the below commands, that should list your .bashrc file. If it doesn't exist you are required to create it.

    Let me reproduce your scenario.

    ltm:Active:Standalone] ~  ls -la .bashrc
    -rw------- 1 user user 124 Feb  8 09:07 .bashrc
    
    ltm:Active:Standalone] ~  cat .bashrc
     .bashrc
    
     User specific aliases and functions
    
     Source global definitions
    if [ -f /etc/bashrc ]; then
            . /etc/bashrc
    fi
    
    :ltm:Active:Standalone] ~  rm .bashrc
    rm: remove regular file `.bashrc'? y
    

    After I delete the .bashrc file, When I start a fresh session, see how the shell looks.

    bash-3.2
    bash-3.2
    bash-3.2
    bash-3.2 vi .bashrc
    bash-3.2
    

    Paste the below in this file,

      .bashrc
    
     User specific aliases and functions
    
     Source global definitions
    if [ -f /etc/bashrc ]; then
            . /etc/bashrc
    fi
    

    After creating you should see the files like below.

    bash-3.2 ls -la
    total 886
    drwx------  3 user user   3072 Mar 30 02:00 .
    drwxr-xr-x 27 user user   1024 Mar 12 08:00 ..
    -rw-------  1 user user  53478 Mar 29 14:34 .bash_history
    -rw-r--r--  1 user user     24 Jan 15  2016 .bash_logout
    -rw-r--r--  1 user user    598 Mar  5  2012 .bash_profile
    -rw-r--r--  1 user user    132 Mar 30 02:00 .bashrc
    

    Now its completed fixed.

    :Active:Standalone] ~ 
    

    Note: the changes will not reflect unless a fresh session is opened.

  • sgamer's avatar
    sgamer
    Icon for Nimbostratus rankNimbostratus

    One of my Linux literate co-workers found another way to fix this which is pretty easy:

     

    1) SSH in and type pwd (to make sure you're in your home directory)

     

    2) Type cp -p /etc/skel/.* ./ (copies the default files to your current directory)

     

    3) logout and then back in again and the prompt should be back to normal.

     

    I'm concerned about how this got messed up. I manage 10 Viprions, 6 i5800s and 40 guests and a significant number of them (If I had to guess, about 20) had lost their bash profiles for my account. My coworker's account was messed up too.

     

    Only accounts on the Viprions and their guests had the problem. I'm interested in what caused this. I have recently upgraded the 10 Viprion hosts and 4 of it's guests to 12.1.2HF2 from HF1. I also upgraded 2 i5800 hosts and 6 of it's guests. I was using the CLI during the upgrades but didn't notice it causing this problem at the time.

     

    It's very annoying but fixed for at least the moment. Interested if anyone else is having this problem.