?
Solved

Setting Path

Posted on 2006-03-26
22
Medium Priority
?
686 Views
Last Modified: 2013-12-27
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
0
Comment
Question by:emlily
  • 13
  • 3
  • 3
  • +1
22 Comments
 

Author Comment

by:emlily
ID: 16293447
some i saw note on net regarding LD_LIBRARY_PATH...is this related to setting the path?
0
 

Author Comment

by:emlily
ID: 16294942
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
 
LVL 6

Expert Comment

by:bpeterse
ID: 16296675
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
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 6

Expert Comment

by:bpeterse
ID: 16296685
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
 

Author Comment

by:emlily
ID: 16296932
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
 

Author Comment

by:emlily
ID: 16296948
but i can echo $PATH to my solaris...it show /usr/sbin and/usr/bin
0
 

Author Comment

by:emlily
ID: 16297868
any other way to save my solaris?
0
 

Author Comment

by:emlily
ID: 16299192
i throw away all my point to solve the problem.tq
0
 

Author Comment

by:emlily
ID: 16299441
boot from cdrom can solve this problem?
0
 

Author Comment

by:emlily
ID: 16299632
cdrom wasn't able to help me to get my solaris back..except reinstall
0
 
LVL 4

Expert Comment

by:BobHB
ID: 16300924
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
 
LVL 14

Expert Comment

by:arthurjb
ID: 16301114
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
 

Author Comment

by:emlily
ID: 16301353
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
 

Author Comment

by:emlily
ID: 16301464
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
 
LVL 14

Expert Comment

by:arthurjb
ID: 16301704
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
 

Author Comment

by:emlily
ID: 16301875
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
 
LVL 4

Expert Comment

by:BobHB
ID: 16301966
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
 
LVL 14

Assisted Solution

by:arthurjb
arthurjb earned 200 total points
ID: 16302046
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
 
LVL 6

Accepted Solution

by:
bpeterse earned 440 total points
ID: 16302100
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
 
LVL 4

Expert Comment

by:BobHB
ID: 16302652
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
 

Author Comment

by:emlily
ID: 16307950
[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
 

Author Comment

by:emlily
ID: 16307955
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

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Let's say you need to move the data of a file system from one partition to another. This generally involves dismounting the file system, backing it up to tapes, and restoring it to a new partition. You may also copy the file system from one place to…
Every server (virtual or physical) needs a console: and the console can be provided through hardware directly connected, software for remote connections, local connections, through a KVM, etc. This document explains the different types of consol…
Learn how to get help with Linux/Unix bash shell commands. Use help to read help documents for built in bash shell commands.: Use man to interface with the online reference manuals for shell commands.: Use man to search man pages for unknown command…
Learn how to find files with the shell using the find and locate commands. Use locate to find a needle in a haystack.: With locate, check if the file still exists.: Use find to get the actual location of the file.:
Suggested Courses

850 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question