'sudo' command not found in console of OpenSuse 12.1

Hi:
I just started using OpenSuse 12.1 (upgraded form DVD, 11.3 to 12.1).
Everything was working fine.

Yesterdy, while working with PostGreSQL and OpenERP configuration from the console, suddenly, I found that “sudo” command is not working.
When I issue a sudo command (e.g. a command to start the PostGreSQL server: “sudo rcpostgresql start”, which was working before suddenly returns “sudo command not found”)

I restarted the machine, no luck yet.
Note, my YAST refresh/update from OpenSuse OS repository is enabled.

Any idea ?

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Become root another way and try to install it, perhaps? My 12.1 system
has it so I’m not sure why yours does not:

su -
zypper in sudo

Good luck.
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.18 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iQIcBAEBAgAGBQJPNZIeAAoJEF+XTK08PnB5gRYP/RSXtWrKqbLUrqwIxPLBT7Lf
Gh8Jwepse0dPrM52txOxx4BjprfMgFiqJgoRv3+EL3wdukFBBF2SKHp5aA45Yymc
VDLloSXMAMHp5Gt5wtjlzgLJAjzglgiGF18PVDg9Ef8DSrqE/UDvP55E8tZRNXkp
IPhdsi98Inv/n+vW8zgAkne6E5rh5daMeQgwelX7pfLoLvVg81TbQ9AwieQunyMh
uSrWI3c5RmVnQ8ZpCx2X579XlaN+vI+hSjsRN1frpLNM//ZBNMjjdKsp8uQaPg35
9CEmIljNcxMDgCjv1CPwEp3TaOlJuykqBkB9E9KWLikSZgyhchhmjRbymKennxT5
Q/EhI5j9ASnCo0sOaF+jJhg9E1/hgXr1U9yYGqI/+gE/U9hOEnxuHo5Jr3zrzbdI
AQSlehqm3TqwVsBINB6f9Je5uk++Ce+JypQYjCt1s0PSBlhsNy+hTOFcMpBAqUnA
p0vI6vppeZ1/47ooFeK7NOeVvvxti4zWhZgIUeYat9QWMnBPn3r/JLKHP5QE55Vc
SxkXBkaPZw7P57hXeiQro+54678ZEDJsQTU5Jqh2hASJxgyBydyzLVm+/vU0D0oN
84t9FaRZW+bksRSwWmSNivW7ibj1Gytg1OmlpCJr32P8QxodLM6BD9q/QYm4iHGG
RZQynVdah/0SzMswxjno
=vX1g
-----END PGP SIGNATURE-----

I would first try to locate sudo (or the problem) by asking:

whereis sudo

Regards
Martin

On 2012-02-10 22:36, jrahman wrote:

> Any idea ?

I would prefer to see a copy paste from your terminal, including the
command prompt before and after. Ie, complete. Your explanation is not enough.

Please paste using code tags. Advanced editor, ‘#’. If you don’t know what
I’m talking about, ask, do not paste.


Cheers / Saludos,

Carlos E. R.
(from 11.4 x86_64 “Celadon” at Telcontar)

Am 10.02.2012 22:36, schrieb jrahman:
> sudo rcpostgresql start
This will and cannot work, I am pretty sure sudo is installed on your
machine, but sudo does not add by black magic /sbin and /usr/sbin to
your users PATH.

If you run with sudo you need to do it the correct way


sudo /usr/sbin/rcpostgresql start

or use “su -” as already suggested by Carlos.


PC: oS 11.4 (dual boot 12.1) 64 bit | Intel Core i7-2600@3.40GHz | KDE
4.6.0 | GeForce GT 420 | 16GB Ram
Eee PC 1201n: oS 11.4 64 bit | Intel Atom 330@1.60GHz | KDE 4.8.0 |
nVidia ION | 3GB Ram

Am 10.02.2012 23:45, schrieb Martin Helm:
> or use “su -” as already suggested by Carlos.

correction: as suggested by ab

On 2012-02-10 23:45, Martin Helm wrote:
> This will and cannot work, I am pretty sure sudo is installed on your

True, but sudo is usually more verbose and adds punctuation. That’s why I
want to see the full text copypaste.


Cheers / Saludos,

Carlos E. R.
(from 11.4 x86_64 “Celadon” at Telcontar)

Martin suggested me to be in the directory /usr/sbin before issue the command,
Carlos wanted to see the text from console,
here is what I did and what I get.
(Trust me it was working, but suddenly appearing the “command not found”)


jrahman@linux-z583:/usr/sbin> pwd
/usr/sbin
jrahman@linux-z583:/usr/sbin> ls -rtl rcpostgresql
lrwxrwxrwx 1 root root 22 Feb  5 23:01 rcpostgresql -> /etc/init.d/postgresql
jrahman@linux-z583:/usr/sbin> sudo rcpostgresql start
sudo: rcpostgresql: command not found
jrahman@linux-z583:/usr/sbin> 

also here is the sudo in my system:


jrahman@linux-z583:/usr/sbin> whereis sudo
sudo: /usr/bin/sudo /usr/lib/sudo /usr/bin/X11/sudo /usr/share/man/man8/sudo.8.gz
jrahman@linux-z583:/usr/sbin> 

On Sat, 11 Feb 2012 02:26:02 +0000, jrahman wrote:

> Martin suggested me to be in the directory /usr/sbin before issue the
> command

That won’t actually work if the current directory isn’t in your path.

Try (from that directory)

sudo ./rcpostgresql start

That should work. Sudo is on your system and is working fine.

Jim


Jim Henderson
openSUSE Forums Administrator
Forum Use Terms & Conditions at http://tinyurl.com/openSUSE-T-C

On 2012-02-11 03:26, jrahman wrote:
>
> Martin suggested me to be in the directory /usr/sbin before issue the
> command,

No, he did not say that, read it again. Being in /usr/bin has no effect in
Linux for finding commands.

> Carlos wanted to see the text from console,
> here is what I did and what I get.
> (-Trust me it was working, but suddenly appearing the “command not
> found”-)
>
> Code:
> --------------------
>
> jrahman@linux-z583:/usr/sbin> pwd
> /usr/sbin
> jrahman@linux-z583:/usr/sbin> ls -rtl rcpostgresql
> lrwxrwxrwx 1 root root 22 Feb 5 23:01 rcpostgresql → /etc/init.d/postgresql
> jrahman@linux-z583:/usr/sbin> sudo rcpostgresql start
> sudo: rcpostgresql: command not found
> jrahman@linux-z583:/usr/sbin>
>
> --------------------

Thanks. This text shows what I thought and Martin said. It is not that sudo
is not found, but it is sudo who says that the command “rcpostgresql” is
not found. That’s the meaning of the colon. So, you have to type the full
path to “rcpostgresql”, because that’s a superuser command and you are just
a plain user. No, sudo doesn’t look into the list of root’s commands.


Cheers / Saludos,

Carlos E. R.
(from 11.4 x86_64 “Celadon” at Telcontar)

Am 11.02.2012 04:55, schrieb Jim Henderson:
> On Sat, 11 Feb 2012 02:26:02 +0000, jrahman wrote:
>
>> Martin suggested me to be in the directory /usr/sbin before issue the
>> command
>
That is absolutely exactly NOT what I suggested, I suggested


sudo /usr/sbin/rcpostgresql start

> That won’t actually work if the current directory isn’t in your path.
>
of course not

> Try (from that directory)
>
> sudo ./rcpostgresql start
>
> That should work. Sudo is on your system and is working fine.
>
> Jim
>
>
>


PC: oS 11.4 (dual boot 12.1) 64 bit | Intel Core i7-2600@3.40GHz | KDE
4.6.0 | GeForce GT 420 | 16GB Ram
Eee PC 1201n: oS 11.4 64 bit | Intel Atom 330@1.60GHz | KDE 4.8.0 |
nVidia ION | 3GB Ram

jrahman, if you want to pass a single command, use su with the ‘c’ switch,

su -c *command*

For example,

su -c rcpostgresql

or

su -c 'fdisk -l'

If you want to execute several commands, use ‘su -’:

su -
*commands*
exit

sudo is supported, but su is the standard in openSUSE. You will need to get used to it.

The problem was solved.
It was me the “culprit,” who did syntax error while issuing “sudo” command in first place.
Corrected after suggetion from Martin and Carlos, it is now working fine.

My apology.

Jamil.

On 2012-02-13 16:06, jrahman wrote:
> My apology.

No need. Most of us have made similar mistakes - or worse :slight_smile:


Cheers / Saludos,

Carlos E. R.
(from 11.4 x86_64 “Celadon” at Telcontar)