Operating System - HP-UX
1834112 Members
2301 Online
110063 Solutions
New Discussion

command not found --Help me please!

 
SOLVED
Go to solution
milaren
Super Advisor

command not found --Help me please!

Today,I find that some commands can't be executed with Error:not found.
Example:
#ioscan -fnkCdisk
/sbin/sh : ioscan not found.
#dmesg
/sbin/sh : dmesg not found
#shutdown
...........................
18 REPLIES 18
Pete Randall
Outstanding Contributor
Solution

Re: command not found --Help me please!

It sounds like /usr/sbin has been dropped from your path. You can add it back in by doing this:

export PATH=/usr/sbin:$PATH

or you could just log out and log back in again - going through your login profile sequence should reset the path.


Pete

Pete
Jeff Schussele
Honored Contributor

Re: command not found --Help me please!

Hi milaren,

Check your PATH - echo $PATH
Appears you're not pathed through /usr/sbin where all these commands reside.
Add it with - export PATH=/usr/sbin:$PATH

Rgds,
Jeff
PERSEVERANCE -- Remember, whatever does not kill you only makes you stronger!
Patrick Wallek
Honored Contributor

Re: command not found --Help me please!

What is your PATH environment variable? ioscan, dmesg and shutdown are all in the /usr/sbin directory. I suspect your PATH has been modified so that /usr/sbin is no longer there.

Try the following:

# echo $PATH

See what is there.

# export PATH=/usr/sbin:$PATH

To add /usr/sbin back.
Sunil Sharma_1
Honored Contributor

Re: command not found --Help me please!

Check your PATH variable.

do this and try

#PATH=$PATH:/usr/sbin:/usr/bin;export PATH


Sunil
*** Dream as if you'll live forever. Live as if you'll die today ***
Marco Santerre
Honored Contributor

Re: command not found --Help me please!

Looks like something is missing in your path. Can you include an echo $PATH display. Or even better yet, add /usr/sbin (cause that's where these are located) to your PATH.
Cooperation is doing with a smile what you have to do anyhow.
melvyn burnard
Honored Contributor

Re: command not found --Help me please!

silly question, but do these commands actually exist? I.E. are they there or have they been deleted somehow?
My house is the bank's, my money the wife's, But my opinions belong to me, not HP!
doug mielke
Respected Contributor

Re: command not found --Help me please!

If a path issue, I'd be concerned as to how PATH was altered. I'd not log out until I knew. (is entire .profile missing, for instance)

A quick su - myusername would read it again, then echo $PATH to see if it's different.
Sean OB_1
Honored Contributor

Re: command not found --Help me please!

First check your path:

echo $PATH

If /usr/sbin is missing then add it:

export PATH=/usr/sbin:$PATH

if /usr/sbin is in your path then go look to see if those programs exist.

ls /usr/sbin | more

If they don't you can search the system for them:

find / -name "ioscan"
find / -name "dmesg"

milaren
Super Advisor

Re: command not found --Help me please!

# pwd
/usr/sbin
# ll |grep dmesg
lrwxr-xr-x 1 root root 11 Nov 22 2002 dmesg -> /sbin/dmesg
Michael Tully
Honored Contributor

Re: command not found --Help me please!

Please report exactly what these commands do.

# echo $PATH

# ls -l /sbin/dmesg

# ls -l /sbin/ioscan
Anyone for a Mutiny ?
milaren
Super Advisor

Re: command not found --Help me please!

#echo $PATH
/usr/bin:/usr/ccs/bin:/usr/contrib/bin:/opt/nettladm/bin:/opt/fc/bin:/opt/fcms/b
in:/opt/upgrade/bin:/opt/pd/bin:/usr/bin/X11:/usr/contrib/bin/X11:/opt/hparray/b
in:/opt/networker/bin:/opt/OV/bin/OpC:/opt/OV/bin:/usr/sbin:/usr/sbin/:/opt/java
1.3/bin
# ls -l /sbin/dmesg
/sbin/dmesg not found
# ls -l /sbin
total 1360
-r-xr-xr-x 1 bin bin 282624 Feb 6 1998 init
dr-xr-xr-x 2 root sys 96 Jan 12 13:02 init.d
-r-xr-xr-x 1 bin bin 413696 Apr 27 1999 sh

Chris Watkins_1
Respected Contributor

Re: command not found --Help me please!

Looks like you're missing commands from /sbin, period.
Somebody didn't fumble an "rm -rf *" command, did they?
(Happens not often, but more often than some would admit)

Just a thought. I'd look to recent backups and restore.
Worst case, grab what you see missing, from another machine.
Still... you may have other things missing that you
won't spot right away. Restore it all if you have the backups.
Not without 2 backups and an Ignite image!
Michael Tully
Honored Contributor

Re: command not found --Help me please!

Someone has had little turn of 'rm' from your system. If not you then, the first thing to do would be to change the 'root' password and then find some very recent backup tapes to see if you can recover the missing files. You might want to also compare some of the important directories from another system as well. If they are patched to the same level and are the same OS version, you could just copy these missing binaries across.
Anyone for a Mutiny ?
milaren
Super Advisor

Re: command not found --Help me please!

thank you very much for all your help!
Thanks!
Bill Hassell
Honored Contributor

Re: command not found --Help me please!

Wow, this is catastrophic! /sbin is a crucial system directory that contains not only 100+ commands that are required for single user mode, but the entire bootup and shutdown structure is missing. DON'T rebot your server!!! Get a backup tape out and restore /sbin and all the directories immediately or you may never get the machine back up again!


Bill Hassell, sysadmin
milaren
Super Advisor

Re: command not found --Help me please!

my god!
how about i copy the /sbin from another machine?
H.Merijn Brand (procura
Honored Contributor

Re: command not found --Help me please!

good plan, but only from a matching architecture. No 11i to 10.20 copy, that would ruin your day

use tar or cpio to preserve owner, group and access rights

Enjoy, Have FUN! H.Merijn
Enjoy, Have FUN! H.Merijn
Pete Randall
Outstanding Contributor

Re: command not found --Help me please!

My first choice would have to be the restore method, but you could try copying from another machine. Fortunately, cp, rcp, tar and the like reside in /usr/bin.


Pete

Pete