Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 1675 - the 'no colorful prompt after chroot' - problem
Summary: the 'no colorful prompt after chroot' - problem
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: [OLD] Unspecified (show other bugs)
Hardware: x86 Linux
: High normal (vote)
Assignee: Jon Nelson (RETIRED)
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2002-04-11 04:42 UTC by a9101556
Modified: 2003-02-04 19:42 UTC (History)
1 user (show)

See Also:
Package list:
Runtime testing required: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description a9101556 2002-04-11 04:42:29 UTC
(related to bug #1627)

I noticed this too. It results from the new /etc/profile checking $SHELL for
being "/bin/bash"
which it isn't after the changeroot (it is "/bin/sh" although I changerooted with
chroot /mnt/gentoo /bin/bash). So a simple 'export SHELL="/bin/bash"' fixes the
problem.
But there should be a better solution...

tigor
Comment 1 Daniel Robbins (RETIRED) gentoo-dev 2002-04-12 23:28:10 UTC
Weird.
Comment 2 Jon Nelson (RETIRED) 2002-04-13 16:54:57 UTC
Near as I can tell, the problem is actually that bash itself won't even bother
with /etc/profile *unless it is started as a login shell*.

Thus, 

chroot /mnt/gentoo /bin/bash --login

Works just great.
Another possible solution is to do the following:

1. source /etc/profile in ~/.bashrc
2. in /etc/profile, set an environment variable that can be checked to avoid
double-sourcing, in the case of a login shell (which would also source
~/.bash_profile which itself often sources ~/.bashrc)

I can offer suggestions on such an alteration to /etc/profile, but the real root
cause is bash not being started with --login

Comment 3 Jon Nelson (RETIRED) 2002-04-13 23:29:49 UTC
Additional Comments:  make sure the "source /etc/profile" line takes place
**after** the "export PS1=..." line in the (default) .bashrc

Mine looks like this:

# ~/.bashrc: executed by bash(1) for non-login shells.

export PS1='\h:\w\$ '
umask 022

source /etc/profile

# You may uncomment the following lines if you want `ls' to be colorized:
# export LS_OPTIONS='--color=auto'
# eval `dircolors`
# alias ls='ls $LS_OPTIONS'
# alias ll='ls $LS_OPTIONS -l'
# alias l='ls $LS_OPTIONS -lA'
#
# Some more alias to avoid making mistakes:
# alias rm='rm -i'
# alias cp='cp -i'
# alias mv='mv -i'

And either bash, bash -i, or bash --login works.
Also note that, as root, I copied the .bash_profile and .bashrc files out of
/etc/skel

As can be seen, I modified the .bashrc to source /etc/profile