LinuxQuestions.org
Latest LQ Deal: Complete CCNA, CCNP & Red Hat Certification Training Bundle
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 05-07-2009, 10:47 PM   #1
sureshlohith
LQ Newbie
 
Registered: May 2009
Posts: 8

Rep: Reputation: 0
Wink /etc/profile executed twice after login


I am working with PHYTEC I.MX31 ARM board iam able to observe /etc/profile executed twice after login to system i just want to know where is that function called from.
 
Old 05-07-2009, 11:08 PM   #2
i92guboj
Gentoo support team
 
Registered: May 2008
Location: Lucena, Córdoba (Spain)
Distribution: Gentoo
Posts: 4,063

Rep: Reputation: 381Reputation: 381Reputation: 381Reputation: 381
Quote:
Originally Posted by sureshlohith View Post
I am working with PHYTEC I.MX31 ARM board iam able to observe /etc/profile executed twice after login to system i just want to know where is that function called from.
How do you know that?

To answer your question, /etc/profile is an initialization file for bash. Each time that a new interactive login bash session is invoked then /etc/profile is sourced. Then once (and only one, the first found, if any) between ~/.bash_profile, ~/.bash_login, and ~/.profile, in that order is run as well.

Sometimes people symlink those files to each other, or copy them or do other weird stuff (that they shouldn't be doing), resulting in funny effects like the one you describe.
 
Old 05-07-2009, 11:55 PM   #3
sureshlohith
LQ Newbie
 
Registered: May 2009
Posts: 8

Original Poster
Rep: Reputation: 0
Wink /etc/profile executed twice after login

after login u can observe a message displayed "running /etc/profile.local" which is displayed twice and the file /etc/profile.local is called from /etc/profile.


Quote:
Originally Posted by i92guboj View Post
How do you know that?

To answer your question, /etc/profile is an initialization file for bash. Each time that a new interactive login bash session is invoked then /etc/profile is sourced. Then once (and only one, the first found, if any) between ~/.bash_profile, ~/.bash_login, and ~/.profile, in that order is run as well.

Sometimes people symlink those files to each other, or copy them or do other weird stuff (that they shouldn't be doing), resulting in funny effects like the one you describe.
 
Old 05-08-2009, 12:00 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
Then you should revise all the files I told you and see if there's anything strange. First of all check if some of them are symlinks to another file. If you don't know how to proceed, you can start by posting the output of this command.

Code:
ls -l /etc/profile /etc/profile.local ~/.bash_profile, ~/.bash_login, and ~/.profile
 
Old 05-08-2009, 12:10 AM   #5
sureshlohith
LQ Newbie
 
Registered: May 2009
Posts: 8

Original Poster
Rep: Reputation: 0
Wink /etc/profile executed twice after login

/etc/profile and /etc/profile.local are just shell scripting files so will it give any result if i give ls -l for these files



Quote:
Originally Posted by i92guboj View Post
Then you should revise all the files I told you and see if there's anything strange. First of all check if some of them are symlinks to another file. If you don't know how to proceed, you can start by posting the output of this command.

Code:
ls -l /etc/profile /etc/profile.local ~/.bash_profile, ~/.bash_login, and ~/.profile
 
Old 05-08-2009, 12:16 AM   #6
i92guboj
Gentoo support team
 
Registered: May 2008
Location: Lucena, Córdoba (Spain)
Distribution: Gentoo
Posts: 4,063

Rep: Reputation: 381Reputation: 381Reputation: 381Reputation: 381
Quote:
Originally Posted by sureshlohith View Post
/etc/profile and /etc/profile.local are just shell scripting files so will it give any result if i give ls -l for these files
I want to see if any of these files is symlinked to another one. For example, if ~/.bash_profile is symlinked to /etc/profile then it will produce the effect that you describe.

If that's not it, then we need to look into ALL of these files, and see what's inside.
 
Old 05-08-2009, 12:27 AM   #7
sureshlohith
LQ Newbie
 
Registered: May 2009
Posts: 8

Original Poster
Rep: Reputation: 0
Wink /etc/profile executed twice after login

There are no files inside home directory so the commands are not giving any kind of result.



Quote:
Originally Posted by i92guboj View Post
I want to see if any of these files is symlinked to another one. For example, if ~/.bash_profile is symlinked to /etc/profile then it will produce the effect that you describe.

If that's not it, then we need to look into ALL of these files, and see what's inside.
 
Old 05-08-2009, 12:40 AM   #8
i92guboj
Gentoo support team
 
Registered: May 2008
Location: Lucena, Córdoba (Spain)
Distribution: Gentoo
Posts: 4,063

Rep: Reputation: 381Reputation: 381Reputation: 381Reputation: 381
It should at least output the lines about /etc/profile and /etc/profile.local, those do exist, don't they? What do these two files contain anyway?
 
Old 05-08-2009, 01:32 AM   #9
sureshlohith
LQ Newbie
 
Registered: May 2009
Posts: 8

Original Poster
Rep: Reputation: 0
Wink

BY looking into /etc/profile script i identified that /etc/profile.local is called from /etc/profile.

/etc/profile.local has the following lines
export TSLIB_CONFFILE=`/etc/ts.conf`
export TSLIB_PLUGINDIR=`/usr/lib/ts`
export TSLIB_TSDEVICE=`/dev/event0`


Quote:
Originally Posted by i92guboj View Post
It should at least output the lines about /etc/profile and /etc/profile.local, those do exist, don't they? What do these two files contain anyway?

Last edited by sureshlohith; 05-08-2009 at 02:00 AM.
 
Old 05-08-2009, 04:03 AM   #10
sureshlohith
LQ Newbie
 
Registered: May 2009
Posts: 8

Original Poster
Rep: Reputation: 0
Wink /etc/profile executed twice after login

BY looking into /etc/profile script i identified that /etc/profile.local is called from /etc/profile.

/etc/profile.local has the following lines
export TSLIB_CONFFILE=`/etc/ts.conf`
export TSLIB_PLUGINDIR=`/usr/lib/ts`
export TSLIB_TSDEVICE=`/dev/event0`




Quote:
Originally Posted by i92guboj View Post
It should at least output the lines about /etc/profile and /etc/profile.local, those do exist, don't they? What do these two files contain anyway?
 
Old 05-08-2009, 09:22 AM   #11
i92guboj
Gentoo support team
 
Registered: May 2008
Location: Lucena, Córdoba (Spain)
Distribution: Gentoo
Posts: 4,063

Rep: Reputation: 381Reputation: 381Reputation: 381Reputation: 381
Quote:
Originally Posted by sureshlohith View Post
after login u can observe a message displayed "running /etc/profile.local" which is displayed twice and the file /etc/profile.local is called from /etc/profile.
Is this message self contained within /etc/profile? Maybe it's some kind of service in the background which launches the first instance of /etc/profile and then your login shell launches the second one.
 
Old 05-10-2009, 10:54 PM   #12
sureshlohith
LQ Newbie
 
Registered: May 2009
Posts: 8

Original Poster
Rep: Reputation: 0
Cool /etc/profile executed twice after login

BUT the message "running /etc/profile.local " is present in the file /etc/profile and i am not able find this in any other file in /etc.



Quote:
Originally Posted by i92guboj View Post
Is this message self contained within /etc/profile? Maybe it's some kind of service in the background which launches the first instance of /etc/profile and then your login shell launches the second one.
 
  


Reply


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
~/.bash_profile not being executed at login Radicalm16 Slackware 9 07-28-2009 10:39 PM
.bash_profile not executed at login Kiwi944 Linux - Newbie 6 06-25-2009 08:22 AM
login without using .profile shobhit Linux - Software 8 06-02-2007 01:39 PM
about the login profile ust Linux - Software 2 02-02-2004 10:43 PM
.profile .login albean Linux - Newbie 4 10-04-2002 09:51 PM


All times are GMT -5. The time now is 09:10 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