LinuxQuestions.org
Latest LQ Deal: Linux Power User Bundle
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Debian
User Name
Password
Debian This forum is for the discussion of Debian Linux.

Notices


Reply
  Search this Thread
Old 03-08-2006, 10:35 PM   #1
Akhran
Member
 
Registered: Aug 2005
Distribution: Debian 'lenny'
Posts: 208

Rep: Reputation: 30
Why is the value of $PATH in console mode different from the $PATH in xterm emulator?


When in console mode (x-window-system is not loaded),

root@myserver:~#echo $PATH

/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/bin/X11

However, when I'm in the window manager (fluxbox) and I open a xterm window, my $PATH has a different value.

root@myserver:~#echo $PATH

/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/ sbin:/bin:/usr/bin/X11

The difference is the additional space between the slash (/) and sbin. That causes /sbin to be missing from my PATH.

So any attempt to install package will give the error

dpkg: ldconfig not found on PATH
dpkg: start-stop-daemon not found on PATH

What is causing the additional space between the slash (/) and sbin in the PATH only when in xterm emulator?

Any advice would be greatly appreciated.

Thanks.
PS. Happens on both machines I installed x-window-system, fluxbox, xterm.
 
Old 03-09-2006, 12:56 AM   #2
dracae
Member
 
Registered: Feb 2006
Location: Oklahoma
Distribution: Debian Sid and Etch
Posts: 423

Rep: Reputation: 30
When you login the console /etc/profile is read. Opening an xterm only reads /etc/bash.bashrc, ~/.bashrc.
 
Old 03-09-2006, 04:13 AM   #3
Akhran
Member
 
Registered: Aug 2005
Distribution: Debian 'lenny'
Posts: 208

Original Poster
Rep: Reputation: 30
For testing purpose, I installed rxvt and eterm. rxvt has the same error but eterm displays the correct $PATH value ( no extra space ).

In short, $PATH shows the correct value in eterm, but incorrect in rxvt and xterm on both machines.

Thanks !
 
Old 03-09-2006, 04:26 AM   #4
kushalkoolwal
Senior Member
 
Registered: Feb 2004
Location: Middle of nowhere
Distribution: Debian Squeeze
Posts: 1,249

Rep: Reputation: 48
Quote:
Originally Posted by Akhran
When in console mode (x-window-system is not loaded),

root@myserver:~#echo $PATH

/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/bin/X11

However, when I'm in the window manager (fluxbox) and I open a xterm window, my $PATH has a different value.

root@myserver:~#echo $PATH

/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/ sbin:/bin:/usr/bin/X11

The difference is the additional space between the slash (/) and sbin. That causes /sbin to be missing from my PATH.

So any attempt to install package will give the error

dpkg: ldconfig not found on PATH
dpkg: start-stop-daemon not found on PATH

What is causing the additional space between the slash (/) and sbin in the PATH only when in xterm emulator?

Any advice would be greatly appreciated.

Thanks.
PS. Happens on both machines I installed x-window-sy
stem, fluxbox, xterm.
I had the exact same problem couple of days ago. I added the line
source /etc/profile in my ~/.bashrc file.

Also, how do the following files work in the sense when and how are they called and by whom?
Code:
.bash_profile,.bashrc, .profile, /etc/profile, /etc/bash.bashrc, .xsesson and .xinitrc
If someone can clarify those it would be really great.
 
Old 03-09-2006, 04:31 AM   #5
nx5000
Senior Member
 
Registered: Sep 2005
Location: Out
Posts: 3,307

Rep: Reputation: 55
Yes that's pretty annoying all this differences. Standards would help.. (maybe dash follows)
I add this type of line in scripts when I don't know when they're called.
Code:
echo "In bashrc" | logger
 
Old 03-09-2006, 05:20 AM   #6
gilead
Senior Member
 
Registered: Dec 2005
Location: Brisbane, Australia
Distribution: Slackware64 14.0
Posts: 4,138

Rep: Reputation: 165Reputation: 165
The first few describe bash's use of the files, because that's what I'm used to. My apologies to users of other shells...
Code:
.bash_profile read by the bash shell every time you login to the system (ie only in login shells);
.bashrc       is read by the bash shell every time you open a subshell with the bash command;
.profile      is used by the bash shell as a synonym for .bash_profile (derived from bourne and korn shells);
/etc/profile  is a system-wide 'parent' of .bash_profile/.profile;
/etc/bashrc   is a system-wide 'parent' of .bashrc <= I've never used this one...
.xinitrc      is a script that gets run every time startx is executed;
.xsession     is executed when users log in using xdm (.xinitrc is ignored)
 
Old 03-09-2006, 09:42 AM   #7
Akhran
Member
 
Registered: Aug 2005
Distribution: Debian 'lenny'
Posts: 208

Original Poster
Rep: Reputation: 30
What's the difference between xterm, eterm and rxvt in terms of implementation that might have caused this difference? As far as I can notice, /etc/profile is the only place where my $PATH is defined.

Quote:
Originally Posted by Akhran
For testing purpose, I installed rxvt and eterm. rxvt has the same error but eterm displays the correct $PATH value ( no extra space ).

In short, $PATH shows the correct value in eterm, but incorrect in rxvt and xterm on both machines.

Thanks !
 
Old 03-09-2006, 09:53 AM   #8
dracae
Member
 
Registered: Feb 2006
Location: Oklahoma
Distribution: Debian Sid and Etch
Posts: 423

Rep: Reputation: 30
Use these to track down the problem
grep -r 'PATH=' /root
grep -r 'PATH=' /etc
 
Old 03-09-2006, 05:42 PM   #9
Akhran
Member
 
Registered: Aug 2005
Distribution: Debian 'lenny'
Posts: 208

Original Poster
Rep: Reputation: 30
No file under /root but lots under /etc with 'PATH='. Eyeball check seems to indicate none of the lines in /etc contain '/ sbin'. What is the correct syntax to use to grep PATH="some_path_here:/ sbin:more_path_here" (with a space between / and sbin).

Also, another point to consider is why only eterm is not affected.

Thanks for all the replies



Quote:
Originally Posted by dracae
Use these to track down the problem
grep -r 'PATH=' /root
grep -r 'PATH=' /etc
 
Old 03-09-2006, 07:10 PM   #10
dracae
Member
 
Registered: Feb 2006
Location: Oklahoma
Distribution: Debian Sid and Etch
Posts: 423

Rep: Reputation: 30
grep -r '/ sbin' /
 
  


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
Image Path reference in Linux (Absolute path) javabuddy Linux - General 7 06-05-2006 08:45 AM
Apache path and kde path questions darkraider Debian 1 11-12-2005 06:07 AM
kdesu - su not in path, console/terminal doesn't work. Monster_user Debian 1 06-09-2005 11:46 PM
How to Chnage Python's module search path (sys.path)? lramos85 Linux - Software 1 05-02-2004 07:10 PM
how to see the complete path when using text mode? Xavius Linux - Newbie 5 03-27-2004 01:06 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Debian

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