Bug #2617
/etc/profile could use modernisation
0%
Description
In particular, /usr/sbin/quota gets called by default, which on a system with many ZFS filesystems delays the login quite considerably with potentially a very large amount of this type of thing:
http://pastie.org/private/kifzpr4ps6d9fw2iiszqma
On this particular box it adds an additional 5-10 seconds to the login time.
On systems where ZFS is misbehaving (such as if an iSCSI mount has gone away) it can prevent logging in at all (workaround: ssh -t).
Quotas are usually implemented in mutli-user environments such as Universities or corporate desktop environments, however I imagine the vast majority of OI installs are single user or on servers, where user-level quotas aren't implemented. Where quotas are used, they'll be with ZFS for shares.
So I am proposing we comment out /usr/sbin/quota (or in some way disable it by default). We should cater for the majority rather than a minority who can easily re-add it if desired.
Also the following looks a little bit dated to me:
if [ "$TERM" = "" ] then if /bin/i386 then TERM=sun-color else TERM=sun fi export TERM fi
The top of the file could also be revamped with the new CDDL.
Related issues
Updated by Jim Klimov over 8 years ago
We have a number of customizations in /etc/profile which can be generally useful; we distribute the file on our systems with an administration package.
Please do not make the mistake already done with default userhome "~/.profile" - needlessly limiting it to only bash syntax with "export VAR=VALUE". The same can be done in two lines but is much more portable ;)
Main goodies are:
1) Include PATHs for most common locations:
### set our default PATH ### YMMV PATH=\ /bin:\ /sbin:\ /usr/bin:\ /usr/sbin:\ /usr/ccs/bin:\ /usr/ccs/sbin:\ /usr/local/bin:\ /usr/local/sbin:\ /opt/sfw/bin:\ /opt/sfw/sbin:\ /usr/sfw/bin:\ /usr/sfw/sbin:\ /usr/gnu/bin:\ /usr/gnu/sbin:\ /opt/gnu/bin:\ /opt/gnu/sbin:\ /usr/dt/bin:\ /usr/dt/sbin:\ /usr/openwin/bin:\ /usr/openwin/sbin:\ /opt/SUNWut/bin:\ /opt/SUNWut/sbin:\ /opt/COSac/bin:\ /opt/COSas/bin export PATH MANPATH=\ /usr/share/man:\ /man:\ /usr/man:\ /usr/ccs/man:\ /usr/local/man:\ /opt/sfw/man:\ /usr/sfw/man:\ /usr/gnu/man:\ /opt/gnu/man:\ /usr/dt/man:\ /usr/openwin/man:\ /opt/SUNWut/man export MANPATH LD_LIBRARY_PATH=\ /lib:\ /usr/lib:\ /usr/ccs/lib:\ /usr/local/lib/`isainfo -n`:\ /usr/local/lib:\ /usr/local/lib/64:\ /usr/local/lib/sparcv9:\ /usr/local/lib/amd64:\ /opt/sfw/lib/`isainfo -n`:\ /opt/sfw/lib:\ /opt/sfw/lib/64:\ /opt/sfw/lib/sparcv9:\ /opt/sfw/lib/amd64:\ /usr/sfw/lib/`isainfo -n`:\ /usr/sfw/lib:\ /usr/sfw/lib/64:\ /usr/sfw/lib/sparcv9:\ /usr/sfw/lib/amd64:\ /usr/gnu/lib/`isainfo -n`:\ /usr/gnu/lib:\ /usr/gnu/lib/64:\ /usr/gnu/lib/sparcv9:\ /usr/gnu/lib/amd64:\ /opt/gnu/lib/`isainfo -n`:\ /opt/gnu/lib:\ /opt/gnu/lib/64:\ /opt/gnu/lib/sparcv9:\ /opt/gnu/lib/amd64:\ /usr/dt/lib:\ /usr/openwin/lib:\ /usr/local/ssl/lib:\ /var/opt/SUNWappserver/lib export LD_LIBRARY_PATH
2) Set a valid JAVA_HOME:
### Set Java Home; customized values first (may be newer JVMs) for D in \ /opt/java \ /opt/jdk/default \ /opt/jdk/latest \ /opt/jdk \ /usr/java \ /usr/jdk/default \ /usr/jdk/latest \ /usr \ ; do [ x"$JAVA_HOME" = x -a -d "$D/bin" -a -x "$D/bin/java" ] && \ JAVA_HOME="$D" done ### Prepend $JAVA_HOME/bin to PATH if [ x"$JAVA_HOME" != x -a -d "$JAVA_HOME/bin" -a -x "$JAVA_HOME/bin/java" ]; then export JAVA_HOME PATH=${JAVA_HOME}/bin:${PATH} fi
3) rsync/scp-compatible shell prompt:
### Set shell prompt; under 'sh' will be literally '\w' _USERID=`id | sed 's/uid=\([^(]*\)(.*$/\1/'` _USERNAME=`id | sed 's/uid=[^(]*(\([^)]*\).*$/\1/'` [ x"$_USERID" = x0 ] && _UP='#' || _UP='$' PS1="[$_USERNAME@"`hostname`":\w]$_UP " export PS1 unset _USERID _USERNAME _UP
4) OPTIONAL: Disable corefiles for typical users (there's also coreadm, etc.)
### Disable core files per default ulimit -c 0
5) Perhaps the most useful feature - include optional local common profile customizations:
### Local overrides may be available (proxy servers, local paths, etc)... for F in /etc/profile.* /etc/profile-* /etc/profile.d/*; do if [ -s "$F" -a -f "$F" -a -r "$F" ]; then echo "/etc/profile: Sourcing '$F' ..." . "$F" fi done
Updated by Alasdair Lumsden over 8 years ago
Hi Jim,
Thanks for the feedback but I'm afraid the suggestions you've made above are more of a site-local preference type thing. We'll only be making minor adjustments to /etc/profile as this heavily affects all our users.
I'd also strongly advise against using the LD_LIBRARY_PATH definition you've put above - that will cause all kinds of strangeness with binaries picking up libraries from random locations. It's better to build software with the linker flag -R to set the runtime path for the binary you're building. If LD_LIBRARY_PATH is to be used at all, it should be used in a shell/startup script wrapping a particular binary, and only including specific directories. It should never ever be set globally.
Cheers,
Alasdair
Updated by Jim Klimov over 8 years ago
Well, that's your choice not to include this by default, and others' choice to pick that up into their systems if they like :)
Regarding customizations of /etc/profile, I'd provide the include-block (perhaps only for /etc/profile.d/*) by default, so that /etc/system can be considered OS-owned and overwritable any time without killing local tweaks. For example, packages which provide manpages to a non-standard location for some reason, could plug a file into that directory so their help files are found by default.
And maybe the default JAVA_HOME setting as many Java programs like that to be valid :)
Thanks for the hint about LD_LIBRARY_PATH. As for the /bin/ and */sbin/ PATHs, many Solaris programs are dispersed all over the place, and many of them are useful daily. That's why LD_LIBRARY_PATH got here in the first place - many SMC (SunFreeWare) programs needed their libs from /usr/local/lib... the ball rolled on since then =)
Updated by Michal Nowak over 1 year ago
Some of the modernization requested happened. I don't see any open bugs for ZFS quota, so I am tempted to close this.