Linux From ScratchThis 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.
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.
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)?
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.
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.
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
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.
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.
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.
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.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.