grahamed
Posts: 277
Joined: Mon Jan 30, 2012 7:01 pm

bash - missing commands

Wed Jan 02, 2013 6:25 pm

Hi

A few hours back I pulled the ethernet lead. I had a root terminal opened via GUI and a terminal session from a remote pc.

I now find that most of the bash commands are missing - all except the built-in I guess. I hoped they were missing from just the opened terminals, so I closed them (actually the remote had already died). Couldn't open another terminal remotely nor from the GUI. so I tried to logout of the GUI. Now the screen is empty apart from the Raspberry icon.

Something similar happened a couple of weeks ago and the SD card was corrupt when i tried to restart after pulling the power plug.

I hate just pulling the plug but is there anything else I can do? Is this behaviour expected?

Thanks

G

User avatar
joan
Posts: 14960
Joined: Thu Jul 05, 2012 5:09 pm
Location: UK

Re: bash - missing commands

Wed Jan 02, 2013 6:29 pm

To shut down safely use

sudo shutdown -h now

After half a minute or so all the LEDs will go off apart from the red power LED.

It's then safe to pull the plug.

grahamed
Posts: 277
Joined: Mon Jan 30, 2012 7:01 pm

Re: bash - missing commands

Wed Jan 02, 2013 7:21 pm

Yes, except that bash tells me "sudo" is not found

Matt90o
Posts: 1
Joined: Mon Jan 07, 2013 10:46 pm

Re: bash - missing commands

Mon Jan 07, 2013 10:52 pm

Hello grahamed,

I am having the same problem as you are having. I booted up my fresh raspbian-wheezy image, installed tightVNC on it and logged in from a remote computer. After logging in everything seems fine, but somehow my SD card got corrupted after trying to open midori and I can not perform even the simples commands, like reboot, halt, shutdown etc in a terminal (I get a syntax error, ")" expected).

This has probably got to do something with a corruption in the SD card, as the filesystem becomes read-only. I have not found a solution yet, but formatting the SD card and putting on a fresh image works for now.

What kind of SD are you using? Mine doesn't have a brand on it, it just says C08G TAIWAN, it is an 8GB class 4 microsd HC and I am using a samsung adapter.

User avatar
rurwin
Forum Moderator
Forum Moderator
Posts: 4258
Joined: Mon Jan 09, 2012 3:16 pm
Contact: Website

Re: bash - missing commands

Mon Jan 07, 2013 11:22 pm

There is a way to shutdown without using any commands:

Hold down CTRL, Left-ALT and SysReq
(SysReq is not labeled on all keyboards, it's the Print Screen/PrtSc key above the Insert key.)

Then while pressing those down, slowly, to give each time to work, hit the the following keys

r s e i s u b

What those do is as follows:
R -- Switches the keyboard out of "raw mode".
S -- Syncs the disks
E -- Sends all processes the TERM signal
I -- Sends all processes the KILL signal -- in case any ignored TERM, KILL cannot be ignored
S -- Syncs the disks again, to be sure to be sure
U -- Unmount all filesystems
B -- Reboot

To remember that, "Raising Skinny Elephants Is Sometimes Utterly Boring". It will get you out of almost any situation since it only requires a keyboard driver and the Linux kernel to work.

Substitute an "O" for the "B" to switch off instead of rebooting.

Return to “Troubleshooting”