Linux From Scratch This Forum is for the discussion of LFS.
LFS is a project that provides you with the steps necessary to build your own custom Linux system. |
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.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
|
 |
10-14-2005, 09:28 PM
|
#1
|
Member
Registered: Feb 2003
Distribution: Gentoo, FreeBSD, LFS
Posts: 298
Rep:
|
Bash shell being displayed twice?
Err, something like that. I wish I could make the topic more specific
After building LFS, and starting working on the BLFS parts, I rebooted to my LFS base system (after re-building shadow like the book tells me to when I install PAM) in order to login as a different user to test su.
PROBLEM:
It seems my bash shell gets displayed twice, something like this:
seph64@LFS - /home/seph64:seph64@LFS - $:
Any reason why it is doing this, and what configuration file I need to edit to fix it (so far I've done everything the install book told me to)?
Thanks in advance.
|
|
|
10-14-2005, 10:34 PM
|
#2
|
Senior Member
Registered: Jan 2003
Posts: 2,786
|
I'm guessing you messed with ~/.bash_profile or /etc/profile. Check to make sure you didn't make an "oops" when setting the PS1 environment variable.
I would bet money that in one of those files, there's a line containing something like this:
Code:
PS1="$PS1:\u@\h - \$"
Last edited by Dark_Helmet; 10-14-2005 at 11:30 PM.
|
|
|
10-14-2005, 10:45 PM
|
#3
|
Member
Registered: Feb 2003
Distribution: Gentoo, FreeBSD, LFS
Posts: 298
Original Poster
Rep:
|
If I find something like that in one of the files specified, I should take out the extra $PS1?
I looked at the /etc/profile and /etc/bashrc
And both has something similar in the export PS1 fields.
Should only one of those files have the export?
Last edited by Seph64; 10-14-2005 at 10:52 PM.
|
|
|
10-14-2005, 11:19 PM
|
#4
|
Senior Member
Registered: Jan 2003
Posts: 2,786
|
Yeah, sorry for leaving you hanging...
You'd want to remove the $PS1 reference in the assignment. As a safety measure, copy the line, comment the original, make changes to the copy, and see where it gets you. If all's well, delete the original.
If you'd like a second pair of eyes, go ahead and post the contents of both files. I don't think they'd be too terribly long to look at.
EDIT:
I changed the line above to use red text indicating what should probably be removed. By you can play with any of those assignments to suit yourself. Keep in mind that /etc/profile is looked at first, and then ~/.bash_profile. Also, changes you make won't be reflected until you log out, and log back in again.
Last edited by Dark_Helmet; 10-14-2005 at 11:32 PM.
|
|
|
10-15-2005, 02:42 AM
|
#5
|
Member
Registered: Sep 2005
Posts: 244
Rep:
|
Thanks, I had the same problem and it's fixed. 
|
|
|
10-15-2005, 09:01 AM
|
#6
|
Member
Registered: Feb 2003
Distribution: Gentoo, FreeBSD, LFS
Posts: 298
Original Poster
Rep:
|
You mis understood me.
In /etc/profile there was this:
That was also in /etc/bashrc, commenting out the line in /etc/bashrc did nothing. And there was nothing like that in ~/.bash_profile
|
|
|
10-15-2005, 11:05 AM
|
#7
|
Senior Member
Registered: Jan 2003
Posts: 2,786
|
No misunderstanding
What I mentioned was a possible explanation, not necessarily the cause of your situation specifically. There's probably still some funny business going on in one of the startup files. If you want to experiment, at a command prompt, type this:
Code:
export PS1='\u@\h:\w\$ '
If executing that command fixes your prompt, then there's something wrong with bash's startup files.You'll have to hunt down where it is. With LFS, the PS1 assignment can be in any number of places: /etc/profile, /etc/bashrc, /etc/profile.d/*, ~/.bash_profile, ~/.bashrc.
Having an identical "export PS1= something" statement in multiple files won't hurt anything, but if the statement had a reference to "$PS1" in the example above, then that's a problem.
If the export command at the prompt doesn't fix your problem, then there is something really strange going on. None of the software in the LFS of BLFS books should mess with the prompt at all. If there's something non-standard that's been installed, that would be a good place to start looking through documentation.
|
|
|
10-15-2005, 11:17 AM
|
#8
|
Member
Registered: Feb 2003
Distribution: Gentoo, FreeBSD, LFS
Posts: 298
Original Poster
Rep:
|
Nope, doesn't fix the prompt.
I looked through various files (/etc/profile, /etc/profile.d/, and the bash files) I am still puzzled why this problem exists.
I think the problem is with the /etc/profile file. as I have copied the /etc/profile from my gentoo install to the LFS install, and I don't get the problem.
I think I will post the text from the /etc/profile that the BLFS books states.
Code:
root@localhost / # cat /etc/profile.backup
# Begin /etc/profile
# Written for Beyond Linux From Scratch
# by James Robertson <jameswrobertson@earthlink.net>
# modifications by Dagmar d'Surreal <rivyqntzne@pbzpnfg.arg>
# System wide environment variables and startup programs.
# System wide aliases and functions should go in /etc/bashrc. Personal
# environment variables and startup programs should go into
# ~/.bash_profile. Personal aliases and functions should go into
# ~/.bashrc.
# Functions to help us manage paths. Second argument is the name of the
# path variable to be modified (default: PATH)
pathremove () {
local IFS=':'
local NEWPATH
local DIR
local PATHVARIABLE=${2:-PATH}
for DIR in ${!PATHVARIABLE} ; do
if [ "$DIR" != "$1" ] ; then
NEWPATH=${NEWPATH:+$NEWPATH:}$DIR
fi
done
export $PATHVARIABLE="$NEWPATH"
}
pathprepend () {
pathremove $1 $2
local PATHVARIABLE=${2:-PATH}
export $PATHVARIABLE="$1${!PATHVARIABLE:+:${!PATHVARIABLE}}"
}
pathappend () {
pathremove $1 $2
local PATHVARIABLE=${2:-PATH}
export $PATHVARIABLE="${!PATHVARIABLE:+${!PATHVARIABLE}:}$1"
}
# Set the initial path
export PATH=/bin:/usr/bin
if [ $EUID -eq 0 ] ; then
pathappend /sbin:/usr/sbin
unset HISTFILE
fi
# Setup some environment variables.
export HISTSIZE=1000
export HISTIGNORE="&:[bf]g:exit"
#export PS1="[\u@\h \w]\\$ "
export PS1='\u@\h:\w\$ '
for script in /etc/profile.d/*.sh ; do
if [ -r $script ] ; then
. $script
fi
done
# Now to clean up
unset pathremove pathprepend pathappend
# End /etc/profile
Last edited by Seph64; 10-15-2005 at 11:23 AM.
|
|
|
10-15-2005, 12:26 PM
|
#9
|
Senior Member
Registered: Jan 2003
Posts: 2,786
|
Execute this command at a command prompt:
Code:
grep -lr "PS1" /etc/*
My gut says there will be a file in /etc/profile.d listed. Post those file(s) if they're not too terribly long.
|
|
|
10-15-2005, 12:29 PM
|
#10
|
Member
Registered: Feb 2003
Distribution: Gentoo, FreeBSD, LFS
Posts: 298
Original Poster
Rep:
|
Nope, only /etc/bashrc and /etc/profile
|
|
|
10-15-2005, 12:36 PM
|
#11
|
Senior Member
Registered: Jan 2003
Posts: 2,786
|
Could you post /etc/bashrc as well?
|
|
|
10-15-2005, 01:05 PM
|
#12
|
Member
Registered: Feb 2003
Distribution: Gentoo, FreeBSD, LFS
Posts: 298
Original Poster
Rep:
|
Code:
bash-3.00# cat /etc/bashrc
# Begin /etc/bashrc
# Written for Beyond Linux From Scratch
# by James Robertson <jameswrobertson@earthlink.net>
# updated by Bruce Dubbs <bdubbs@linuxfromscratch.org>
# Make sure that the terminal is set up properly for each shell
if [ -f /etc/profile.d/tinker-term.sh ]; then
source /etc/profile.d/tinker-term.sh
fi
# System wide aliases and functions.
# System wide environment variables and startup programs should go into
# /etc/profile. Personal environment variables and startup programs
# should go into ~/.bash_profile. Personal aliases and functions should
# go into ~/.bashrc
# Provides a colored /bin/ls command. Used in conjunction with code in
# /etc/profile.
alias ls='ls --color=auto'
# Provides prompt for non-login shells, specifically shells started
# in the X environment. [Review the LFS archive thread titled
# PS1 Environment Variable for a great case study behind this script
# addendum.]
#export PS1="[\u@\h \w]\\$ "
#export PS1='\u@\h:\w\$ '
# End /etc/bashrc
I commented out the last export PS1 thinking it might've been the problem.
|
|
|
10-15-2005, 01:14 PM
|
#13
|
Senior Member
Registered: Jan 2003
Posts: 2,786
|
Honestly, I don't see anything wrong with those files.
If you want to find the culprit, then all I can suggest is start with your Gentoo version of /etc/profile and work your way back toward the LFS /etc/profile. Make a small change and see if it breaks. When/if it does break, it should give some idea where to look next.
|
|
|
10-15-2005, 01:22 PM
|
#14
|
Senior Member
Registered: Jan 2003
Posts: 2,786
|
Whoa, whoa, whoa...
BLFS book, Chapter 3: "After LFS Configuration Issues"
Slightly past the middle of the page it says:
Quote:
/etc/profile.d/extra-prompt.sh
This script shows an example of a different way of setting the prompt. The normal variable, PS1, is supplemented by PROMPT_COMMAND. If set, the value of PROMPT_COMMAND is executed as a command prior to issuing each primary prompt. The sequence \e is an ESC character. \a is a BEL character. For a reference on xterm escape sequences, see http://rtfm.etla.org/xterm/ctlseq.html.
Code:
cat > /etc/profile.d/extra-prompt.sh << "EOF"
PROMPT_COMMAND='echo -ne "\e[1m${USER}@${HOSTNAME} : ${PWD}\e[0m\a"'
export PROMPT_COMMAND
EOF
The escape sequences above are BOLD, NORMAL, and BEL.
|
Kill that file or rename it to something other than *.sh and see if things improve.
Last edited by Dark_Helmet; 10-15-2005 at 01:24 PM.
|
|
|
10-15-2005, 01:28 PM
|
#15
|
Member
Registered: Feb 2003
Distribution: Gentoo, FreeBSD, LFS
Posts: 298
Original Poster
Rep:
|
There's one oddity in all this. If I press up and scroll through the list of commands I used, it'll sometimes show the prompt as it should, but only til the next command.
Doesn't seem like it helps much.
Actually I just exited my chroot and re-entered the chroot, and now it appears to work.
Thanks.
Last edited by Seph64; 10-15-2005 at 01:32 PM.
|
|
|
All times are GMT -5. The time now is 08:33 PM.
|
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
|
|