You are not logged in.

#1 2011-10-31 14:48:15

vendion
Member
From: Tennessee, USA
Registered: 2010-03-10
Posts: 204
Website

[solved] Scripts under /etc/profile.d not being sourced

On multiple machines I have realized that the scripts under /etc/profile.d directory are not automatically being source, this doesn't seem to be terminal related because I have seen it happen in both Xterm and urxvt, both using BASH shell.  The two scripts that I have noticed this happening to are /etc/profile.d/go.sh and /etc/profile.d/perlbin.sh (I'm sure the others aren't being source as well but I have not noticed), if I manually source the files the environmental variables are only set for the terminal session.  Looking at /etc/profile I can see where it references the scripts but I don't think that is having any effect.

Last edited by vendion (2011-11-01 00:00:18)

Offline

#2 2011-10-31 16:14:33

ybyygu
Member
From: Shanghai, China
Registered: 2011-09-18
Posts: 4

Re: [solved] Scripts under /etc/profile.d not being sourced

try source /etc/profile in .bashrc

there are lines in /etc/profile for reading profile.d

# Load profiles from /etc/profile.d
if test -d /etc/profile.d/; then
    for profile in /etc/profile.d/*.sh; do
        test -r "$profile" && . "$profile"
    done
    unset profile
fi

Offline

#3 2011-10-31 18:20:22

vendion
Member
From: Tennessee, USA
Registered: 2010-03-10
Posts: 204
Website

Re: [solved] Scripts under /etc/profile.d not being sourced

/etc/profile itself is being read and parsed because changes to the PATH variable there do work, to work around /etc/profile.d/perlbin.sh not being read my PATH variable in /etc/profile looks like this:

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"

The problem is this doesn't seem to be reading the profile.d settings like it should:

# Load profiles from /etc/profile.d
if test -d /etc/profile.d/; then
	for profile in /etc/profile.d/*.sh; do
		test -r "$profile && . $profile"
	done
	unset profile
fi

Offline

#4 2011-10-31 19:19:44

Leonid.I
Member
From: Aethyr
Registered: 2009-03-22
Posts: 999

Re: [solved] Scripts under /etc/profile.d not being sourced

No problem here (note core_perl and absence of site_perl):

$ echo $PATH
/usr/local/bin:/usr/bin:/bin:/usr/bin/core_perl:/home/lisaev/scripts
$ gr PATH /etc/profile
PATH="/usr/local/bin:/usr/bin:/bin:/usr/local/sbin:/usr/sbin:/sbin"
export PATH
unset MANPATH
$ pacman -Q | gr perl
perl 5.14.2-2
perl-xml-parser 2.41-1
perl-xml-simple 2.18-3

Have a look at perlbin.sh. Are you sure you have necessary perl pkg installed?


Arch Linux is more than just GNU/Linux -- it's an adventure
pkill -9 systemd

Offline

#5 2011-10-31 20:30:58

vendion
Member
From: Tennessee, USA
Registered: 2010-03-10
Posts: 204
Website

Re: [solved] Scripts under /etc/profile.d not being sourced

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
perl-devel-stacktrace 1.26-1
perl-digest-hmac 1.03-1
perl-digest-sha1 2.13-2
perl-encode-locale 1.02-1
perl-error 0.17016-2
perl-exception-class 1.32-1
perl-extutils-parsexs 2.2206-1
perl-extutils-xspp 0.1601-1
perl-file-copy-recursive 0.38-1
perl-file-find-rule 0.32-1
perl-file-homedir 0.98-1
perl-file-listing 6.03-1
perl-file-next 1.06-1
perl-file-pushd 1.001-1
perl-file-remove 1.50-1
perl-file-sharedir 1.03-1
perl-file-slurp 9999.19-1
perl-file-which 1.09-2
perl-format-human-bytes 0.06-1
perl-hook-lexwrap 0.24-1
perl-html-parser 3.68-2
perl-html-tagset 3.20-2
perl-http-cookies 6.00-1
perl-http-daemon 6.00-1
perl-http-date 6.00-1
perl-http-message 6.02-1
perl-http-negotiate 6.00-1
perl-io-socket-ssl 1.44-1
perl-io-string 1.08-7
perl-ipc-run 0.84-2
perl-ipc-run3 0.044-1
perl-json-xs 2.32-1
perl-libwww 6.02-2
perl-list-moreutils 0.33-1
perl-locale-gettext 1.05-7
perl-locale-msgfmt 0.15-1
perl-lwp-mediatypes 6.01-1
perl-mail-spf 2.007-2
perl-module-build 0.3800-1
perl-module-manifest 1.08-1
perl-module-refresh 0.17-1
perl-net-dns 0.66-4
perl-net-http 6.01-1
perl-net-ip 1.25-4
perl-net-ssleay 1.42-1
perl-netaddr-ip 4.037-2
perl-number-compare 0.01-3
perl-orlite 1.48-1
perl-padre 0.90-1
perl-params-util 1.04-1
perl-parse-errorstring-perl 0.15-1
perl-parse-exuberantctags 1.02-1
perl-path-class 0.24-1
perl-pod-abstract 0.19-1
perl-pod-perldoc 3.15-3
perl-pod-pom 0.27-1
perl-pod2-base 0.043-1
perl-ppi 1.215-1
perl-ppix-editortools 0.15-1
perl-ppix-regexp 0.021-1
perl-probe-perl 0.01-2
perl-readonly 1.03-2
perl-readonly-xs 1.05-1
perl-sub-uplevel 0.22-1
perl-task-weaken 1.04-1
perl-template-tiny 1.12-1
perl-test-deep 0.108-1
perl-test-differences 0.61-1
perl-test-exception 0.31-1
perl-test-harness 3.21-1
perl-test-mockobject 1.20110612-1
perl-test-most 0.25-1
perl-test-nowarnings 1.03-1
perl-test-object 0.07-1
perl-test-pod 1.45-1
perl-test-script 1.07-2
perl-test-subcalls 1.09-1
perl-test-tester 0.107-2
perl-test-warn 0.23-1
perl-text-balanced 2.02-1
perl-text-csv 1.20-2
perl-text-diff 1.41-1
perl-text-findindent 0.10-1
perl-text-glob 0.08-3
perl-tree-dag-node 1.06-2
perl-universal-can 1.20110617-1
perl-universal-isa 1.20110614-1
perl-uri 1.59-1
perl-www-robotrules 6.01-1
perl-wx 0.98-1
perl-wx-perl-processstream 0.30-1
perl-xml-parser 2.41-1
perl-xml-simple 2.18-3
perl-yaml-syck 1.17-2
perl-yaml-tiny 1.50-1

Here is what my perlbin.sh script looks like

vendion ~ $ cat /etc/profile.d/perlbin.sh
# Set path to perl scriptdirs if they exist
# https://wiki.archlinux.org/index.php/Perl_Policy#Binaries_and_Scripts
# Added /usr/bin/*_perl dirs for scripts
# Remove /usr/lib/perl5/*_perl/bin in next release

[ -d /usr/bin/site_perl ] && PATH=$PATH:/usr/bin/site_perl


[ -d /usr/bin/vendor_perl ] && PATH=$PATH:/usr/bin/vendor_perl


[ -d /usr/bin/core_perl ] && PATH=$PATH:/usr/bin/core_perl

export PATH

# If you have modules in non-standard directories you can add them here.
#export PERLLIB=dir1:dir2

Yes I went head and removed all the old /usr/lib/perl5/*_perl paths but that would not cause /etc/profile.d/ scripts to load.

Other /etc/profile.d scripts that are not loading:

1.  glib2.sh
2.  go.sh
3.  lesspipe.sh
4.  locale.sh
5.  mozilla-common.sh
6.  openjdk6.sh
7.  xorg.sh

That means every BASH shell script in /etc/profile.d is not loading

Last edited by vendion (2011-10-31 20:39:58)

Offline

#6 2011-10-31 20:44:08

vendion
Member
From: Tennessee, USA
Registered: 2010-03-10
Posts: 204
Website

Re: [solved] Scripts under /etc/profile.d not being sourced

@ybyygu: Even explicitly sourcing /etc/profile from .bashrc the scripts don't load

Offline

#7 2011-10-31 22:09:54

Leonid.I
Member
From: Aethyr
Registered: 2009-03-22
Posts: 999

Re: [solved] Scripts under /etc/profile.d not being sourced

In your post when you write:

test -r "$profile && . $profile"

is there a typo with ""? Just to check whether your bash is a login shell, do you see "-bash" in "ps -u <you_user> u"?


Arch Linux is more than just GNU/Linux -- it's an adventure
pkill -9 systemd

Offline

#8 2011-10-31 22:33:06

vendion
Member
From: Tennessee, USA
Registered: 2010-03-10
Posts: 204
Website

Re: [solved] Scripts under /etc/profile.d not being sourced

Well that was a copy&paste from /etc/profile but that could be wrong

But yes there is, here is the exact line

vendion  31948  1.2  0.1  16600  4692 pts/2    Ss   18:31   0:00 -bash

Offline

#9 2011-10-31 22:41:56

Leonid.I
Member
From: Aethyr
Registered: 2009-03-22
Posts: 999

Re: [solved] Scripts under /etc/profile.d not being sourced

vendion wrote:

Well that was a copy&paste from /etc/profile but that could be wrong

What do you mean? That line didn't make any sense. Instead it should be:

test -r "$profile" && . "$profile"

see the quotes?


Arch Linux is more than just GNU/Linux -- it's an adventure
pkill -9 systemd

Offline

#10 2011-10-31 22:50:57

vendion
Member
From: Tennessee, USA
Registered: 2010-03-10
Posts: 204
Website

Re: [solved] Scripts under /etc/profile.d not being sourced

I copied and pasted that from my /etc/profile so that would not be a typo.  I will fix the quotes and see if that fixes it.

EDIT: Fixing the quotes does solve my issue

Last edited by vendion (2011-10-31 22:56:16)

Offline

#11 2011-10-31 23:18:12

Leonid.I
Member
From: Aethyr
Registered: 2009-03-22
Posts: 999

Re: [solved] Scripts under /etc/profile.d not being sourced

Glad I could help, but I would also suggest reinstalling filesystem...


Arch Linux is more than just GNU/Linux -- it's an adventure
pkill -9 systemd

Offline

#12 2011-10-31 23:59:53

vendion
Member
From: Tennessee, USA
Registered: 2010-03-10
Posts: 204
Website

Re: [solved] Scripts under /etc/profile.d not being sourced

Thanks I will take that into consideration

Offline

Board footer

Powered by FluxBB