6

I had a system crash and now my Ubuntu runs into low-graphics mode. All the fixes require running commands with sudo. When I try this I get sudo: command not found. When I try logging in with su - I get an error: Authentication failed. I also tried sudo -i but that did nothing. I am really stuck here. What can I do?

Relevant info:

$ echo $PATH 
/usr/local/sbin:/usr/local/bin:/usr/bin:/usr/sbin:/sbin:/bin
$ ls -l /usr/bin/sudo
-rwsr-xr-x 1 root root 121144 Feb 28 2013 /usr/bin/sudo

-a sudo output : -bash: -a command not found
which - a sudo output: 
/usr/bin/sudo echo foo output: Permission denied
Zanna
  • 70,465
Jacob
  • 173
  • 1
  • 1
  • 7
  • Exactly what is the command you try to run with sudo and what is the error reported exactly. – falconer Jan 05 '14 at 11:08
  • THe error is "Command not found", It doesnt matter what I run. Nothing works – Jacob Jan 05 '14 at 11:10
  • if you try sudo -i does it work ? – nux Jan 05 '14 at 11:19
  • First one: /usr/local/sbin:/usr/local/bin:/usr/bin:/usr/sbin:/sbin:/bin

    Second one: -rwsr-xr-x 1 root root 121144 Feb 28 2013 /usr/bin/sudo

    – Jacob Jan 05 '14 at 11:21
  • sudo -i does nothing – Jacob Jan 05 '14 at 11:22
  • -bash: sudo: command not found – Jacob Jan 05 '14 at 11:24
  • 1
    Okay, I have no clue. Try running sudo with the full path /usr/bin/sudo YOUR_COMMAND. – falconer Jan 05 '14 at 11:34
  • Please [edit] your question and add the output of type -a sudo and which -a sudo. Then, try running /usr/bin/sudo echo foo and tell us if it worked. – terdon Jan 05 '14 at 11:47
  • Done I have updated the question – Jacob Jan 05 '14 at 12:05
  • You need to run type -a sudo, type is a command. Also, make sure there is no space between - and a, it should be -a. It is much easier for us to read if you just copy/paste the command and the output directly from the terminal. The permission denied is interesting. Please add the output of ls -l /usr | grep bin and ls -l / | grep usr. – terdon Jan 05 '14 at 12:36

1 Answers1

4

I think the only possibility left it that one of the directories leading to sudo doesn't have the other executable bit set, so although the directory is in your path, bash can't find the binaries inside. When you try with full path, then of course you get the permission denied message. This problem with the directories is likely also the cause of your original problem with the low-graphics mode thing.

So please try

ls -ld /usr
ls -ld /usr/bin

both of these should report:

drwxr-xr-x

permissions. If not, then it is your problem and you should set those permissions for those folders, and likely for some other folders also. But you can't do it from your installation, because you don't have access to sudo. So either boot into recovery mode or use a live CD to correct the errors. (Which were likely caused by a wrong chmod command.)

falconer
  • 15,026
  • 3
  • 48
  • 68
  • The permissions output is not correct. But trying to change under shell prompt (recovery mode) gives me an error: Read only file-system. My output is drw-rw-rw- – Jacob Jan 05 '14 at 12:43
  • @Jacob Thats normal. You need to remount / read/write, look here – falconer Jan 05 '14 at 12:46
  • Following that instructions and mounting the low graphics error was gone – Jacob Jan 05 '14 at 12:49