LinuxQuestions.org
Help answer threads with 0 replies.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
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


Reply
  Search this Thread
Old 07-19-2010, 02:27 PM   #1
jspeaks
LQ Newbie
 
Registered: Sep 2008
Posts: 3

Rep: Reputation: 0
Question export Warnings/Errors at Bash Login - How to trace down issues?


We are getting

-bash: export: `/usr/java/default': not a valid identifier

messages when we login as root to one of our server. This started occurring after a consultant installed software on the server. I have looked around in .bashrc, etc. for the error path so I can remove it, but can't seem to locate it. Does anyone have any tips on how to locate script line where this is being included, and/or trace the login procedure to find the culprit?
 
Old 07-19-2010, 02:58 PM   #2
Tinkster
Moderator
 
Registered: Apr 2002
Location: in a fallen world
Distribution: slackware by choice, others too :} ... android.
Posts: 23,066
Blog Entries: 11

Rep: Reputation: 910Reputation: 910Reputation: 910Reputation: 910Reputation: 910Reputation: 910Reputation: 910Reputation: 910
Look for a line
Code:
export $<something>
 
Old 07-20-2010, 06:08 AM   #3
catkin
LQ 5k Club
 
Registered: Dec 2008
Location: Tamil Nadu, India
Distribution: Debian
Posts: 8,576
Blog Entries: 31

Rep: Reputation: 1195Reputation: 1195Reputation: 1195Reputation: 1195Reputation: 1195Reputation: 1195Reputation: 1195Reputation: 1195Reputation: 1195
Quote:
Originally Posted by jspeaks View Post
... any tips on how to ... trace the login procedure to find the culprit?
Bash's use of Bash Startup Files is described here.

Different files are used for logon, interactive and non-logon bash sessions so you can home in on the problem line by considering if it happens only for logon sessions.

If that isn't enough, you can add a line at the beginning and end of each start up file, something like
Code:
echo '.bashrc starting'
Beware that start up files may run other files; especially /etc/profile may run many files from the /etc/profile.d directory.

Another technique is to put set -xv in the startup files; doing so in the global files (under /etc) will affect all users. Doing so in any start up file may cause breakage. So better to do so in the user's own bash start up file(s) first!
 
Old 07-20-2010, 06:53 AM   #4
i92guboj
Gentoo support team
 
Registered: May 2008
Location: Lucena, Córdoba (Spain)
Distribution: Gentoo
Posts: 4,063

Rep: Reputation: 381Reputation: 381Reputation: 381Reputation: 381
If you don't want to modify anything you could just run

Code:
bash -x ~/.bashrc
As the problematic user (root in this case). That will help you track down the issue. The output can be a bit complicated though, depending on how complex your ~/.bashrc file is.

But, for the look of it, I think that you are either missing the left-most part of a variable declaration. It should usually look like this:

Code:
VAR="value"
# or in this case probably
export VAR="value"
Maybe your "admin" just wrote something like

Code:
export /whatever/value
Which doesn't make any sense and is not a correct bash syntax. The right solution will vary depending on what the intended purpose for that line was. Removing or commenting it should take rid of the warning though. It shouldn't have any side effect other than that though, since that line is incorrect anyway and it doesn't declare anything or do any other thing other than spitting an error message.
 
Old 07-20-2010, 06:55 AM   #5
i92guboj
Gentoo support team
 
Registered: May 2008
Location: Lucena, Córdoba (Spain)
Distribution: Gentoo
Posts: 4,063

Rep: Reputation: 381Reputation: 381Reputation: 381Reputation: 381
Thinking about it, your problem might be something more like this:

Code:
VAR=/my/value
export $VAR
In this case, bash substitutes $VAR by '/my/value', resulting in an incorrect export declaration as I said in the previous post. Simply removing the '$' will work.
 
Old 07-20-2010, 07:12 AM   #6
catkin
LQ 5k Club
 
Registered: Dec 2008
Location: Tamil Nadu, India
Distribution: Debian
Posts: 8,576
Blog Entries: 31

Rep: Reputation: 1195Reputation: 1195Reputation: 1195Reputation: 1195Reputation: 1195Reputation: 1195Reputation: 1195Reputation: 1195Reputation: 1195
On further reflection this might be a simpler way to track down the offending line:
Code:
grep '/usr/java/default' /etc/profile ~/.bash_profile ~/.bash_login ~/.profile /etc/profile.d/*.sh
 
Old 07-20-2010, 02:33 PM   #7
Tinkster
Moderator
 
Registered: Apr 2002
Location: in a fallen world
Distribution: slackware by choice, others too :} ... android.
Posts: 23,066
Blog Entries: 11

Rep: Reputation: 910Reputation: 910Reputation: 910Reputation: 910Reputation: 910Reputation: 910Reputation: 910Reputation: 910
Quote:
Originally Posted by i92guboj View Post
Thinking about it, your problem might be something more like this:

Code:
VAR=/my/value
export $VAR
In this case, bash substitutes $VAR by '/my/value', resulting in an incorrect export declaration as I said in the previous post. Simply removing the '$' will work.

Heh. Which is pretty much what I said in less words ;D
 
Old 07-21-2010, 11:07 AM   #8
jspeaks
LQ Newbie
 
Registered: Sep 2008
Posts: 3

Original Poster
Rep: Reputation: 0
Catkin thanks for that link to "Bash's use of Bash Startup Files". That was the tip I needed to locate the /etc/profile and remove 2 export statements that were causing the problem. Thanks to everyone else for the additional information.

Jaye
 
  


Reply

Tags
login


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
ld : warnings and errors rajesh_b Programming 2 01-22-2007 08:50 AM
Warnings treated as errors smallfire Fedora 4 07-17-2006 01:08 AM
Warnings treated as errors(help) smallfire Programming 12 07-17-2006 01:04 AM
log warnings and errors - are these serious? bcal Fedora 3 02-12-2005 05:13 PM
Errors and warnings when I exit X cragwolf Slackware 5 09-01-2004 02:52 AM


All times are GMT -5. The time now is 10:26 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration