| View previous topic :: View next topic |
| Author |
Message |
dizzyp n00b

Joined: 13 Nov 2002 Posts: 3 Location: Lillestrøm/Norway
|
Posted: Wed Nov 13, 2002 3:53 pm Post subject: Bash doesn't read the config files right under Gentoo |
|
|
Hi,
I store all my dotfiles using CVS, and have a couple of
shell script to retrieve/update them on different (new) hosts...
I been using RH, Deb, etc + Solaris, and it works allright...
But Gentoo+Bash won't read my ~/.bash_profile & ~/.bashrc
(I suspect it doesn't read /etc/profile either)
(Alas, I have to type "source ~/.bash_profile" on each log on)
Another problem is that the normal bash(emacs) keymapping isn't
working properly; ctrl-a gives me just a control character.
Anyone who know how I can fix this?
Regards,
--dpr |
|
| Back to top |
|
 |
Larde Guru


Joined: 07 Jun 2002 Posts: 313 Location: Duesseldorf, Germany
|
Posted: Wed Nov 13, 2002 5:24 pm Post subject: |
|
|
Are you sure that you shell actually is set to /bin/bash? useradd doesn't set a shell by default in gentoo. So check you /etc/passwd with vipw or just try chsh -s /bin/bash and relogin.
Hth,
Larde. _________________ Someday this will be my home... http://moonage.net/
I'll make you a deal
I'll say I came from Earth and my tongue is taped
|
|
| Back to top |
|
 |
arkane l33t


Joined: 30 Apr 2002 Posts: 918 Location: Phoenix, AZ
|
Posted: Wed Nov 13, 2002 5:58 pm Post subject: |
|
|
I have the same problem, though I've only ran into needing to add things to my own personal preferences as of the last few weeks.
I've resorted to just sourcing the ~/.bash_profile.
Though, thats not a remedy.
cat /etc/passwd | grep -i arkane
gives this:
arkane:x:1000:100::/home/arkane:/bin/bash
I use bash for everything. |
|
| Back to top |
|
 |
rac Bodhisattva


Joined: 30 May 2002 Posts: 6553 Location: Japanifornia
|
Posted: Wed Nov 13, 2002 9:51 pm Post subject: |
|
|
Can people with problems like this post their version of baselayout? _________________ For every higher wall, there is a taller ladder |
|
| Back to top |
|
 |
arkane l33t


Joined: 30 Apr 2002 Posts: 918 Location: Phoenix, AZ
|
Posted: Wed Nov 13, 2002 11:18 pm Post subject: |
|
|
| I just updated to 1.8.4.2 and it went away. |
|
| Back to top |
|
 |
dizzyp n00b

Joined: 13 Nov 2002 Posts: 3 Location: Lillestrøm/Norway
|
Posted: Thu Nov 14, 2002 11:27 am Post subject: Hi, me again... |
|
|
Of course the shell is set to /bin/bash
Got an answer on #gentoo: rename it to ~/.profile,
something that works, but .bash_profile is more standard
name on other distributions/OSes.
Can I use emerge to upgrade the whole lot to the latest version
in an easy way?
--dpr |
|
| Back to top |
|
 |
hook Veteran


Joined: 23 Oct 2002 Posts: 1398 Location: Ljubljana, Slovenia
|
Posted: Thu Nov 14, 2002 2:08 pm Post subject: |
|
|
that's a bit of a turn-off ...this should really be repaired. i mean ~/.profile isn't a standard file for it ... have you reported it to gentoo's bugzilla? (p.s. is there a more direct way of reporting errors?) _________________ tea+free software+law=hook
(deep inside i'm still a tux's little helper) |
|
| Back to top |
|
 |
Larde Guru


Joined: 07 Jun 2002 Posts: 313 Location: Duesseldorf, Germany
|
Posted: Thu Nov 14, 2002 2:33 pm Post subject: |
|
|
| Quote: | | i mean ~/.profile isn't a standard file for it |
Partly correct, it's surely not standard to not read ~/.bash_profile, but it is standard to read ~/.profile never the less.
man bash: "...it looks for ~/.bash_profile, ~/.bash_login, and ~/.profile, in that order, and reads and executes commands from the first one that exists and is readable."
I asked if the shell was really set to /bin/bash before, because if you leave it out to explicitly set it when creating users, it's gonna be /bin/sh which is standard shell, and then the behaviour would be perfectly legal:
man bash: "If bash is invoked with the name sh, it tries to mimic the startup behavior of historical versions of sh as closely as possible, [...] it first attempts to read and execute commands from /etc/profile and ~/.profile, in that order."
Yours,
Larde.
P.S. What was the change in the baselayout package that fixed not reading ~/.bash_profile? _________________ Someday this will be my home... http://moonage.net/
I'll make you a deal
I'll say I came from Earth and my tongue is taped
|
|
| Back to top |
|
 |
hook Veteran


Joined: 23 Oct 2002 Posts: 1398 Location: Ljubljana, Slovenia
|
Posted: Fri Nov 15, 2002 9:48 am Post subject: |
|
|
larde, you're right ...i forgot about that --silly me but it's still a bit odd isn't it?
i really think this should be repaired _________________ tea+free software+law=hook
(deep inside i'm still a tux's little helper) |
|
| Back to top |
|
 |
Larde Guru


Joined: 07 Jun 2002 Posts: 313 Location: Duesseldorf, Germany
|
Posted: Fri Nov 15, 2002 12:19 pm Post subject: |
|
|
Hey, no need to feel silly. I got that .profile thing wrong before myself - I thought it was used only by sh or ksh.
| Quote: | | i really think this should be repaired |
Ah, I thought it was repaired, arkane said:
| Quote: | | I just updated to 1.8.4.2 and it went away. |
I am still interested what actually was the problem, because I didn't experience the bug. I feel curious.
Larde.
Btw, I hope my former comment didn't sound harsh in some way. Sometimes when I read my comments later, I feel they sound like flaming, although they never were meant that way.  _________________ Someday this will be my home... http://moonage.net/
I'll make you a deal
I'll say I came from Earth and my tongue is taped
|
|
| Back to top |
|
 |
AJM n00b


Joined: 25 Sep 2002 Posts: 39 Location: Aberdeen, Scotland
|
Posted: Fri Nov 15, 2002 1:22 pm Post subject: Re: Bash doesn't read the config files right under Gentoo |
|
|
| dizzyp wrote: | | (I suspect it doesn't read /etc/profile either) |
I've experienced something very similar with zsh - if you search this forum for something like "zsh not reading config files in /etc" you'll find my post. I didn't get a lot of feedback, but it could be related. This doesn't happen on ALL my gentoo boxes, just one.... |
|
| Back to top |
|
 |
puddpunk l33t


Joined: 20 Jul 2002 Posts: 681 Location: New Zealand
|
Posted: Mon Nov 18, 2002 9:25 am Post subject: |
|
|
Type this:
If it comes up with "/bin/sh" or "/bin/bash", I know not your problem.
If that variable is empty however, i can help you!
just do this:
| Code: | # echo "\$SHELL=\"/bin/bash\"" >> /etc/env.d/00basic
# env-update |
and that should fix it (fire up another shell to test ) |
|
| Back to top |
|
 |
dizzyp n00b

Joined: 13 Nov 2002 Posts: 3 Location: Lillestrøm/Norway
|
Posted: Mon Nov 18, 2002 10:01 am Post subject: Hi again... |
|
|
| puddpunk wrote: | Type this:
If it comes up with "/bin/sh" or "/bin/bash", I know not your problem.
If that variable is empty however, i can help you!
just do this:
| Code: | # echo "\$SHELL=\"/bin/bash\"" >> /etc/env.d/00basic
# env-update |
and that should fix it (fire up another shell to test ) |
As I said earlier: The shell is set to bash (ie. /bin/bash in /etc/passwd)
...
--dpr _________________ --
--dpr |
|
| Back to top |
|
 |
DamageCo n00b


Joined: 19 Nov 2002 Posts: 5
|
Posted: Tue Nov 19, 2002 8:35 pm Post subject: Re: Bash doesn't read the config files right under Gentoo |
|
|
Are you login with a standard console or with gnome-terminal ?
Is the problem occur in both env ?
I had the same prb with gnome-teminal which was fixed by editing the current profile with the menu. Just set check "Run command as login check" .
Anyway, I have the same prb with the su command. su - user -c "env" never read the dotfiles, but su - user does ! Any explanation for me ?
Hope this help a little bit...
Bye
DamageCo
| dizzyp wrote: | Hi,
I store all my dotfiles using CVS, and have a couple of
shell script to retrieve/update them on different (new) hosts...
I been using RH, Deb, etc + Solaris, and it works allright...
But Gentoo+Bash won't read my ~/.bash_profile & ~/.bashrc
(I suspect it doesn't read /etc/profile either)
(Alas, I have to type "source ~/.bash_profile" on each log on)
Another problem is that the normal bash(emacs) keymapping isn't
working properly; ctrl-a gives me just a control character.
Anyone who know how I can fix this?
Regards,
--dpr |
|
|
| Back to top |
|
 |
gnewbie n00b

Joined: 29 Nov 2002 Posts: 3
|
Posted: Fri Nov 29, 2002 5:50 pm Post subject: A possible solution |
|
|
For all of you who gnome-terminal do not read /etc/profile file at startup, the solution is
1) open gnome-terminal
2) Click Edit>Current Profile>Title & Command
at the sectionWindow title, check box for 'run command as login'
I found the solution at the following post:
http://forums.gentoo.org/viewtopic.php?t=20517
Carles. |
|
| Back to top |
|
 |
jukka Apprentice

Joined: 06 Jun 2002 Posts: 249 Location: Zurich, Switzerland
|
Posted: Fri Nov 29, 2002 6:42 pm Post subject: |
|
|
a trick for bash users (using gnome or not) to avoid headaches from problems like those described above:
- ~/.bash_profile contains only one line:
| Code: | | [ -f ~/.bashrc ] && source ~/.bashrc |
the first line of ~/.bashrc is: | Code: | | [ -f /etc/profile ] && source /etc/profile | followed by your personal variables, aliases, functions, etc.
/etc/profile contains global settings (variables, aliases...)
when using a setup like this, you don't have to care whether you are starting a login shell or not:- if its a login shell, /etc/profiles is read first, ~/.bash_profile is read afterwards, ~/.bashrc is sourced from there, which sources /etc/profiles in turn (a little redundancy...).
- if its not a login shell, ~/.bashrc is read, and /etc/profiles is sourced from there. because ~/.bash_profile is (almos) empty, you will end up with (almost) the same environment variables as after starting a login shell.
if you worry about files being sourced twice (e.g. if you declare readonly variables), add something like the following to the file you want to be sourced only once (like a #ifndef ... #define ... #endif for the cpp): | Code: | [ "$_HAVE_BASHRC" ] && return
[... file contents ...]
declare -r _HAVE_BASHRC=true |
HTH |
|
| Back to top |
|
 |
|