Setting Path

In my Solaris x86. I have two user root and john.

Some of installation from the manual of package, i found out that they said i need to set the path. Example: PATH=$PATH:/usr/local/bin:/usr/ccs/bin

How to set this path? do i just type in the command from terminal or do i need to edit some files? will this path usable to other user than root?...

thanks
emlilyAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

emlilyAuthor Commented:
some i saw note on net regarding LD_LIBRARY_PATH...is this related to setting the path?
0
emlilyAuthor Commented:
oh god...after do some research, i insert this command to my solaris and after that my solaris become crazy...i cant reboot, halt, shutdown and do anything...a lot of error finding the path

crle -l /usr/bin:/usr/sbin:/usr/ccs/bin/
0
bpeterseCommented:
You definitely don't want to use a run-time linking utility - this is why Solaris is going crazy.  If you can get to a command prompt, remove the 'crle' line - don't need that to set a path.

Solaris uses Bourne shell for root by default - to set a path for all users (root & john):
   Edit /.profile with the following line:
       PATH=/usr/bin/:/usr/sbin:/usr/ccs/bin:/usr/ucb/bin; export PATH
   Every user can have their own profile in their home directory.

More can be learned at http://www.softpanorama.org/Scripting/Shellorama/dotfiles.shtml

Pay particular attention to the use of the ENV file (i.e. kshrc, bashrc, <whatever>rc) - many people make a mistake by putting paths in their profile only to lose their path when another shell is started.

LD_LIBRARY_PATH - useful/necessary when programs that are compiling when they start (e.g. java).
hope this helps,
/bp/
0
Cloud Class® Course: Microsoft Office 2010

This course will introduce you to the interfaces and features of Microsoft Office 2010 Word, Excel, PowerPoint, Outlook, and Access. You will learn about the features that are shared between all products in the Office suite, as well as the new features that are product specific.

bpeterseCommented:
Clarification - since both users are already created - you'll have to edit both their profiles, one in / and one in /home/john.
For all other users, first edit the /etc/profile and add what PATH you want all the rest of the users to have when creating them.
0
emlilyAuthor Commented:
bpeterse,

now because of the my solaris become crazy...i even can do bash, and ls and i cant vi any file.

after reboot, solaris ask for do fsck disk.

how to save my solaris because i already customize a lot of thing in it...
0
emlilyAuthor Commented:
but i can echo $PATH to my solaris...it show /usr/sbin and/usr/bin
0
emlilyAuthor Commented:
any other way to save my solaris?
0
emlilyAuthor Commented:
i throw away all my point to solve the problem.tq
0
emlilyAuthor Commented:
boot from cdrom can solve this problem?
0
emlilyAuthor Commented:
cdrom wasn't able to help me to get my solaris back..except reinstall
0
BobHBCommented:
Hi emlily -

You've mucked up your system, but you haven't hosed it!

When you reboot, let the system "fsck" your disk.  It will fix some inevitable corruption in your disks but it will ask you if you want it to make that fix.  You have the option NOT to let it make the corrections, and it will try to continue with the reboot process.  fsck will NOT format your disk. You could lose data, but fsck will not be the culprit.

Everytime your system is booted an fsck is run.  This is a safety feature to pick up problems early and correct them before they become big problems.  Always run fsck from single-user mode though, and never on a mounted file system.  But in the boot process this occurs before the file systems are mounted.

Where did you enter the "crle -l /usr/bin:/usr/sbin:/usr/ccs/bin/" command?  Interactively?  Or into a logon script (and which one)?  Since you've tried to reboot I imagine you've put it into a script.   If you entered the command interactively then complete the reboot process and that craziness of your system should disappear.  It sounds like you're just paranoid about messing up your system even further, and justifiably so.  I've "been there, done that" too, so I can empathize!

I'm going to make a recommendation or two, but please know that I deal with Sparc Solaris and not x86 Solaris.  While I believe what I'm going to say will work, I can't guarantee it.

If you entered the crle command into a script then you will need to enter the single-user environment.  Do this:

- Insert your system disk and enter <boot cdrom -s> to reboot the system from the cdrom and then to enter single user mode.
- Do the fsck command and accept its recommendations.  Enter <fsck /dev/rdsk/c0t0d0s0>
- Mount your systems root vol.  Enter </dev/dsk/c0t0d0s0 /a>
- CD to the directory where your bad script is:  cd /a/foldername
- Copy that bad script to a backup file:  cp badFileName badFileName.bak (or whatever extension you wish to use), just for safety's sake
- You should be able to vi your script, so run vi, delete the crle statement, and save the script
- CD back to your cdrom:  <cd />
- Unmount your rootvol:  <umount /a>
- Reboot the system:  init 6

You should be good to go.  Let us know what happens.

When the systems comes up clean and stable, delete the badFileName.bak script.  You should always make backups of your scripts before changing them.
0
arthurjbCommented:
If you are using mirrored disks or software raid (both done normally using Suns built in tools)

Booting from the cd as described above may not give you access to those volumes, and running fsck on the disks that are just parts of mirrors or raids, can corrupt your system beyond recovery.

Booting single user is a good idea, but just do it from the console by typing; boot -s

from the single user prompt you can then do the fsck by typing; fsck -y
this will recover any recoverable files.  

A unix expert may not use the -y option and may be able to recover more files than the system can recover, but most of us are not that skilled.

Once the fsck is complete, which can take quite a while depending on the size of the filesystems, you can then remove the bad script and reboot in normal mode. (by just typing;  reboot)

Good Luck
0
emlilyAuthor Commented:
BobHB ,

I didnt type the crle command in the script..i just type in by the command line which i planned that will fix the path. i didnt set it in any scripts...i will try your suggestion and authurjb also
0
emlilyAuthor Commented:
even boot without cdrom. the system will boot directly to single user mode and asking me to insert root password. after password is inserted it will go to ksh enviroment. but from the console i can't do anything...i can't ls, vi, top, rm,...if i type any command at the console i will get this:


ld.so.1:/bin/i386: fatal: libc.so.1: open failed: No such file or directory Killed
ld.so.1:/bin/i386: fatal: libnsl.so.1: open failed: No such file or directory Killed
ld.so.1:/bin/i386: fatal: libmail.so.1: open failed: No such file or directory Killed
0
arthurjbCommented:
The crle command would have modified the file /var/ld/ld.config

A quick and dirty test would be to try and rename that file and see if that is the cause of your problem or just a red herring.

A system that has never had crle run does not have that file.
0
emlilyAuthor Commented:
like i said i can do anything after enter the single user mode...

this what i got after try to rename the ld.config

#mv /var/ld/ld.config /var/ld/ld.config.bak
ld.so.1: mv: fatal: libc.so.1: open failed: No such file or directory

As additional...i only can do this command so far,
echo $PATH and the output is:
/usr/sbin:/usr/bin
0
BobHBCommented:
OK - to make sure I understand your current situation:

You've booted into single-user mode without the cdrom by using arthurjb's suggestion?  Or, is single-user mode the ONLY mode your system will come up in now?  It really doesn't matter though.

Power down the machine using the 'init 5' command.  Then turn the power off.  Go get a coffee, come back, turn the machine on and power it up.  If it still comes up in single user mode then use the 'init 2' command to reboot it into multi-user mode.  It is possible your init table got messed up.  If it still comes up in single user mode then it matters.  But we have to get to a common ground before taking the next step(s).

(Your problems above are because your machine is not coming up completely, and cannot find the paths to the commands you want to use.)
0
arthurjbCommented:
try
echo /var/ld/*

that should show you if the ld.config is in that directory

if so, and you are desperate try
> /var/ld/ld.config

Yes, just a greater than symbol > and the file name.  this will cause it to become an empty file, so if it is the contents of the file causng your problem, then it may fix your problem.
0
bpeterseCommented:
Emlily,
At some point (pretty soon from the sound of it) , you should weigh whether you're spending too much time regaining too little work.  It doesn't sound as if you had the system very completely configured.  My advice, fwiw, is boot to CD and reinstall completely.  You'll probably be ahead in the long run.
/bp/
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
BobHBCommented:
I will concur with bpeterse's thought that it may be time to reinstall the OS.

But unlike the initial install, you should not have to reformat the drives or recreate the volumes - you should be able to re-use your rootvol as you've currently configured it, and just reinstall the OS in place.  You will probably be able to save much of your configuration files although I would - if possible - back them up before the reinstall.
0
emlilyAuthor Commented:
[bpeterse]

init also result the same thing which when every i type init 5 or any number...this is what i get:
ld.so.1: mv: fatal: libc.so.1: open failed: No such file or directory

[BobHB]

> /var/ld/ld.config also cant do anything. so i think i will reinstall the OS as what bpeterse suggest.

thank you for all the support.

0
emlilyAuthor Commented:
ops sorry

[arthurjb]

> /var/ld/ld.config also cant do anything. so i think i will reinstall the OS as what bpeterse suggest.

thank you for all the support.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Unix OS

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.