/etc/profile not being sourced


Nope. Don’t believe me? Compare both profile files of both Manjaro’s and Arch’s filesystem package. You can use meld for this ) :



Nope, Manjaro never modified grc. The package was taken from Arch ( As evidenced by pacman -Si grc said that the maintainer is from the Arch folks ). If you look at Arch’s PKGBUILD :


You will see that they never modified the installation procedure (As in the PKGBUILD, it’s just running install.sh)

And if you look at the install.sh file :

install.sh -------------------------- #!/bin/sh set -e PREFIX=${1:-/usr/local} ETCPREFIX=$2 BINDIR=$PREFIX/bin LIBDIR=$PREFIX/share/grc MANDIR=$PREFIX/share/man CONFDIR=$ETCPREFIX/etc PROFILEDIR=$CONFDIR/profile.d mkdir -p...
0 0
From Bugzilla Helper: User-Agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.7.8) Gecko/20050524 Fedora/1.0.4-4 Firefox/1.0.4 Description of problem: LD_LIBRARY_PATH is defined and exported in /etc/profile. Variable is blank after user login. Executing source /etc/profile recreates the variable and remains until the user logs out. Subsequent user logins require runnin source /etc/profile once again. Version-Release number of selected component (if applicable): bash 3.0 How reproducible: Always Steps to Reproduce: 1. Define and export LD_LIBRARY_PATH in /etc/profile 2. Log out and login again 3. Execute printenv and LD_LIBRARY_PATH will be empty. Actual Results: Programs depending on LD_LIBRARY_PATH can't find shared objects. Expected Results: Programs should find shared objects and execute properly. Additional info: Recently installed FC4 and downloaded kernel update.Please be more specific about how you are logging in and logging out. If you are using a graphical interface to...
0 0

The default shell in Alpine Linux is ash.

Ash will only read the /etc/profile and ~/.profile files if it is started as a login shell sh -l.

To force Ash to source the /etc/profile or any other script you want upon its invocation as a non login shell, you need to setup an environment variable called ENV before launching Ash.

e.g. in your Dockerfile

FROM alpine:3.5 ENV ENV="/root/.ashrc" RUN echo "echo 'Hello, world!'" > "$ENV"

When you build that you get:

deployer@ubuntu-1604-amd64:~/blah$ docker build --tag test . Sending build context to Docker daemon 2.048kB Step 1/3 : FROM alpine:3.5 3.5: Pulling from library/alpine 627beaf3eaaf: Pull complete Digest: sha256:58e1a1bb75db1b5a24a462dd5e2915277ea06438c3f105138f97eb53149673c4 Status: Downloaded newer image for alpine:3.5 ---> 4a415e366388 Step 2/3 : ENV ENV "/root/.ashrc" ---> Running in a9b6ff7303c2 ---> 8d4af0b7839d Removing intermediate container a9b6ff7303c2 Step 3/3 : RUN echo "echo 'Hello,...
0 0

For 11.04, I did a fresh install of my system. Part of that install was to install rvm, which sticks a rvm.sh in /etc/profile.d/. This doesn't work as /etc/profile (which loads each +r in /etc/profile.d/*.sh) is not being loaded. According to the documentation, the profile is only sourced if bash is run in login. To verify this, I invoked bash --login, after which rvm was available.

This has worked for me in previous versions of Ubuntu without any configuration. That is, a fresh install of 10.10 will correctly source profile/.d.

My question is: is there anything I'm doing wrong, or are there some new assumptions being made in Natty that have broken this? My current workaround is to source /etc/profile in ~/.bashrc (which is awful as profile is meant to load before bashrc's, but does the trick).

Per default, gnome-terminal does not start bash as a login shell (I assume you mean bash started inside a gnome-terminal). That means bash will not read /etc/profile or...

0 0

It depends.

Unless the shell is launched as a "login shell", which is the system's way of signaling to the shell that this is the first time the user is interacting with the computer for this session, it is started as a "child" shell.

"Login" shells source the environment from whatever control mechanism is set up (/etc/profile, /etc/profile.d/, and usually local dotfiles like .profile and .bashrc (if bash)).

"Child" shells just inherit their parent's environment, but sometimes also run some dotfiles depending on how they are configured.

In most systems with X configured, the dot files are sourced by whatever process starts the window manager and xterms or konsoles or whatever just inherit from that. This is because it isn't considered a login session, since you were already logged in when you started the konsole.

You can set your konsole to run 'bash --login' if you want, but this might have unexpected side-effects later on when you run something...

0 0

Binary package hint: lightdm

/etc/gdm/Xsession had this code:
# First read /etc/profile and .profile
test -f /etc/profile && . /etc/profile
test -f "$HOME/.profile" && . "$HOME/.profile"
# Second read /etc/xprofile and .xprofile for X specific setup
test -f /etc/xprofile && . /etc/xprofile
test -f "$HOME/.xprofile" && . "$HOME/.xprofile"
so that, for example, ~/bin gets added to the path (by the default ~/.profile), and any user-customized environment setup gets run.

After switching from gdm to lightdm, this no longer happens. This is going to be a regression now that lightdm is becoming the default display manager.

ProblemType: Bug
DistroRelease: Ubuntu 11.10
Package: lightdm 0.3.7-0ubuntu1
ProcVersionSignature: Ubuntu 2.6.39-3.10-generic 2.6.39
Uname: Linux 2.6.39-3-generic x86_64
NonfreeKernelModules: openafs
Architecture: amd64
Date: Tue Jun 7 19:27:11 2011

0 0

I had alot of problems when getting the Citrix MetaFrame client to work on my HP's a couple years back. Here's some of the things I did to get it working:

1 - Edit /opt/CTXSmf/lib/ctxsession.sh and uncomment the following lines:
< # if [ -f $HOME/.ctx.session.sh ] ; then
< # . $HOME/.ctx.session.sh
< # fi

2 - Create a .ctx.session.sh file in the home directory.
Here's what I use.
1 #!/bin/sh
2 # echo "Executing .ctx.session.sh ..."
3 export LOGNAME=`whoami`
4 . $HOME/.pshrc
5 ctx3bmouse middle=left,1

ctx3bmouse allows use of left shift and left mouuse click for two mouse click.

3 - Edited .profile and added the following:
# Citrix will not log on if ENV variable is set!!! for /usr/bin/sh shell
# ENV=/home/mqm/.pshrc
# export ENV
if [ "X${SHELL}" = "X/usr/bin/sh" ]; then

if [ `env | grep CITRIX_SESSION_ID | wc -l` -eq 0 ]; then
export ENV

0 0

I have JUST downloaded the latest codewarrior IDE (folder name 'CodeWarrior for DSC56800E v8.3' and abouthelp). I am using Windows XP with all the most recent updates.

I have had no problem loading code through JTAG through the parallel port. However, a coworker does not have a parellel port on his new laptop so we decided to get him the new USB tap. He was unable to get it to work on his machine and so I was tasked with getting it to work.

However, whenever I try to download, I always get the error "CCS: Library not found." I have searched around this site and the internet and have found a bunch of suggestions, none of them have helped.

When I start up the CCS I get the following data:

CodeWarrior Connection Server console display active (Tcl8.4.12 / Tk8.4.12)Loading CCSAPI Tcl interface (C:/Program Files/Freescale/CodeWarrior for DSC56800E v8.3/ccs/bin/ccstcl.dll)...CCS: trnbo_sync.tcl is sourced into [::rnbo_sync] namespaceCCS: trnbo_mcore.tcl...

0 0

/etc/profile is invoked only for login shells because that is its specific purpose.

If you want a command to run for interactive shells that are not login shells, and you're using bash, put it in ~/.bashrc or /etc/bash.bashrc.

The purpose of the "profile" files is to contain commands that ought to be run for login shells only. These files are:

Scripts in /etc/profile.d.

This is for Bourne-style shells, but it's not coded into the shell executable itself. Rather, commands in /etc/profile calls them. For example, on my Ubuntu 12.04 system, /etc/profile includes these lines:

if [ -d /etc/profile.d ]; then for i in /etc/profile.d/*.sh; do if [ -r $i ]; then . $i fi done unset i fi

.profile in the user's home directory, run by Bourne-compatible shells when started as a login shell (unless overridden, see below).

.bash_profile or .bash_login in the user's home directory. These are ignored by shells other than bash. But if...

0 0
I have started using the PostgreSQL database server. It created a special user, postgres, when I installed the package. Except for one little thing, it is working great.

When I "su - postgres" or "su -l postgres" (which should be equivalent), the .bashrc I created in user postgres's home directory is not being executed. If, after login, I run ". ./.bashrc", the profile is executed and does exactly what I want, which is just setting a couple of environment variables. I have verified that the user's shell is bash and that the .bashrc profile is in its home directory, owned by user postgres.

I even tried making the file executable, but that did not help.

I have read the man pages for both su and bash, and both seem to indicate that the profile should be being executed. What am I missing?


0 0

I've been searching the forum for about 30 minutes but can't find this issue discussed anywhere. Apologies if there's a thread I missed - just point me thattaway if that's the case.

Briefly, I have added a bin directory to my home directory (the pi account) and added the path to the c++ include libraries to my .profile but neither the path to the bin directory (which should be added to the PATH env variable by legacy code in the .profile) nor the library path (which I added myself to the PATH setting in that .profile) are being appended/prepended to the PATH variable until I manually source the .profile, at which point everything works as expected.

I have none of the conditions laid out in the comments in the .profile that would preclude its not being run at login.

This problem manifests on boot and upon logging out and logging back in. It is as though the .profile in my home directory just doesn't exist.

The Pi is an early run model B with 256 MB memory...

0 0

As you can see, it is.

Eskimo North Linux Friendly Internet Access, Shell Accounts, and Hosting.
Knowledgeable human assistance, not telephone trees or script readers.
See our web site: http://www.eskimo.com/ (206) 812-0051 or (800) 246-6874.

Date: Mon, 5 Oct 2015 15:07:29 -0600

Subject: Re: [X2Go-User] Start Up Scripts Not Being Sourced

Post by Robert Dinse

If I connect using NX plugin with Remmina to freenx-server, /etc/profile

and related start up scripts all get sourced properly.

If I do the same with x2go they do not on some platforms, for example it

seems to work on old Centos but not Fedora or Debian derivatives, and I end up

with an environment not properly setup.

Try making sure x2goserver-xsession is installed on the servers.


Orion Poplawski

Technical Manager ...

0 0

On Tue, May 01, 2012 at 07:11:37PM +0100, Stroller wrote

> So /etc/profile contains the following message:


> # You should override these in your ~/.bashrc (or equivalent) for per-user

> # settings. For system defaults, you can add a new file in /etc/profile.d/.

> export EDITOR=${EDITOR:-/bin/nano}

> export PAGER=${PAGER:-/usr/bin/less}


> Therefore I have created a plain text file /etc/profile.d/essential_defaults

I don't know if it gets executed in the right order. Are you using
baselayout 2? The items you mentioned are EDITOR and PAGER. For the
official way of changing global settings, see...
for examples. In my case...

waltdnes@d531 ~ $ cat /etc/env.d/99editor

In your case, I would suggest creating a file called /etc/env.d/99pager
containing the line...

0 0

Recently I was working on an issue where an application was not retaining the umask setting set in the root users profile or /etc/profile. After looking into the issue a bit it seemed that the application in question only applied the umask setting that was set in /etc/bashrc and would not even accept the values being the applications own start scripts.

After doing a bit of researched I learned a little bit more about what exactly these files do, the differences between them and when they are executed. I figured this would be a good thing to share as it is not a topic that comes up very often.

What is /etc/profile used for?

If you have been using Linux for a while you are probably familiar with the .profile or .bash_profile files in your home directory. These files are used to set environmental items for a users shell. Items such as umask, and variables such as PS1 or PATH.

The /etc/profile file is not very different however it is used to set system wide...

0 0

RVM creates a script in /etc/profile.d, which is being sourced on startup. Also, most people put the RVM sourcing line required to load RVM in their ~/.bash_profile. Ubuntu on Windows runs Bash as a non-login shell, therefore skipping /etc/profile* and executing only the user's ~/.bashrc. This means that RVM doesn't load.

For RVM to work properly, you have to add it to the ~/.bashrc depending on the type of your installation:

single-user installed in ~/.rvm/

echo 'source ~/.rvm/scripts/rvm' >> ~/.bashrc

multi-user installed in /usr/local/rvm

echo 'source /usr/local/rvm/scripts/rvm' >> ~/.bashrc

From this time it should work fine whenever you open the new bash...

0 0

I, too, wondered why Debian had no /etc/profile.d. I did some research, and the argument goes back more than ten years. In the meantime, all the other distributions implemented this five-line feature. It's useful, it works, everyone does it, so why not?

Section 9.9 of the Debian Policy


A program must not depend on environment variables to get reasonable

defaults. (That's because these environment variables would have to

be set in a system-wide configuration file like `/etc/profile', which

is not supported by all shells.)

If a program usually depends on environment variables for its
configuration, the program should be changed to fall back to a
reasonable default configuration if these environment variables are
not present. If this cannot be done easily (e.g., if the source code
of a non-free program is not available), the program must be replaced
by a small "wrapper" shell script which sets...

0 0
[Bug 1406980] [NEW] /etc/profile does not get sourced when logging into a terminal window hufemj 1406980 at bugs.launchpad.net
Thu Jan 1 19:54:44 UTC 2015 Public bug reported: I wanted to change the command prompt and so made the following change within /etc/bash.bashrc: #PS1='${debian_chroot:+($debian_chroot)}\u@\h:\w\$ ' PS1='${debian_chroot:+($debian_chroot)}\h:\w\$ ' When a terminal window is opened, the prompt is unchanged from the original. If I reboot, login and again open a terminal window the prompt is still unchanged. However, manually executing the following from the terminal window changes the prompt as desired: source /etc/profile It seems that /etc/profile is not automatically run when the terminal window is first opened. >From the documentation I've seen (https://help.ubuntu.com/community/EnvironmentVariables, http://bencane.com/2013/09/16/understanding-a-little-more-about- etcprofile-and-etcbashrc/ and other posts), /etc/bash.bashrc should be executed...
0 0

On another related question... the user is also complaining about ownership
of files and directories. Couldn't I just solve that problem with a sticky
bit, i.e. chmod -R u+s * and chmod -R g+s *?

possibly; although you can also screw things up pretty well if

the user has done something like.. mkdir x; cd x ; ln -sf /etc


Ok. Crap I hope not. I just did this. Should've waited for some advice. The

sites are still up so I guess that's a good sign. Still I hope nothing too

bad happened!

And as mentioned I have only one umask set in /etc/profile

[root at qa_hostapps]# grep umask /etc/profile
umask 0002

but /etc/profile isn't the only thing that bash calls/uses (at least not

by default)

what do you get if you do a 'egrep umask /etc/*' ?
and in the home dir, what do you get from egrep umask .??* ?

This is what I have.. although I think everything I...

0 0

I have actually found for those who do not like to fully restart their boxes unless it is absolutely required the following...

You do not need to restart the whole machine to have changes to /etc/profile take effect. All you need is to have your XWindows Desktop GUI restart so it re-reads configs (as it would if it were to be started as part of a system-wide restart).

For me I use xUbuntu which uses LightDM but you can sub in whatever executable calls your current desktop.

First, you can not use a terminal emulator from inside the desktop GUI itself to do this (at least not with LightDM) you need to either use SSH or a secondary console (if you hold Ctrl + Alt and hit an F Key or number key you should drop away from your graphical desktop login or screen to a plain terminal window). I also suggest you close out any remote desktop stuff like VNC if you are using SSH (obviously SSH can be connected you just do not want an open VNC window to be polling display 0...

0 0

The -l flag to sh is supposed to source the contents of /etc/profile and other profile scripts like ~/.profile, which generally provide the initial set of environment variables for a login session.

With that in mind, I run the command env -i sh -l -c env and expect to see a fresh environment plus the changes made by /etc/profile. However, /etc/profile is never sourced, despite this being the supposed behaviour of the -l flag. On other non-MacOS systems, this -l flag causes /etc/profile to be loaded correctly.

Why does this not work on MacOS, and how can I ensure that the profile scripts are correctly sourced in the right order as they would be on login? (Note that I do not want an interactive shell...

0 0

# System wide environment and startup programs, for login setup
# Functions and aliases go in /etc/bashrc

pathmunge () {
if ! echo $PATH | /bin/egrep -q "(^|:)$1($|:)" ; then
if [ "$2" = "after" ] ; then

# Path manipulation
# if [ "$EUID" = "0" ]; then
for i in $(id -n -G);do
if [ "$i" = "wheel" ]; then
pathmunge /sbin
pathmunge /usr/sbin
pathmunge /usr/local/sbin

# ksh workaround
if [ -z "$EUID" -a -x /usr/bin/id ]; then
EUID=`id -u`
UID=`id -ru`

# No core files by default
ulimit -S -c 0 > /dev/null 2>&1

if [ -x /usr/bin/id ]; then
USER="`id -un`"


if [ -z "$INPUTRC" -a ! -f "$HOME/.inputrc" ]; then

0 0

But shouldn't it have been sourced during the graphical login?

There's a minor debate about that on which some graphical logins take an unusual stance...

I add $HOME/bin to $PATH from ~/.profile. However, it seems it is not sourced during login. I use a login manager - lxdm I think

Correct. Most DM's do read ~/.profile when you log in. However, they must do this explicitly, since ~/.profile is traditionally sourced by login shells and a DM (GUI login) is not a shell!

Which is the justification I have seen from the lightdm people for not sourcing ~/.profile explicitly -- because a DM is not a shell.

You can source ~/.profile yourself from ~/.xsession -- see...

0 0

Provide means to handle user environment configuration

At the moment there's no good answer for users who want to set
environment variables for their session. Users have in the past used
their .bashrc or .bash_profile to accomplish this task, but sourcing
a tower of shell scripts at login time is suboptimal, so wayland
sessions aren't run through a login shell.

Some distributions use pam_env, but the way it's set up from distro to
distro varies, and its file format is strange.

See https://bugzilla.gnome.org/show_bug.cgi?id=736660

Furthermore, services themselves may want to affect the user session
environment. flatpak, for instance, needs to modify XDG_DATA_DIRS to
work correctly. There's no good way to achieve this at the moment.

See alexlarsson/xdg-app#147

This patchset tries to solve the problem in systemd by:

Augmenting the DefaultEnvironment option of user.conf to have a new

0 0

Yes I am sure that I have the necessary perl package installed on my system:

vendion ~ $ grep PATH /etc/profile PATH="/usr/local/bin:/usr/bin:/bin:/usr/local/sbin:/usr/sbin:/sbin:/usr/bin/core_perl:/usr/bin/site_perl:/usr/bin/vendor_perl:$HOME/bin" export PATH unset MANPATH vendion ~ $ echo $PATH /usr/local/bin:/usr/bin:/bin:/usr/local/sbin:/usr/sbin:/sbin:/usr/bin/core_perl:/usr/bin/site_perl:/usr/bin/vendor_perl:/home/vendion/bin vendion ~ $ pacman -Q | grep perl cairo-perl 1.061-4 glib-perl 1.223-3 gtk2-perl 1.222-3 pango-perl 1.221-4 perl 5.14.2-2 perl-algorithm-diff 1.1902-4 perl-alien-wxwidgets 0.52-1 perl-app-cpanminus 1.4008-1 perl-class-adapter 1.07-1 perl-class-data-inheritable 0.08-4 perl-class-inspector 1.25-1 perl-class-unload 0.07-1 perl-class-xsaccessor 1.12-1 perl-clone 0.31-3 perl-common-sense 3.4-1 perl-cpanplus-dist-arch 1.19-1 perl-dbd-sqlite 1.31-2 perl-dbi 1.616-2 perl-debug-client 0.12-1 perl-devel-dumpvar 1.05-1 perl-devel-refactor 0.05-1...
0 0