# Command line broken (SD card corrupted)

## EDIT

You'll find the original question below the line. This edit is intended to explain better what was my real issue according to the comments.

I could login (by SSH using WiFi) on my Raspberry without trouble and suddenly my command line told me that my commands where not found. This happened after an error while reading the packages doing sudo apt-get update.

The error message afterwards (when trying to type a command) where :

-bash: [command here]: command not found
-bash: /usr/bin/sudo: No such file or directory


I could operate my Raspberry just fine before, even though this issue already appeared for me!

This is kind of linux related. I am using a couple of Raspberry's (model B) for a project, and I had this coming up a few times.

I'll explain how it happens : I made a fresh install of Raspbian (took the image from www.raspberrypi.org). and when I went through the raspi-config and reboot it, if I try to run sudo apt-get update it will start the update.

But then eventually it stops whil reading the packages (telling me there is an error). After that, whenever I try to send a command it tells me -bash: [command here]: command not found and if I try to use sudo it returns me -bash: /usr/bin/sudo: No such file or directory.

I didn't find anything telling me why it would be happening or how to prevent it. It seems like I am good to re-install my SD card when this happens.

I am accessing my Raspberry bi SSH (via WiFi). The issue appears after I configured my Raspberry for SSH and WiFi networking! Which means that I could already launch sudo apt-get update once before. And I wanted to install some new stuff on my Raspberry and check if there is anything new for Raspbian.

• Have you successfully used this Pi or SD card before? It sounds like the SD card is not being seen. If this is your first Pi the power supply is the first thing to check. – joan Apr 24 '14 at 9:49
• Yes, I am currently switching between 2 PI's, they ran just fine in the past. I am indeed using the provided power supply, I'll give a try with another one (if I got it, it might be a power issue and thus the SD card doesn't get a chance to communicate or whatever? sorry for my low knowledge level on what gets really involved here) – ySiggen Apr 24 '14 at 9:50
• The power supply is less likely to be the problem if you have had the same Pi working reliably in the past with the same power supply. Mind you if you have added new hardware to the Pi which draws power from the Pi (like a wifi dongle) that could be an issue. – joan Apr 24 '14 at 9:56
• Well yea, I am using both a Wifi and a Bluetooth dongle. But I was going through the installation of the Bluetooth dongle, so I only had the Wifi dongle plugged in. And I could set up my Pi (to use Wifi) with that power supply without trouble, including plugging in the dongle and connecting to a Wifi network. Then I shut it down, and began to SSH on it (through Wifi) and it appeared there, whil trying to update my Pi. It isn't the first time (had it like once on both my Pi's already) and I just installed Raspbian again to fix it! – ySiggen Apr 24 '14 at 10:04
• And I could plug both dongles on my Pi with the power supply I was using without trouble! Here I really only had my Wifi dongle on my Pi, and everything seemed to crash while trying to update my Pi. – ySiggen Apr 24 '14 at 10:05

It is impossible to know from the detail you supplied, but rather then being an OS problem it is more likely to be a power supply issue.

WiFi adaptors, in particular, draw quite a lot of current. Unfortunately (due IMHO to a design flaw in the Pi) the Pi is not capable of meeting the current requirements of the USB specification. This often exhibits as intermittent failures (as searching this site will demonstrate).

The solution is often to use a powered USB Hub for power hungry peripherals.

Measuring the voltage at the TP is not a conclusive test. Certainly if you measure less than 4.75V you can expect problems, but even if above this when measured it can drop when the current peaks.

• Yes, it seems that I didn't see the real issue. I tested each of my power supplies (3 USB chargers) on both my Raspberry's : they all worked, even tho one of them seems clearly to have kind of a false contact between the charger itself and the USB cable. I think this might have corrupted my SD card, if it is possible? – ySiggen Apr 24 '14 at 12:49
• Definitely possible. Try using a powered hub. – Bex Apr 25 '14 at 6:47
• It is specifically a broken USB charger in my case, but this answer is totally related (and might be the solution for other people). So I am accepting it! – ySiggen Apr 25 '14 at 7:05
• Raspberrypi troubleshooting 101: get a high-quality high-current usb charger and try again. ;) – Bex Apr 25 '14 at 7:10
• @Bex well it's sad not to be able to rely on the one provided (but then, I am for sure the one that broke it). – ySiggen Apr 25 '14 at 7:28