gksudo and sudo not working

Asked by Jonas Lagerwall on 2012-05-25

I did a fresh install of 12.04 and for some reason sudo and gksudo aren't working. I don't know if I messed something up.

If I try
  sudo gedit foo.txt
I get
   sudo: command not found

If I try
   gedit foo.txt
it works just fine, but then I don't have the right permissions.

Same thing with gksudo. It doesn't matter which program I call, gedit is just an example.

Please help!

Question information

English Edit question
Ubuntu sudo Edit question
No assignee Edit question
Solved by:
Jonas Lagerwall
Last query:
Last reply:

can you give the output of:

lsb_release -a; uname -a; echo $PATH


Jonas Lagerwall (1-jonaz-k) said : #2

No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 12.04 LTS
Release: 12.04
Codename: precise
Linux tofs-HP-Pavilion-dv5-Notebook-PC 3.2.0-24-generic-pae #39-Ubuntu SMP Mon May 21 18:54:21 UTC 2012 i686 i686 i386 GNU/Linux

and the output of:

apt-cache policy sudo



ls -la /usr/bin/sudo


Jonas Lagerwall (1-jonaz-k) said : #5

First, more info. I have tested some more.

I tried
   gedit /opt/lampp/etc/httpd.conf
which worked, but the wrong permissions

I tried
   gksudo gedit /opt/lampp/etc/httpd.conf
which didn't work

Then I tried
   gksudo gedit /etc/hosts
which DID work!

So I'm guessing it may not be sudo, but something else. But I have no idea what.

Have you been messing with permissions at all?

Jonas Lagerwall (1-jonaz-k) said : #7

Now I have, and the following works:
    sudo gedit /opt/lampp/etc/httpd.conf

but this doesn't:
   gksudo gedit /opt/lampp/etc/httpd.conf

I get:
   gksudo: command not found

apt-cache policy sudo:
  Installerad: 1.8.3p1-1ubuntu3.2
  Kandidat: 1.8.3p1-1ubuntu3.2
 *** 1.8.3p1-1ubuntu3.2 0
        500 http://se.archive.ubuntu.com/ubuntu/ precise-updates/main i386 Packages
        500 http://security.ubuntu.com/ubuntu/ precise-security/main i386 Packages
        100 /var/lib/dpkg/status
     1.8.3p1-1ubuntu3 0
        500 http://se.archive.ubuntu.com/ubuntu/ precise/main i386 Packages

ls -la /usr/bin/sudo:
-rwsr-xr-x 2 root root 69704 maj 16 07:24 /usr/bin/sudo

And the output of:



Jonas Lagerwall (1-jonaz-k) said : #9

jonas adm cdrom sudo dip plugdev lpadmin sambashare

You need to be in the admin group to use sudo etc. Boot to root recovery mode and run:

usermod -a -G admin jonas

Then reboot by running:


Should be ok

Jonas Lagerwall (1-jonaz-k) said : #11

how do i boot to root recovery mode?

Hold shift at boot, select recovery mode and select root

Jonas Lagerwall (1-jonaz-k) said : #13

It says there is no such group. :(

But why does
   gksudo gedit /etc/hosts
work, but not
   gksudo gedit /opt/lampp/etc/httpd.conf

I can see why it's possible for the one to work and not the other, but shouldn't I get a better error message than "command not found"?

What is the output of:

ls -la /opt/lampp/etc/httpd.conf; ls -la /etc/hosts


Jonas Lagerwall (1-jonaz-k) said : #15


for other reasons I deleted the whole /opt/lampp directory and now gksudo works just fine. I can no longer reproduce the error. :-/

Thank you for your help and your patience.