Page 1 of 2 12 LastLast
Results 1 to 10 of 18

Thread: sudo is broken

  1. #1
    Join Date
    Feb 2007
    Location
    MI, US
    Beans
    46
    Distro
    Ubuntu Development Release

    sudo is broken

    Hello,

    In Ubuntu 9.10, sudo was working properly except it would not let me run speedy as sudo. I would get an error message, which I believe stated "No such file or directory. However, I could run the command as my regular user (being prompted it needed escalated privileges), and I could run the user as root. So I tried to "fix" it so that I could run it via the sudo command. My fix, in turn, ended up breaking sudo. I edited a file which contained the directories for PATH (I made a backup of said file), and that didn't work. It further broke sudo. So I attempted to restore the backup file, however, sudo was still just as broken.
    Now, whenever I try to execute any command with sudo I get:
    tim@linux-hp:~$ sudo -i
    [sudo] password for tim:
    env: -i: No such file or directory
    tim@linux-hp:~$ sudo gedit
    env: gedit: No such file or directory
    tim@linux-hp:~$ sudo apt-get update
    env: apt-get: No such file or directory
    tim@linux-hp:~$ sudo nautilus
    env: nautilus: No such file or directory
    tim@linux-hp:~$ sudo update-manager
    env: update-manager: No such file or directory
    tim@linux-hp:~$ sudo speedy deploy
    env: speedy: No such file or directory

    I have since upgraded to Ubuntu 10.04 Alpha 3, with mild hopes that the upgrade would remedy my problem, but alas - it did not. Does anyone have any suggestions on how to get sudo back to a working condition?

    Thanks
    Bart: Hey, why is it destroying other toys? Lisa: They must have programmed it to eliminate the competition. Bart: You mean like Microsoft? Lisa: Exactly.

  2. #2
    Join Date
    Apr 2009
    Location
    CA, USA
    Beans
    156
    Distro
    Ubuntu 10.10 Maverick Meerkat

    Re: sudo is broken

    Just to make sure we understand the full problem, can you run one of the programs like gedit without sudo and it does not give this error? From what you are showing it sounds like sudo is working and prompts for the password. Its just the path is now messed up. Let us know if you can still open gedit without sudo from terminal.

  3. #3
    Join Date
    Feb 2007
    Location
    MI, US
    Beans
    46
    Distro
    Ubuntu Development Release

    Re: sudo is broken

    Yes - I can run each of the aforementioned programs without sudo. Each acts exactly as it should taking into account the normal user privileges. The only time I get those errors is when pre-empting the program name with the sudo command.
    Bart: Hey, why is it destroying other toys? Lisa: They must have programmed it to eliminate the competition. Bart: You mean like Microsoft? Lisa: Exactly.

  4. #4
    Join Date
    Apr 2009
    Location
    CA, USA
    Beans
    156
    Distro
    Ubuntu 10.10 Maverick Meerkat

    Re: sudo is broken

    So do you recall which file you had edited that created this issue? Was it .bashrc or another system file?


    Now that I think about it you probably edited another file like /etc/environment. This file would effect all user accounts such as sudo but then .bashrc would be for individual users and would allow you to run commands listed in its path file. Basically whatever file you changed is still messed up and you will need to correct this. Let me know if you have any idea on which file and we should be able to help get it corrected..
    Last edited by cgb; March 15th, 2010 at 11:59 PM.

  5. #5
    Join Date
    Mar 2008
    Beans
    1,219

    Re: sudo is broken

    Try this command:
    Code:
    /usr/bin/sudo /usr/bin/apt-get -s update
    If you won't get an error, it's definitely a problem with /etc/environment. The contents of this file should look like this:
    Code:
    PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games"
    Last edited by prodigy_; March 16th, 2010 at 12:21 AM.

  6. #6
    Join Date
    Feb 2007
    Location
    MI, US
    Beans
    46
    Distro
    Ubuntu Development Release

    Re: sudo is broken

    The file that I edited was /etc/environment

    Quote Originally Posted by prodigy_ View Post
    Try this command:
    Code:
    /usr/bin/sudo /usr/bin/apt-get -s update
    This command did work without producing an error.

    Quote Originally Posted by prodigy_ View Post
    If you won't get an error, it's definitely a problem with /etc/environment. The contents of this file should look like this:
    Code:
    PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games"
    The above code matches the contents of my /etc/environment exactly.
    Bart: Hey, why is it destroying other toys? Lisa: They must have programmed it to eliminate the competition. Bart: You mean like Microsoft? Lisa: Exactly.

  7. #7
    Join Date
    Apr 2009
    Location
    CA, USA
    Beans
    156
    Distro
    Ubuntu 10.10 Maverick Meerkat

    Re: sudo is broken

    That is strange if that is exactly what is in your environment file. You may even want to copy and paste the contents prodigy_ provided to ensure that something isn't in your environment file that shouldn't be there. Other then that hopefully someone else has some ideas since I'm not sure what else it could be.

  8. #8
    Join Date
    Jun 2006
    Beans
    2,930

    Re: sudo is broken

    post the output of
    Code:
    ls -l /etc/environment
    you should get
    Code:
    -rw-r--r-- 1 root root  ...
    Support 7z in default installs!!!: Click Here

    How to use code blocks to post command output: Click Here
    Official Ubuntu Documentation

  9. #9
    Join Date
    Feb 2007
    Location
    MI, US
    Beans
    46
    Distro
    Ubuntu Development Release

    Re: sudo is broken

    Quote Originally Posted by lavinog View Post
    post the output of
    Code:
    ls -l /etc/environment
    you should get
    Code:
    -rw-r--r-- 1 root root  ...
    that is correct.
    tim@linux-hp:/usr/bin$ ls -l /etc/environment
    -rw-r--r-- 1 root root 79 2010-03-17 13:11 /etc/environment
    also, this is an odd error i received today. I'm not sure if it's related, but I feel like it is..
    ...
    Fetched 4,204kB in 13s (300kB/s)
    E: Sub-process gzip returned an error code (100)
    E: Prior errors apply to /var/cache/apt/archives/plymouth-x11_0.8.0~-17_i386.deb
    E: Prior errors apply to /var/cache/apt/archives/upstart_0.6.5-5_i386.deb
    E: Prior errors apply to /var/cache/apt/archives/plymouth_0.8.0~-17_i386.deb
    E: Prior errors apply to /var/cache/apt/archives/libplymouth2_0.8.0~-17_i386.deb
    E: Prior errors apply to /var/cache/apt/archives/mplayer_2%3a1.0~rc3+svn20090426-1ubuntu15_i386.deb
    E: Prior errors apply to /var/cache/apt/archives/mplayer-nogui_2%3a1.0~rc3+svn20090426-1ubuntu15_all.deb
    debconf: apt-extracttemplates failed:
    dpkg: warning: 'sh' not found on PATH.
    dpkg: warning: 'rm' not found on PATH.
    dpkg: warning: 'tar' not found on PATH.
    dpkg: warning: 'find' not found on PATH.
    dpkg: warning: 'dpkg-deb' not found on PATH.
    dpkg: warning: 'ldconfig' not found on PATH.
    dpkg: warning: 'start-stop-daemon' not found on PATH.
    dpkg: warning: 'update-rc.d' not found on PATH.
    dpkg: 8 expected program(s) not found on PATH.
    NB: root's PATH should usually contain /usr/local/sbin, /usr/sbin and /sbin.
    sh: touch: not found
    E: Sub-process /usr/bin/dpkg returned an error code (2)
    Bart: Hey, why is it destroying other toys? Lisa: They must have programmed it to eliminate the competition. Bart: You mean like Microsoft? Lisa: Exactly.

  10. #10
    Join Date
    Dec 2009
    Location
    germany
    Beans
    1,020
    Distro
    Ubuntu 12.04 Precise Pangolin

    Re: sudo is broken

    hi
    you are shure that you only touched the /etc/environment - then try following ( i am running karmic koala 9.10 )
    wc /etc/environment --> should be: 1 1 79 /etc/environment
    why - may be you have a space line in there or some unprintable characters.
    to verfy if there are unprintable characters inside you can use "vi" ( set list ) but only if you know vi !
    ciao
    "What is the robbing of a bank compared to the FOUNDING of a bank?" Berthold Brecht

Page 1 of 2 12 LastLast

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •