none of the commands work in linux terminal

Posted on

Problem :

All of a sudden I can’t execute any command in my debian terminal:

pi@rpi ~ $ ls
-bash: ls: command not found

or

pi@rpi ~ $ sudo omxplayer -r -o hdmi mymovie.mkv
-bash: /usr/bin/sudo: No such file or directory

or

pi@rpi ~ $ nano text.txt
-bash: nano: command not found

Nothing works. A minute before everything was fine, I was watching a movie, didn’t run anything else. I can’t even reboot it properly as reboot fails as well. Hard reset is coming… Any idea?

UPDATE: I tried to disconnect the ssh session but couldn’t connect again. Had to turn it off and back again. It’s OK now but this is not the first time this happened. I would really appreciate some tips.

Solution :

This could be caused by clearing your PATH variable or a drive failure.
One could try /bin/ls instead of just ls, if that works do export PATH="/bin:/sbin:/usr/bin:/usr/sbin", that should help.

As stated in comments you’re using Raspberry PI, so probably your SD card just got disconnected, unfortunately reconnecting it won’t help.

A permanent solution to such problems would be keeping all stuff necessary to (automatically) mount a SD card in a RAM disk, but personally I don’t think it’s worth it, cause you can always do a hard reset.

EDIT

In production devices based on Raspberry PI B+ (the one with micro SD cards) we just glued card in slot, that’s also a solution.

Leave a Reply

Your email address will not be published. Required fields are marked *