If you login using the console (and then startx), all the environment variables are OK. If you use a graphical login at startup (kdm in my case) (with rc-update add xdm default), then the environment variables are different from what it should have been. For example, I don't have java or qt in my path if I login with kdm, which is quite annoying (eg: java doesn't work in konqueror if I login with kdm). Here are the output of the "export" command in the different cases. ----My environment variables when I login with a console---- declare -x CLASSPATH="/opt/sun-jdk-1.4.0/jre/lib/rt.jar" declare -x CVS_RSH="ssh" declare -x DBCONFIG="/home/cedric/.adabas/sql" declare -x DBROOT="/home/cedric/.adabas" declare -x DBWORK="/home/cedric/.adabas/sql" declare -x EDITOR="/usr/bin/nano" declare -x HOME="/home/cedric" declare -x HOSTNAME="c02.lan" declare -x INFODIR="/usr/share/info:/usr/X11R6/info" declare -x INPUTRC="/etc/inputrc" declare -x JAVAC="/opt/sun-jdk-1.4.0/bin/javac" declare -x JAVA_HOME="/opt/sun-jdk-1.4.0" declare -x JDK_HOME="/opt/sun-jdk-1.4.0" declare -x KDEDIR="/usr/kde/3" declare -x LD_LIBRARY_PATH="/home/cedric/.adabas/lib:" declare -x LESSOPEN="|lesspipe.sh %s" declare -x LOGNAME="cedric" declare -x LS_COLORS="no=00:fi=00:di=01;34:ln=01;36:pi=40;33:so=01;35:do=01;35:bd=40;33;01:cd=40;33;01:or=40;31;01:ex=01;32:*.tar=01;31:*.tgz=01;31:*.arj=01;31:*.taz=01;31:*.lzh=01;31:*.zip=01;31:*.z=01;31:*.Z=01;31:*.gz=01;31:*.bz2=01;31:*.deb=01;31:*.rpm=01;31:*.jpg=01;35:*.gif=01;35:*.bmp=01;35:*.ppm=01;35:*.tga=01;35:*.xbm=01;35:*.xpm=01;35:*.tif=01;35:*.png=01;35:*.mpg=01;35:*.avi=01;35:*.fli=01;35:*.gl=01;35:*.dl=01;35:" declare -x MAIL="/var/mail/cedric" declare -x MANPATH="/usr/share/man:/usr/X11R6/man:/usr/qt/3/man" declare -x MOZILLA_FIVE_HOME="/usr/lib/mozilla" declare -x OLDPWD declare -x PAGER="/usr/bin/less" declare -x PATH="/home/cedric/.adabas/bin:/home/cedric/.adabas/pgm:/bin:/usr/bin:/usr/local/bin:/opt/Acrobat5:/opt/opera/bin:/usr/X11R6/bin:/opt/sun-jdk-1.4.0/bin:/opt/sun-jdk-1.4.0/jre/bin:/usr/qt/3/bin:/usr/kde/3/bin:/usr/kde/3/bin" declare -x PS1="\\[\\033[01;32m\\]\\u@\\h \\[\\033[01;34m\\]\\W \\\$ \\[\\033[00m\\]" declare -x PWD="/home/cedric" declare -x QMAKESPEC="linux-g++" declare -x QTDIR="/usr/qt/3" declare -x SANE_CONFIG_DIR="/etc/sane.d" declare -x SGML_CATALOG_FILES="/etc/sgml/sgml-docbook.cat:/etc/sgml/openjade-1.3.1.cat:/etc/sgml/sgml-docbook-3.1.cat:/etc/sgml/dsssl-docbook-stylesheets.cat" declare -x SHELL="/bin/bash" declare -x SHLVL="1" declare -x TERM="linux" declare -x USER="cedric" declare -x VIMRUNTIME="/usr/share/vim/vim61" declare -x XINITRC="/etc/X11/xinit/xinitrc" ----My environment variables when I login with a console and then startx---- declare -x CLASSPATH="/opt/sun-jdk-1.4.0/jre/lib/rt.jar" declare -x COLORTERM="" declare -x CVS_RSH="ssh" declare -x DBCONFIG="/home/cedric/.adabas/sql" declare -x DBROOT="/home/cedric/.adabas" declare -x DBWORK="/home/cedric/.adabas/sql" declare -x DISPLAY=":0.0" declare -x EDITOR="/usr/bin/nano" declare -x GS_LIB="/home/cedric/.kde3/share/fonts" declare -x GTK_RC_FILES="/etc/gtk/gtkrc:/home/cedric/.gtkrc:/home/cedric/.gtkrc-kde" declare -x HOME="/home/cedric" declare -x HOSTNAME="c02.lan" declare -x INFODIR="/usr/share/info:/usr/X11R6/info" declare -x INPUTRC="/etc/inputrc" declare -x JAVAC="/opt/sun-jdk-1.4.0/bin/javac" declare -x JAVA_HOME="/opt/sun-jdk-1.4.0" declare -x JDK_HOME="/opt/sun-jdk-1.4.0" declare -x KDEDIR="/usr/kde/3" declare -x KDEDIRS="/usr/kde/3:" declare -x KDEHOME="/home/cedric/.kde3" declare -x KDEMAINDIR="/usr/kde/3" declare -x KDE_MULTIHEAD="false" declare -x KONSOLE_DCOP="DCOPRef(konsole-16878,konsole)" declare -x KONSOLE_DCOP_SESSION="DCOPRef(konsole-16878,session-1)" declare -x LD_LIBRARY_PATH="/home/cedric/.adabas/lib:/home/cedric/.adabas/lib:" declare -x LESSOPEN="|lesspipe.sh %s" declare -x LOGNAME="cedric" declare -x LS_COLORS="no=00:fi=00:di=01;34:ln=01;36:pi=40;33:so=01;35:do=01;35:bd=40;33;01:cd=40;33;01:or=40;31;01:ex=01;32:*.tar=01;31:*.tgz=01;31:*.arj=01;31:*.taz=01;31:*.lzh=01;31:*.zip=01;31:*.z=01;31:*.Z=01;31:*.gz=01;31:*.bz2=01;31:*.deb=01;31:*.rpm=01;31:*.jpg=01;35:*.gif=01;35:*.bmp=01;35:*.ppm=01;35:*.tga=01;35:*.xbm=01;35:*.xpm=01;35:*.tif=01;35:*.png=01;35:*.mpg=01;35:*.avi=01;35:*.fli=01;35:*.gl=01;35:*.dl=01;35:" declare -x MAIL="/var/mail/cedric" declare -x MANPATH="/usr/share/man:/usr/X11R6/man:/usr/qt/3/man" declare -x MOZILLA_FIVE_HOME="/usr/lib/mozilla" declare -x OLDPWD declare -x PAGER="/usr/bin/less" declare -x PATH="/home/cedric/.adabas/bin:/home/cedric/.adabas/pgm:/usr/kde/3/bin:/home/cedric/.adabas/bin:/home/cedric/.adabas/pgm:/bin:/usr/bin:/usr/local/bin:/opt/Acrobat5:/opt/opera/bin:/usr/X11R6/bin:/opt/sun-jdk-1.4.0/bin:/opt/sun-jdk-1.4.0/jre/bin:/usr/qt/3/bin:/usr/kde/3/bin:/usr/kde/3/bin" declare -x PWD="/home/cedric" declare -x QMAKESPEC="linux-g++" declare -x QTDIR="/usr/qt/3" declare -x SANE_CONFIG_DIR="/etc/sane.d" declare -x SESSION_MANAGER="local/c02.lan:/tmp/.ICE-unix/16865" declare -x SGML_CATALOG_FILES="/etc/sgml/sgml-docbook.cat:/etc/sgml/openjade-1.3.1.cat:/etc/sgml/sgml-docbook-3.1.cat:/etc/sgml/dsssl-docbook-stylesheets.cat" declare -x SHELL="/bin/bash" declare -x SHLVL="5" declare -x TERM="xterm" declare -x USER="cedric" declare -x VIMRUNTIME="/usr/share/vim/vim61" declare -x XAUTHORITY="/home/cedric/.Xauthority" declare -x XINITRC="/etc/X11/xinit/xinitrc" ----My environment variables when I login with kdm---- declare -x COLORTERM="" declare -x DBCONFIG="/home/cedric/.adabas/sql" declare -x DBROOT="/home/cedric/.adabas" declare -x DBWORK="/home/cedric/.adabas/sql" declare -x DISPLAY=":0.0" declare -x GS_LIB="/home/cedric/.kde3/share/fonts" declare -x GTK_RC_FILES="/etc/gtk/gtkrc:/home/cedric/.gtkrc:/home/cedric/.gtkrc-kde" declare -x HOME="/home/cedric" declare -x KDEDIR="/usr/kde/3" declare -x KDEDIRS="/usr/kde/3:" declare -x KDEHOME="/home/cedric/.kde3" declare -x KDEMAINDIR="/usr/kde/3" declare -x KDE_MULTIHEAD="false" declare -x KONSOLE_DCOP="DCOPRef(konsole-17044,konsole)" declare -x KONSOLE_DCOP_SESSION="DCOPRef(konsole-17044,session-1)" declare -x LD_LIBRARY_PATH="/home/cedric/.adabas/lib:" declare -x LOGNAME="cedric" declare -x OLDPWD declare -x PATH="/home/cedric/.adabas/bin:/home/cedric/.adabas/pgm:/usr/kde/3/bin:/bin:/usr/bin:/usr/X11R6/bin:/usr/local/bin" declare -x PWD="/home/cedric" declare -x SESSION_MANAGER="local/c02.lan:/tmp/.ICE-unix/17031" declare -x SHELL="/bin/bash" declare -x SHLVL="3" declare -x TERM="xterm" declare -x USER="cedric" declare -x XDM_MANAGED="/var/run/xdmctl/xdmctl-:0,maysd,mayfn,sched" declare -x XSESSION="kde-3.0.2"
Ok. In fact. Take a look at this bug: http://bugs.gentoo.org/show_bug.cgi?id=5629 It is related. :)
You have found the same bug as I, but in my case I have a shell (bash) specified in my /etc/passwd. I always use the "useradd" command with the "-s" option.
Now right click in the gnome terminal, and check "run as login command" or similar under preferences/"edit current profile". If KDE, start konsole with "konsole -l" i think.
Hi, azarah it is not a fix... :) the problem is in the SHELL variable no exported correctly. Anyway, i cannot do what you said, cos the gnome-terminal closes itself a a couple of seconds, so i dont have time to do wut u said. Anyway i'll keep on investigating... bye
I did some testing of my own. This is only true if no shell is defined in /etc/passwd. That still do not really change the fact that you need one defined =) It may bring us to the question why adduser do not add a shell by default ... security maybe (as you dont want a valid shell for daemons, etc and the system should not assume stuff. Also the pam_shell.so module is an interesting one ...)?
Excuse me but what are you talking about? The problem is definitely not a missing shell in the /etc/passwd file. I have one specified (with useradd -s /bin/bash). The problem is when you login via kdm instead of the console (text mode). Look at the description I wrote, you'll see that the environment variables aren't set properly with a kdm login.
Comment #5 was more for Mauro Sciaccaluga. I know your variables is different .. it is because the terminal is not started as a LOGIN shell. Now read above (comment #3) how to do that, or ask a KDE/Gnome expert in #gentoo.
OK I understand what you say :-) ... but I still think the problem I reported persists. Why? Because I first noticed the problem when konqueror couldn't start java for a web page, or Qt Assistant refused to start, although I had launched these applications using the icons in kde. So you're solution is to open a terminal as a LOGIN shell (as I understand) and start my app within this terminal instead of using the icons???
azarah: this bug still persists, it is not resolved!! The problem is not ADDUSER. As I already told you, if you do an adduser and you try to login with the simple console login the SHELL variable is set (even if in /etc/passwd isnt) to a default /bin/sh, but if you login with a grphical login manager like gdm or kdm, the SHELL environment is not being pointed to a default /bin/sh like the simple LOGIN does. Can u understand me? So the bug is not resolved at all :)
>>azarah: The bug is not resolved at all ! You can read all I wrote and especially the comment 8 (http://bugs.gentoo.org/show_bug.cgi?id=5699#c8) and you'll see that it has _nothing_ to do with adduser. So please reopen this bug!
OK, OK, so maybe I was a bit hasty when I closed it :P It basically is because a "login" never occurs. Now, In a perfect world you would expect gdm/kdm to do a "login", but they never do. This is why /etc/profile do not get sourced. If you thus do not have a shell set in /etc/passwd, then your $SHELL will be missing. You need one. As for the rest of the env variables ... must admit I do not have the official answer on this. I just still think it is bad to always source it in .bashrc. Another way could be to change the first lines of the Session files in /etc/X11/Sessions/ from: #!/bin/sh to: #!/bin/sh --login Although it is not the best one out there.
I changed the first line of /etc/X11/Sessions/kde-3.0.2 from #!/bin/sh to #!/bin/sh --login and my problems are gone! Thank you azarah! But as you said it seems more like a hack than a fix. So don't close this bug too quickly ;-)
Dan, this is not the first bug that suggest the "--login" part to our Session files. Thoughts against making it default ?
Similar bugs: http://bugs.gentoo.org/show_bug.cgi?id=4313 http://bugs.gentoo.org/show_bug.cgi?id=4955 http://bugs.gentoo.org/show_bug.cgi?id=5629 http://bugs.gentoo.org/show_bug.cgi?id=5683 http://bugs.gentoo.org/show_bug.cgi?id=5699 everyone has something diff to say ... think it should all be wrapped up and put into 1 bundle though ;)
The startkde script already has bash --login as its interpreter. So I don't quite understand why adding it to the seession file too would change anything? A KDE session is already a login one (and for konsole you have to run it as konsole -ls regardless of kde's environment). But I have to admit I haven't read through all the comments... Anyway I don't see any reason not to do it, it should be ok afaics.
*** Bug 4955 has been marked as a duplicate of this bug. ***
Ok... but wut about GDM? :)
Same thing. Add to whatever you use in /etc/X11/Sessions/ a '--login'
Changed the shell for /etc/X11/xdm/Xsession and /etc/X11/gdm/PreSession/Default to "/bin/bash --login". Please check the ChangeLogs, and then remerge them (xfree-4.2.1-r2, gdm).
*** Bug 13579 has been marked as a duplicate of this bug. ***
Ok, I disagree with this thread in general. Adding --login left and right may work, but it doesn't solve the original problem: the scripts should be setup such that the non-login scripts (e.g. csh.cshrc) setup everything that's needed for a non-login shell to function properly. I haven't looked at the bash scripts, but at least the tcsh scripts that come with gentoo (csh.cshrc and csh.login) are in need of a serious overhaul. Take a look at how RedHat and SuSE handle this to see what I mean.