Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question?
If it is not in the man pages or the how-to's this is the place! |
| Notices |
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
Are you new to LinuxQuestions.org? Visit the following links:
Site Howto |
Site FAQ |
Sitemap |
Register Now
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
 |
GNU/Linux Basic Guide
This 255-page guide will provide you with the keys to understand the philosophy of free software, teach you how to use and handle it, and give you the tools required to move easily in the world of GNU/Linux. Many users and administrators will be taking their first steps with this GNU/Linux Basic guide and it will show you how to approach and solve the problems you encounter.
Click Here to receive this Complete Guide absolutely free. |
|
 |
|
06-07-2012, 05:47 AM
|
#1
|
|
Member
Registered: Oct 2011
Posts: 32
Rep: 
|
Setting environmental variables when installing ns2 on fedora 15
Hi. I'm trying to install ns2.29.3 on fedora15.
Following the steps required, I have installed ns2 successfully.
I installed it in a folder in the following path:
home/naregs/ns2/ns-allinone2.29
I used sudo gedit ~/.bashrc to edit the variables in the /.bashrc file.
I saved the file after changes, and now when I type ns I get %.
so ns2 and nam are working. I have not validate it yet.
BUT the problem is now that I want to login as root, when I type
[narges@localhost ~]$ su
Password:
bash: #: command not found...
bash: #: command not found...
bash: #: command not found...
[root@localhost narges]#
As you can see, I am able to login as root but before that I get the "bash" error. and I dont understand why.
I restarted the system but i get the same problem.
Its the 2nd time I install ns2. I am 100% sure that the path variables are correct. I've paste them here for you to see. I dindt have this error the last time.
# LD_LIBRARY_PATH
OTCL_LIB=/home/narges/ns2/ns-allinone-2.29/otcl-1.11
NS2_LIB=/home/narges/ns2/ns-allinone-2.29/lib
X11_LIB=/usr/X11R6/lib
USR_LOCAL_LIB=/usr/local/lib
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$OTCL_LIB:$NS2_LIB:$X11_LIB:$USR_LOCAL_LIB
# TCL_LIBRARY
TCL_LIB=/home/narges/ns2/ns-allinone-2.29/tcl8.4.11/library
USR_LIB=/usr/lib
export TCL_LIBRARY=$TCL_LIB:$USR_LIB
# PATH
XGRAPH=/home/narges/ns2/ns-allinone-2.29/bin:/home/narges/ns2/ns-allinone-2.29/tcl8.4.11/unix:/home/narges/ns2/ns-allinone-2.29/tk8.4.11/unix
NS=/home/narges/ns2/ns-allinone-2.29/ns-2.29/
NAM=/home/narges/ns2/ns-allinone-2.29/nam-1.11/
PATH=$PATH:$XGRAPH:$NS:$NAM
I searched the web but havent found a solution yet. What have I done wrong in the /.bashrc file that gave me this error?
before I make changes in there, I couldnt run ns2 unless I go the directory. but at least i didnt have any bash error. now I can run ns2 and nam. and I can login as root. but everytime I get the errors shown above.
Please help me. Thanks in advance.
|
|
|
|
06-07-2012, 05:57 AM
|
#2
|
|
LQ 5k Club
Registered: Jan 2008
Location: Copenhagen, DK
Distribution: pclos2012.8, Slack1337 DebSqueeze, +50+ other Linux OS, for test only.
Posts: 11,584
|
Quote:
|
Setting environmental variables when installing ns2
|
Not required. Just install the binary /binaries, that you use :
cd ns-allinone2.29/ns-2.29/ ; su ; make install
cd ../nam-1.11/ ; make install
The binary 'ns' is hard coded to known the location of its libraries.
And 'nam' is usually partly statically compiled :
An OK nam will work on a Linux OS with no tcl and no ns2 installed !
.
|
|
|
1 members found this post helpful.
|
06-07-2012, 05:58 AM
|
#3
|
|
Member
Registered: Oct 2011
Posts: 32
Original Poster
Rep: 
|
BTW, the first time i entered the path variables in bashrc file and saved them. it gave me
export 'LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$OTCL_LIB:$NS2_LIB:$X11_LIB:$USR_LOCAL_LIB'not a valid identifier
bash: #: command not found...
bash: #: command not found...
errors, I changed the Makefile.in under /home/narges/ns2/ns-allinone-2.29/ns-2.29
as follows:
CC = gcc34
CPP = g++34
so i dont get export error as before. but i get the one i posted in porst#1.
Last edited by Narges; 06-07-2012 at 06:00 AM.
|
|
|
|
06-07-2012, 06:12 AM
|
#4
|
|
Member
Registered: Oct 2011
Posts: 32
Original Poster
Rep: 
|
Thank you knudfl for your fast reply.
Quote:
Originally Posted by knudfl
Not required. Just install the binary /binaries, that you use :
cd ns-allinone2.29/ns-2.29/ ; su ; make install
cd ../nam-1.11/ ; make install
.
|
you say not required to set the path. but without it I can not run ns2 as root from anywhere. right? I have to go to the directory and type ./ns.
and the installation is done completely successfully. so I think the problem is not in the installation. It has to do with bashrc file which I dont understand.
I agree that nam is a separate application. last time I couldnt run nam1.11 on fedora 15 and had to use nam 1.14. But on this machin on a same fedora 15 os I can use nam 1.11.
|
|
|
|
06-07-2012, 06:16 AM
|
#5
|
|
LQ 5k Club
Registered: Jan 2008
Location: Copenhagen, DK
Distribution: pclos2012.8, Slack1337 DebSqueeze, +50+ other Linux OS, for test only.
Posts: 11,584
|
# 3.
Not quite clear, why you want to log in as root. ( Never required.)
And : It it not recommended to use any ns2 commands as root.
May prevent you from using your ns-2.29 as unprivileged user.
.
|
|
|
|
06-07-2012, 06:21 AM
|
#6
|
|
LQ 5k Club
Registered: Jan 2008
Location: Copenhagen, DK
Distribution: pclos2012.8, Slack1337 DebSqueeze, +50+ other Linux OS, for test only.
Posts: 11,584
|
# 5.
Quote:
|
.. not required to set the path. but without it I can not run ns2 as root from anywhere.
|
"ns2" is not to be used as root.
Quote:
|
I have to go to the directory and type ./ns.
|
No. # 'make install' will copy 'ns' to /usr/local/bin/ .
Thus 'ns' is in a system path, and can executed from any location.
.
|
|
|
|
06-07-2012, 06:34 AM
|
#7
|
|
Member
Registered: Oct 2011
Posts: 32
Original Poster
Rep: 
|
Quote:
Originally Posted by knudfl
# 5.
"ns2" is not to be used as root.
.
|
when I'm not logged in as a root (as a normal user), and I go to the
[narges@localhost tcl]$ cd /home/narges/ns2/ns-allinone-2.29/ns-2.29/tcl/ex
[narges@localhost ex]$ ./ns wireless.tcl
bash: ./ns: No such file or directory
But If I type
[narges@localhost ex]$ su
Password:
bash: #: command not found...
bash: #: command not found...
bash: #: command not found...
[root@localhost ex]# ns wireless.tcl
i get results.
Thats why I have to be root to be able to run.
|
|
|
|
06-07-2012, 06:55 AM
|
#8
|
|
LQ 5k Club
Registered: Jan 2008
Location: Copenhagen, DK
Distribution: pclos2012.8, Slack1337 DebSqueeze, +50+ other Linux OS, for test only.
Posts: 11,584
|
Quote:
[narges@localhost tcl]$ cd /home/narges/ns2/ns-allinone-2.29/ns-2.29/tcl/ex
[narges@localhost ex]$ ./ns wireless.tcl
bash: ./ns: No such file or directory
|
No, of course not. The period ( . ) in "./ns"
means a file in the current directory.
And there is no 'ns' in ns-2.29/tcl/ex/
..
|
|
|
|
06-07-2012, 07:12 AM
|
#9
|
|
Member
Registered: Oct 2011
Posts: 32
Original Poster
Rep: 
|
Quote:
Originally Posted by knudfl
No, of course not. The period ( . ) in "./ns"
means a file in the current directory.
And there is no 'ns' in ns-2.29/tcl/ex/
..
|
Here is the result without "."
[narges@localhost ~]$ cd /home/narges/ns2/ns-allinone-2.29/ns-2.29/tcl/ex
[narges@localhost ex]$ ns wireless.tcl
bash: ns: command not found...
Similar command is: 'nc'
Quote:
Originally Posted by knudfl
No. # 'make install' will copy 'ns' to /usr/local/bin/ .
Thus 'ns' is in a system path, and can executed from any location.
..
|
So, I used make install under ns-allinone-2.29:
[narges@localhost ex]$ cd /home/narges/ns2/ns-allinone-2.29/
[narges@localhost ns-allinone-2.29]$ make install
make: Nothing to be done for `install'.
|
|
|
|
06-07-2012, 07:57 AM
|
#10
|
|
LQ 5k Club
Registered: Jan 2008
Location: Copenhagen, DK
Distribution: pclos2012.8, Slack1337 DebSqueeze, +50+ other Linux OS, for test only.
Posts: 11,584
|
Please see post # 2 :
cd ns-allinone-2.29/ns-2.29
su
make install && exit
( That's what root is for : Administrative tasks.
E.g. installing files to a location outside /home/<user-name> ).
.
Last edited by knudfl; 06-07-2012 at 07:58 AM.
|
|
|
|
06-08-2012, 09:18 AM
|
#11
|
|
Member
Registered: Oct 2011
Posts: 32
Original Poster
Rep: 
|
Quote:
Please see post # 2 :
cd ns-allinone-2.29/ns-2.29
su
make install && exit
( That's what root is for : Administrative tasks.
E.g. installing files to a location outside /home/<user-name> ).
.
|
I did as you said above(make install under/ns2.29 and nam-1.11), now wherever I type #ns as a normal user, I get %.
I REMOVED the paths I entered in ./bashrc file, now when I type #su and I enter the password, I am logged in as root with NO bash: #: command not found... error.
The problem now is when I want to run a tcl file under /tcl/ex I get the following error:
[narges@localhost ~]$ cd /home/narges/ns2/ns-allinone-2.29/ns-2.29/tcl/ex
[narges@localhost ex]$ ns simple.tcl
couldn't open "out.tr": permission denied
while executing
"open out.tr w"
invoked from within
"set f [open out.tr w]"
(file "simple.tcl" line 13)
(of course when I type the command as root I get results, but as u said I shouldnt use ns commands as root).
I think working with ns2, everytime you solve a problem you'll face a new one. so annoying.
Thank you so much for helping me.
|
|
|
|
06-08-2012, 10:18 AM
|
#12
|
|
LQ 5k Club
Registered: Jan 2008
Location: Copenhagen, DK
Distribution: pclos2012.8, Slack1337 DebSqueeze, +50+ other Linux OS, for test only.
Posts: 11,584
|
# 11.
Quote:
|
couldn't open "out.tr": permission denied
|
That's the reason why root shouldn't be used in /home/narges/.
The permissions will change, so only root has access.
Solution : su ; chown -R narges:narges ns/ns-allinone-2.29/*
chown -R narges:narges ns/ns-allinone-2.29/*/*
chown -R narges:narges ns/ns-allinone-2.29/*/*/*
chown -R narges:narges ns/ns-allinone-2.29/*/*/*/* && exit
Quote:
now when I type #su and I enter the password,
I am logged in as root with NO bash: #: command not found... error.
|
No, you are not logged in as root, when you open a terminal.
It's just a terminal, that will accept administrative commands.
Don't know, why bash can't be used by root.
May be you added something to /root/.bashrc , when working as root.
Please have a look, and delete alien entries, if any.
.
|
|
|
1 members found this post helpful.
|
09-05-2012, 01:55 AM
|
#13
|
|
Member
Registered: Oct 2011
Posts: 32
Original Poster
Rep: 
|
Hi again.
Regarding your post #12, I applied and changed the permission on my ns2.
But I have installed another ns2 in a different linux in VmWare earlier and I had used root to install ns2 and NIST mobile wimax module.
So now that I want to change the permission for ns2 folder, although I apply"chown" command the way you mentioned in post#12, It is not effective on this ns2.
ns2 is installed in /home/narges/ns-allinone-2.29
[narges@localhost ~]$ su
[root@localhost narges]# chown -R narges:narges /home/narges/ns-allinone-2.29/*
[root@localhost narges]# chown -R narges:narges /home/narges/ns-allinone-2.29/*/*
[root@localhost narges]# chown -R narges:narges /home/narges/ns-allinone-2.29/*/*/*
[root@localhost narges]# chown -R narges:narges /home/narges/ns-allinone-2.29/*/*/*/*
[root@localhost narges]# exit
exit
[narges@localhost ~]$ ns
bash: ns: command not found...
Similar command is: 'nc'
why is that so? I have installed NIST wimax and mobility on ns2 after solving lots of errors and really dont want to reinstall the ns2 again.
Is there anyway to solve it?
Thank you.
|
|
|
|
09-05-2012, 02:11 AM
|
#14
|
|
LQ 5k Club
Registered: Jan 2008
Location: Copenhagen, DK
Distribution: pclos2012.8, Slack1337 DebSqueeze, +50+ other Linux OS, for test only.
Posts: 11,584
|
# 13
This will show the files, that are still owned by root :
cd /home/narges/ns-allinone-2.29/
ls -Rl | grep root
( -Rl : upper case R. l is a lower case L ).
If you can't see which directory to files belong to, please try
ls -Rl | grep -B 20 root
.... where 20 is an example : Will show 20 lines above a hit.
When you have found the "owned by root files" cd <location>/
and : # chown narges:narges *
.
Last edited by knudfl; 09-05-2012 at 02:14 AM.
|
|
|
|
09-05-2012, 03:16 AM
|
#15
|
|
Member
Registered: Oct 2011
Posts: 32
Original Poster
Rep: 
|
I get nothing when I enter the 2commands.
[narges@localhost ns-allinone-2.29]$ ls -Rl | grep root
[narges@localhost ns-allinone-2.29]$ ls -Rl | grep -B 20 root
nothing seemes to be owned by root.
but how come the permission is not changed on ns2 folder? I dont understand it
|
|
|
|
| Thread Tools |
Search this Thread |
|
|
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
All times are GMT -5. The time now is 12:37 AM.
|
|
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.
|
Latest Threads
LQ News
|
|