Wind River Support Network


LIN7-3350 : CLONE - bash not reading .bash_profile on login

Created: Apr 1, 2015    Updated: Sep 8, 2018
Resolved Date: May 7, 2015
Found In Version: 7.0
Fix Version:
Severity: Standard
Applicable for: Wind River Linux 7
Component/s: Userspace


When logging in as a user with bash as their shell the .bash_profile should be read to set up the environment. This does not seem to be happening.

The login command starts bash as "-bash" with the "-" sign indicating it is a login shell.

Starting bash with the -l option instead does seem to work, but this is not how login starts it. This worked in previous versions of WRL (at least in WRL4, not tested WRL5).

Steps to Reproduce

$ configure --enable-board=intel-x86-64 --enable-rootfs=glibc_std --enable-kernel=standard
$ make start-target

Log in as root. By default there is no .bash_profile so create one as follows:

# echo "export TEST=abcd" > .bash_profile

Log out and back again. The variable TEST should now exist, but it does not:

# env | grep TEST

Starting bash with the "-l" option does work however:

# bash -l
# env | grep TEST

So it seems limited to the case where bash is started as "-bash" as in the case where login starts it. Note however that the problem was initially seen using the runuser command, so this may be another way to demonstrate the issue.

Other Downloads

Live chat