1

I've had Mint installed as a dual boot on my laptop for some time. I use it as my dev environment, for desktop and web related coding. I recently started getting errors which have rendered my terminal unusable. As soon as I start the program up I get the error

/usr/bin/env: bash: No such file or directory

Whenever I try to run a command, I then get the following output:

brae@G62-Linux ~ $ ifconfig
Traceback (most recent call last):
File "/usr/lib/command-not-found", line 21, in <module>
os.execvp("python3", [sys.argv[0]] + sys.argv)
File "/usr/lib/python2.7/os.py", line 344, in execvp
_execvpe(file, args)
File "/usr/lib/python2.7/os.py", line 380, in _execvpe
func(fullname, *argrest)
OSError: [Errno 2] No such file or directory

I don't want to start screwing around with files I don't fully understand, and most of the standard things (apt-get update etc.) aren't possible because of the errors. Can anyone give me any advice? I would just blank the partition and reinstall but I really can't be bothered going through all of that if I don't need to.

Thanks very much.

==========================================================

EDIT- SOLUTION

Thanks to the best answer below, I tracked down the problem to my .bashrc file. Turns out something had modified the file to alter the PATH variable with a Ruby environment which was causing the error. I simply deleted this section from the file (in my case this left the .bashrc file empty) and this solved the error. I believe that if this leaves the file blank, you can also change the .bash_profile (or .profile) file to no longer call the .bashrc file as it is not a requirement for the process.

Thanks for you help everyone who answered, particularly apaul

  • 1
    From the first error, I'd guess your machine can't find the bash executable. What does which bash print? The rest of it sounds pretty confusing, since ifconfig doesn't really have anything to do with Python. What terminal program is this? (It might be good to edit the question with the details.) – Anko Apr 21 '15 at 13:07
  • 1
    The second error is from the command-not-found program, which searches for packages containing a command. I'm going to guess your PATH is messed up. What is the output of echo $PATH? – muru Apr 21 '15 at 14:21
1

Many possibilities. At login time, usually, 3 steps are done:

1) At login time, the shell specified in /etc/passwd is launched. So I'd first have a look at /etc/passwd (using GUI as gedit, since you can't use terminal...) and check the shell (it's the last field). You may have a line like this for your user:

user:x:500:500::/home/user:/bin/bash

(You may have /bin/sh, /bin/csh, /bin/zsh, ... but /bin/bash is the most common)

2) Then the shell will read the content of your /home/user/.bash_profile (if you use bash). So I'd look this file (ie: open it with gedit, but watch out, filenames starting with a . are hidden by default) and see if it launch any python command.

3) Finally, /home/user/.bashrc is also read when launching your terminal. So I'd have a look at this file too.

These are the first steps I'd do, looking if any of these files launch a python, ipython, xonsh command, or any py script.

  • If bash is not found, and /etc/passwd sets bash as user's shell, then none of the steps you suggest - that rely on the shell (i.e., most) will work. – boardrider Apr 22 '15 at 11:32
  • @boardrider Yep, that's why I ask him to use a GUI to read these 3 files. But yeah, my text is not clear, I'll edit it. – apaul Apr 22 '15 at 11:36
  • Thanks for answering. Been trying to find time to sit down and have a proper go at this since then. I can't see any sign of anything out of the ordinary in these files. The only thing I did notice was actually the line you mentioned user:x:500:500::/home/user:/bin/bash The numbers are not 500, 500. What does this affect? – Brae Apr 27 '15 at 10:47
  • @GeneralBrae No, these are ID for your user and his group. It doesn't affect. – apaul Apr 27 '15 at 14:01

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.