The macosxhints Forums

The macosxhints Forums (http://hintsforums.macworld.com/index.php)
-   UNIX - Newcomers (http://hintsforums.macworld.com/forumdisplay.php?f=15)
-   -   Help! sudo is not found? (http://hintsforums.macworld.com/showthread.php?t=83069)

ThreeDee 12-17-2007 04:33 PM

Help! sudo is not found?
 
I opened up Terminal yesterday to compile the LAME MP3 encoder, and did a "sudo make install" to move it into /usr/local or whatever. LAME worked fine, and using iTunes+Lame, I imported a CD into iTunes.

Today, I typed "sudo ls" just for the heck of it (Don't ask why, I don't know) and this appeared:
http://i15.tinypic.com/6tdcrjr.png

It appears sudo is missing? Is that even possible?

cwtnospam 12-17-2007 04:40 PM

sudo isn't missing. The error is saying that you can't use sudo for the ls command for that user.

tlarkin 12-17-2007 04:42 PM

type

whereis sudo

example:

Code:

Last login: Mon Dec 17 15:22:36 on ttyp1
Welcome to Darwin!
tlarkin:~ admin$ whereis sudo
/usr/bin/sudo
tlarkin:~ admin$


fracai 12-17-2007 05:45 PM

Quote:

Originally Posted by cwtnospam (Post 434817)
sudo isn't missing. The error is saying that you can't use sudo for the ls command for that user.

Nope. The "bash:" means that bash can't find sudo. If sudo couldn't run ls you would see "sudo: ls: command not found".

trevor 12-17-2007 06:05 PM

ThreeDee, sudo is usually found in /usr/bin (I'm in Tiger right now, but I doubt that this changed in Leopard.) Please show us the results of
ls -l /usr/bin/sudo

Probably the reason that your shell can't find sudo is that /usr/bin is not currently in your PATH. Please show us the results of
echo $PATH

Trevor

ThreeDee 12-17-2007 06:20 PM

I'm also running Tiger. Anyway, here's the output:
Code:

Last login: Mon Dec 17 18:19:33 on ttyp1
Welcome to Darwin!
G4-Computer:~ chris$ ls -l /usr/bin/sudo
ls: /usr/bin/sudo: No such file or directory
G4-Computer:~ chris$ echo $PATH
/opt/local/bin:/opt/local/sbin:/bin:/sbin:/usr/bin:/usr/sbin
G4-Computer:~ chris$


Mikey-San 12-17-2007 06:32 PM

Code:

$ which sudo
and

Code:

$ ls -la /usr/bin
Any results on either? (/usr/bin should have lots in it. Hopefully.)

trevor 12-17-2007 06:51 PM

The which command is not going to find sudo, as it was already established in the original post that sudo was not found by the shell, and which does not look outside the PATH.

Quote:

Originally Posted by man which
Code:

NAME
      which - locate a command

SYNOPSIS
      which [ filename ] ...

DESCRIPTION
      which returns the pathnames of the files which would be executed in the
      current environment, had its arguments been  given  as  commands  in  a
      strictly  POSIX-conformant  shell.  It does this by searching the PATH
      for executable files matching the names of the arguments.


Perhaps a better chance of finding the command would be
locate /sudo

Quote:

Code:

G4-Computer:~ chris$ ls -l /usr/bin/sudo
ls: /usr/bin/sudo: No such file or directory


OK, well sudo is definitely not where it's supposed to be. Mikey-San's suggestion of showing us the results of
ls -la /usr/bin
is a good one, as it may show us the scope of the problem.

Trevor

hayne 12-17-2007 06:58 PM

Another interesting command to run would be:

history | grep -i sudo

Mikey-San 12-17-2007 07:01 PM

I thought I recalled which also being able to tell you if the command had been aliased. Guess not. Oh well.

ThreeDee 12-17-2007 07:05 PM

1 Attachment(s)
"locate /sudo" returns something fishy:
Code:

Last login: Mon Dec 17 18:59:30 on ttyp1
Welcome to Darwin!
G4-Computer:~ chris$ locate /sudo
locate: locate database header corrupt, bigram char outside 0, 32-127: -1
G4-Computer:~ chris$

I attached the results of "ls -la /usr/bin", as it was too big to copy/paste. It doesn't list 'sudo'. Doesn't sound good...

ThreeDee 12-17-2007 07:22 PM

And the results of hayne's command:

Code:

Last login: Mon Dec 17 19:01:24 on ttyp1
Welcome to Darwin!
G4-Computer:~ chris$ history | grep -i sudo
    1  sudo port selfupdate
    3  sudo port portpkg.portpkg
    4  sudo port install ufraw
    6  sudo port clean ufraw
    7  sudo port install
  11  sudo port install portpkg.portpkg
  12  sudo port install portpkg
  13  sudo port install
  26  sudo ./Install\ Flash\ Player\ 9\ UB.app/
  27  sudo ./Install\ Flash\ Player\ 9\ UB.app/Contents/MacOS/Install\ Flash\ Player\ 9\ UB
  29  sudo ./JavaApplicationStub
  98  ./configure; make; sudo make install
  221  cd /usr/local/shoutcast/; sudo ./sc_serv
  222  cd /usr/local/shoutcast/; sudo ./sc_serv
  223  cd /usr/local/shoutcast/; sudo ./sc_serv
  224  cd /usr/local/shoutcast/; sudo ./sc_serv
  225  cd /usr/local/shoutcast/; sudo ./sc_serv
  226  cd /usr/local/shoutcast/; sudo ./sc_serv
  229  sudo ./configure
  326  sudo port install smartmontools
  400  sudo rm -r /System/Library/StartupItems/QuickTimeStreamingServer
  408  sudo rm -f /usr/sbin/QuickTimeStreamingServer
  413  sudo rm -f /usr/bin/broadcasterctl
  415  sudo rm -f /usr/bin/PlaylistBroadcaster
  420  sudo make install
  431  sudo ls
  432  sudo ls
  433  sudo
  438  sudo ls
  439  sudo ls
  440  whereis sudo
  441  ls -l /usr/bin/sudo
  443  locate /sudo
  446  locate -d /sudo
  447  locate /sudo
  448  locate /sudo
  450  whtch sudo
  452  which sudo
  454  history | grep sudo
  457  locate /sudo
  458  history | grep -i sudo
G4-Computer:~ chris$

Some of that stuff is pretty old. I also run a shoutcast streaming music server sometimes, which is from lines 221 to 226. I tried installing Darwin Streaming Server, but it was too confusing, so I tried removing it. I think I might have left some some parts behind, but that doesn't bother me much. Line 420 is probably me installing LAME after compiling it.

Near the end I'm guessing is all of the commands I'm entering to try and find what happened to sudo. You can see the typo I made on line 450. :)

Mikey-San 12-17-2007 07:35 PM

I was mostly hoping not to see that directory totally empty. Then again, seeing it empty would've been easier to explain . . .

Anything interesting in system.log?

To clarify, was this the last successful use of sudo you invoked? (It's the last one before the ls command, and you mention that in your first post.)

Code:

  420  sudo make install

trevor 12-17-2007 07:41 PM

Too bad you're not on Leopard--Time Machine would have been useful to bring sudo back.

There's no indication that any of the other things in your /usr/bin directory are actually sudo but renamed. None of the other files duplicates sudo's unusual permissions (-r-s--x--x), nor do any of the other files have the exact same size as sudo.

As locate is not working for you, try using find. My elementary skills with the find command result in
sudo find / -name "sudo" -print
but someone else may be able to give you a better 'find'.

I suspect that using Pacifist to reinstall your "BSD Subsystem" (or whatever it's called in Apple's Installer) may be your quickest method to getting sudo back.

And I'm very curious why your installation of LAME would remove sudo, if that's what is currently thought.

Trevor

Mikey-San 12-17-2007 08:26 PM

Quote:

Originally Posted by trevor
sudo find / -name "sudo" -print

Somehow I don't think this command is going to work . . . ;)

tlarkin 12-17-2007 08:35 PM

what have you installed that would put /opt in your $PATH?

I thought really only distros based on redhat really used the /opt directory and it is definitely not a standard install of tiger. Standard install of 10.4 there is no /opt directory. Perhaps something like Fink may install that in your path for Linux executables installed?

Mikey-San 12-17-2007 09:14 PM

I normally try not to speculate, but something here smells like an installer script gone awry. :(

ThreeDee 12-17-2007 09:38 PM

This is really odd. Anyway, my system log (just noticed it's almost over 200MB in size???) is filled up with thousands of lines of this, which I doubt has anything to do with sudo:
Code:

Dec 17 21:30:51 G4-Computer kernel[0]: USBF:        10113.734        AppleUSBOHCI[0x2d17000]::Found a transaction which hasn't moved in 5 seconds on bus 25, timing out!
Dec 17 21:31:00 G4-Computer kernel[0]: USBF:        10122.735        AppleUSBOHCI[0x2d17000]::Found a transaction which hasn't moved in 5 seconds on bus 25, timing out!
Dec 17 21:31:06 G4-Computer kernel[0]: USBF:        10128.735        AppleUSBOHCI[0x2d17000]::Found a transaction which hasn't moved in 5 seconds on bus 25, timing out!
Dec 17 21:31:15 G4-Computer kernel[0]: USBF:        10137.735        AppleUSBOHCI[0x2d17000]::Found a transaction which hasn't moved in 5 seconds on bus 25, timing out!
Dec 17 21:31:21 G4-Computer kernel[0]: USBF:        10143.735        AppleUSBOHCI[0x2d17000]::Found a transaction which hasn't moved in 5 seconds on bus 25, timing out!
Dec 17 21:31:30 G4-Computer kernel[0]: USBF:        10152.736        AppleUSBOHCI[0x2d17000]::Found a transaction which hasn't moved in 5 seconds on bus 25, timing out!
Dec 17 21:31:36 G4-Computer kernel[0]: USBF:        10158.736        AppleUSBOHCI[0x2d17000]::Found a transaction which hasn't moved in 5 seconds on bus 25, timing out!
Dec 17 21:31:45 G4-Computer kernel[0]: USBF:        10167.736        AppleUSBOHCI[0x2d17000]::Found a transaction which hasn't moved in 5 seconds on bus 25, timing out!
Dec 17 21:31:51 G4-Computer kernel[0]: USBF:        10173.736        AppleUSBOHCI[0x2d17000]::Found a transaction which hasn't moved in 5 seconds on bus 25, timing out!
Dec 17 21:32:00 G4-Computer kernel[0]: USBF:        10182.736        AppleUSBOHCI[0x2d17000]::Found a transaction which hasn't moved in 5 seconds on bus 25, timing out!
Dec 17 21:32:06 G4-Computer kernel[0]: USBF:        10188.736        AppleUSBOHCI[0x2d17000]::Found a transaction which hasn't moved in 5 seconds on bus 25, timing out!
Dec 17 21:32:15 G4-Computer kernel[0]: USBF:        10197.736        AppleUSBOHCI[0x2d17000]::Found a transaction which hasn't moved in 5 seconds on bus 25, timing out!
Dec 17 21:32:21 G4-Computer kernel[0]: USBF:        10203.737        AppleUSBOHCI[0x2d17000]::Found a transaction which hasn't moved in 5 seconds on bus 25, timing out!
Dec 17 21:32:30 G4-Computer kernel[0]: USBF:        10212.737        AppleUSBOHCI[0x2d17000]::Found a transaction which hasn't moved in 5 seconds on bus 25, timing out!
Dec 17 21:32:36 G4-Computer kernel[0]: USBF:        10218.737        AppleUSBOHCI[0x2d17000]::Found a transaction which hasn't moved in 5 seconds on bus 25, timing out!
Dec 17 21:32:46 G4-Computer kernel[0]: USBF:        10228.737        AppleUSBOHCI[0x2d17000]::Found a transaction which hasn't moved in 5 seconds on bus 25, timing out!
Dec 17 21:32:52 G4-Computer kernel[0]: USBF:        10234.737        AppleUSBOHCI[0x2d17000]::Found a transaction which hasn't moved in 5 seconds on bus 25, timing out!
Dec 17 21:33:00 G4-Computer kernel[0]: USBF:        10242.737        AppleUSBOHCI[0x2d17000]::Found a transaction which hasn't moved in 5 seconds on bus 25, timing out!
Dec 17 21:33:06 G4-Computer kernel[0]: USBF:        10248.737        AppleUSBOHCI[0x2d17000]::Found a transaction which hasn't moved in 5 seconds on bus 25, timing out!
Dec 17 21:33:15 G4-Computer kernel[0]: USBF:        10257.737        AppleUSBOHCI[0x2d17000]::Found a transaction which hasn't moved in 5 seconds on bus 25, timing out!
Dec 17 21:33:21 G4-Computer kernel[0]: USBF:        10263.738        AppleUSBOHCI[0x2d17000]::Found a transaction which hasn't moved in 5 seconds on bus 25, timing out!
Dec 17 21:33:30 G4-Computer kernel[0]: USBF:        10272.738        AppleUSBOHCI[0x2d17000]::Found a transaction which hasn't moved in 5 seconds on bus 25, timing out!
Dec 17 21:33:36 G4-Computer kernel[0]: USBF:        10278.738        AppleUSBOHCI[0x2d17000]::Found a transaction which hasn't moved in 5 seconds on bus 25, timing out!
Dec 17 21:33:45 G4-Computer kernel[0]: USBF:        10287.738        AppleUSBOHCI[0x2d17000]::Found a transaction which hasn't moved in 5 seconds on bus 25, timing out!

I don't have any idea why LAME would remove sudo for... Maybe it was a rare glitch of some kind?
I do have DarwinPorts and Fink installed, so I guess one of them could have added the /opt?

And trevor, you command won't work. I'm stuck in a catch-22. I'm going to need to use sudo in order to gain root access to 'find' sudo. Unless you want me to log in as root or something... I'll try reinstalling with Pacifist.

Mikey-San 12-17-2007 10:42 PM

Where did you get the LAME sources? What was your compile procedure?

trevor 12-18-2007 12:05 AM

Quote:

Originally Posted by Mikey-San (Post 434903)
Somehow I don't think this command is going to work . . . ;)

D'oh! You're right, of course, I can't use sudo because that's what's missing. If your root user is enabled, you can use su.

Trevor

hayne 12-18-2007 09:46 AM

Quote:

Originally Posted by ThreeDee (Post 434919)
I'll try reinstalling with Pacifist

When something unexplained like this has happened, I'd recommend instead doing an "archive & install" from the Install DVD. Be sure to choose the option to preserve users and it won't be much hassle.

ThreeDee 12-18-2007 10:08 AM

I got the lame source directly from http://lame.sourceforge.net/

I compiled by doing "./configure" to run the config script, then "make" to compile, then "sudo make install" to install it.

hayne, you are probably right about doing an Archive & Install. I'll do that instead when I get the chance. I'm a bit busy right now.

ThreeDee 12-18-2007 06:41 PM

Update: Did an Archive & Install, and sudo works fine now.

Before doing an A&A, I only had ~3GB free (bad for the system, I know). After reinstalling and upgrading to 10.4.11 again, I now have ~10GB free? I know all my user files are intact. Was there some 7GB of crap hiding out in the various hidden system folders?


All times are GMT -5. The time now is 10:13 PM.

Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2014, vBulletin Solutions, Inc.
Site design © IDG Consumer & SMB; individuals retain copyright of their postings
but consent to the possible use of their material in other areas of IDG Consumer & SMB.