0

I use an external HPC system via ssh. Today I tried to install "ASE" a Python code for dealing with atoms. I followed instructions to modify my .bashrc file but kept getting ModuleNotFoundError: No module named 'ase' So I executed a source command for my .bashrc file, thinking that would be necessary to get the changes to the .bashrc file recognized (unfortunately, I don't remember the exact command).

Now when I try to execute any kind of command (even after logging out and logging back in), I get:

###################################################################################### (<-- normal welcome message that I always get on login up to here)
-bash: /usr/bin/whoami: Argument list too long
-bash: /usr/bin/cut: Argument list too long
-bash: /usr/bin/logger: Argument list too long
me@n01:~> 

I have looked around online for a solution, but don't see any examples of this particular situation. Most people who get the same error still seem to be able to access their files. Can anyone help?

I can't login as root because this is a system I'm accessing via ssh. I can't access my .bashrc or .bash_profile files without getting the error.

13
  • 1
    Log in but start another shell? ssh -t user@host /bin/sh
    – Kusalananda
    Commented Dec 31, 2020 at 15:32
  • I tried that. I can login but if I try to do anything else, I get the error.
    – NTS
    Commented Dec 31, 2020 at 15:33
  • So you get a prompt? It would be helpful if you could show the text of an SSH session in the question (including the error message).
    – Kusalananda
    Commented Dec 31, 2020 at 15:34
  • 1
    I modified the question to show exactly what I see when I login. I will now double-check that Kusalananda's suggestion doesn't work...
    – NTS
    Commented Dec 31, 2020 at 15:40
  • 1
    The important bit (/bin/sh) is at the end of ssh -t. Please confirm that you included this.
    – Panki
    Commented Dec 31, 2020 at 15:48

2 Answers 2

6

If I'm interpreting your text correctly, then you are quite possibly sourcing the ~/.bashrc recursively, either from itself, or it and ~/.bash_profile are sourcing each other indefinitely (it's not clear from the question). The effect of this would likely be that one or several environment variables are growing out of proportion, which would lead to the error message that you quote.

To fix this, you will have to access your account without starting the bash shell.

You can do that with, for example,

ssh -t user@host /bin/sh

(where user@host is your username on and the host's address). This starts the /bin/sh shell rather than your default login shell. The /bin/sh shell does not normally source the ~/.bashrc file, so you would not have the same issue with this shell. You could pick any other shell, but the /bin/sh shell is more or less guaranteed to exist.

This would allow you to log into the account, into a possibly unfamiliar but fully functional shell, to fix the issue, which, again, seems to be related to recursively sourcing the ~/.bashrc file in one way or another.

I have not addressed the issue you had with Python. That issue may be something that you may want to ask a separate question about, after making sure that your local sysadmin team can't help you with it first.

1
  • Thank you, very helpful.
    – NTS
    Commented Dec 31, 2020 at 20:17
3

You are recursively adding the contents of .bashrc to .bashrc

One way out of that is to set your PATH variable to a sane value, then executing external programs should work (you will have to modify .bashrc though so that it doesn't happen again).

$ PATH=/usr/sbin:/usr/bin:/sbin:/bin

and then, for example:

$ vi .bashrc
4
  • thank you for explaining. I can't access .bashrc right now though because I get the error no matter what I do.
    – NTS
    Commented Dec 31, 2020 at 15:44
  • Are you sure that you cannot type PATH=/usr/sbin:/usr/bin:/sbin:/bin and then Enter at the prompt? Commented Dec 31, 2020 at 15:47
  • yes, unfortunately, I couldn't type anything without getting the error. Just now I tried Kusalananda's suggestion about logging in and it worked though. So now I'm in and can access the .bashrc. I'm trying to figure out where I went wrong.
    – NTS
    Commented Dec 31, 2020 at 16:09
  • 1
    The reason nothing seems to be working could (possibly) be due to the shell failing to execute commands in $PROMPT_COMMAND. Safer to just start another shell and sort it out from there...
    – Kusalananda
    Commented Dec 31, 2020 at 18:16

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .