Find the answer to your Linux question:
Page 3 of 4 FirstFirst 1 2 3 4 LastLast
Results 21 to 30 of 34
That's kind of strange... Some program that is called by /etc/profile or ~/.bash_profile must have hung. Anyway, yes, you had got it right. Can you open a shell, then make ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #21
    Linux Guru
    Join Date
    Oct 2001
    Location
    Täby, Sweden
    Posts
    7,578

    That's kind of strange... Some program that is called by /etc/profile or ~/.bash_profile must have hung. Anyway, yes, you had got it right.
    Can you open a shell, then make the changes, open another shell, and while the second shell is hung, check the output of "ps -AH" with the first shell?

    In order to change your font size: What terminal emulator are you using?

  2. #22
    Linux Newbie
    Join Date
    Aug 2003
    Posts
    113
    I've figured out the font issue.

    You asked:
    That's kind of strange... Some program that is called by /etc/profile or ~/.bash_profile must have hung. Anyway, yes, you had got it right.
    Can you open a shell, then make the changes, open another shell, and while the second shell is hung, check the output of "ps -AH" with the first shell?
    Just to let you know I installed Gentoo following thier x86 install guide. Here's a cut and past of some stuff out to the Gentoo install guide that might help explain some of this. As for why it's acting strangely when I insert the code is beyond me.

    Portion of the Gentoo Install guide that I think might be important.
    Next, we will chroot over to the new Gentoo Linux build installation to "enter" the new Gentoo Linux system:

    Note: You may receive a notice during env-update telling you that /etc/make.profile/make.defaults isn't available: ignore it. We are going to issue emerge sync later on in this document, which will resolve the problem.

    Code listing 8.6: Prepping and entering the chroot environment

    # mount -t proc proc /mnt/gentoo/proc
    # cp /etc/resolv.conf /mnt/gentoo/etc/resolv.conf
    # chroot /mnt/gentoo /bin/bash
    # env-update
    Regenerating /etc/ld.so.cache...

    # source /etc/profile
    (The above points your shell to the new paths and updated binaries)
    Later on in the install process after having Sourced "etc/profile" I of course set a root passwd and addusr jbanks and set a passwd for that user.



    And the weid thing is, is that by defualt everytiime I open up the console it defaults to the below unless I source /etc/profile..

    There have been some strange things happing like certain commands not working until I source /etc/profile..



    bash-2.05b$ su
    Password:
    bash-2.05b# . /etc/profile
    deadmeat jbanks # exit
    exit
    bash-2.05b$ . /etc/profile
    jbanks@deadmeat jbanks $ su
    Password:
    root@deadmeat jbanks # nano -w .bashrc

    (I edit the .bashrc file to add your code; save and then try and open another console session. The screen is blank but allows me to input text but doesn't respond what-so-ever to any commands..)

    root@deadmeat jbanks # ps -AH
    PID TTY TIME CMD
    1 ? 00:00:04 init
    2 ? 00:00:00 keventd
    3 ? 00:00:00 ksoftirqd_CPU0
    4 ? 00:00:00 kswapd
    5 ? 00:00:00 kscand
    6 ? 00:00:00 bdflush
    7 ? 00:00:00 kupdated
    287 ? 00:00:00 khubd
    317 ? 00:00:00 kreiserfsd
    466 ? 00:00:00 devfsd
    1158 ? 00:00:00 syslogd
    1160 ? 00:00:00 klogd
    1567 ? 00:00:00 cron
    1729 ? 00:00:00 xfs
    1755 vc/1 00:00:00 agetty
    1756 vc/2 00:00:00 agetty
    1757 vc/3 00:00:00 agetty
    1758 vc/4 00:00:00 agetty
    1759 vc/5 00:00:00 agetty
    1760 vc/6 00:00:00 agetty
    1777 ? 00:00:00 kdm
    1779 ? 00:08:21 X
    22372 ? 00:00:00 kdm
    22453 ? 00:00:00 kde-3.1.2
    22487 ? 00:00:00 startkde
    22539 ? 00:00:00 kwrapper
    22510 ? 00:00:00 kdeinit
    22536 ? 00:00:02 artsd
    22542 ? 00:00:11 kdeinit
    22550 ? 00:00:01 kppp
    22552 ? 00:00:00 kppp
    22929 ttyS0 00:00:00 pppd
    22943 ? 00:00:02 kdeinit
    22944 pts/0 00:00:00 bash
    22947 pts/0 00:00:00 su
    22950 pts/0 00:00:00 bash
    3563 pts/2 00:00:11 bash
    8135 pts/2 00:00:00 bash
    24170 ? 00:00:08 kdeinit
    24245 ? 00:00:26 kdeinit
    24248 ? 00:00:00 kdeinit
    24296 ? 00:00:01 kdeinit
    24297 pts/1 00:00:00 bash
    24308 pts/1 00:00:00 su
    24311 pts/1 00:00:00 bash
    8129 pts/1 00:00:00 ps
    6879 pts/3 00:00:02 bash
    8134 pts/3 00:00:00 bash
    8136 pts/3 00:00:00 bash
    22513 ? 00:00:01 kdeinit
    22516 ? 00:00:00 kdeinit
    22518 ? 00:00:01 kdeinit
    22538 ? 00:00:00 kdeinit
    22541 ? 00:00:00 kdeinit
    22544 ? 00:01:23 kdeinit
    22546 ? 00:00:22 kdeinit
    22548 ? 00:00:00 kdeinit
    22551 ? 00:00:00 korgac
    22563 ? 00:00:00 kalarmd
    22712 ? 00:00:01 kdeinit
    root@deadmeat jbanks #

    Let me know what you think about what I have explained above in regards to what the Install guide has done. Thanks Dolda. I appreciate it.
    JB

  3. #23
    Linux Guru
    Join Date
    Oct 2001
    Location
    Täby, Sweden
    Posts
    7,578
    Strange, I couldn't see anything useful in there. OK, then, let's do some standard debugging, if you feel up to it. Edit that part of your .bashrc to this:
    Code:
    echo 1
    . /etc/profile
    echo 2
    if [ -r ~/.bash_profile ]; then
        . ~/.bash_profile
    fi
    echo 3
    Then try again and see which numbers come up on the terminal.

  4. $spacer_open
    $spacer_close
  5. #24
    Linux Newbie
    Join Date
    Aug 2003
    Posts
    113
    Quote Originally Posted by Dolda2000
    Strange, I couldn't see anything useful in there. OK, then, let's do some standard debugging, if you feel up to it. Edit that part of your .bashrc to this:
    Code:
    echo 1
    . /etc/profile
    echo 2
    if [ -r ~/.bash_profile ]; then
        . ~/.bash_profile
    fi
    echo 3
    Then try again and see which numbers come up on the terminal.

    Hmmmmmmmmmm...

    It echo's 1212121212 until I hit (^C) or ctrl-c.. But then I'm unable to get the shell to respond to ny commands except a very few redumentary one. I can change directories but seems to be about it... Check it out...This is opening a new "Konsole" window after adding your code to ~.bashrc.



    2
    1
    2
    1
    2
    1
    2
    1
    jbanks@deadmeat jbanks $ dir
    bash: dir: command not found
    jbanks@deadmeat jbanks $ dir
    bash: dir: command not found
    jbanks@deadmeat jbanks $ ls
    bash: ls: command not found
    jbanks@deadmeat jbanks $ man dir
    bash: man: command not found
    jbanks@deadmeat jbanks $ cd /etc
    jbanks@deadmeat etc $ dir
    bash: dir: command not found
    jbanks@deadmeat etc $ nano -w ~.bashrc
    bash: nano: command not found
    jbanks@deadmeat etc $ ping 192.168.1.1
    bash: ping: command not found
    Let me know what you would like to try next Dolda.

    Thanks,
    JB

  6. #25
    Linux Guru
    Join Date
    Oct 2001
    Location
    Täby, Sweden
    Posts
    7,578
    In that case, it would seem that ~/.bash_profile is trying to source ~/.bashrc for some reason, making it create an infinite loop. It can easily by worked around by using this code instead:
    Code:
    if [ -z "$BASHRCHACK" ] ; then
        export BASHRCHACK=hacked
        . /etc/profile
        if [ -r ~/.bash_profile ]; then
            . ~/.bash_profile
        fi
    fi
    Admittedly, it's not very pretty, but it's probably the best way to solve it.

    Alternatively, you could make sure that ~/.bash_profile only sources ~/.bashrc if the shell actually is a login shell, which can be done by finding the line in ~/.bash_profile that sources ~/.bashrc and replace it with this:
    Code:
    if shopt 2>/dev/null | grep -q 'login_shell.*yes'; then
        . ~/.bashrc
    fi

  7. #26
    Linux Newbie
    Join Date
    Aug 2003
    Posts
    113
    Wow.

    This problem was a bit beyond me but I finally got it figured out Dolda. It was too simple. But the below solutions and facts where all found digging through the Gentoo web forum.

    I simply added this to my ~/.bashrc

    Code:
    [ -f /etc/profile ] && . /etc/profile
    There was a change to /etc/profile in Gentoo at some point and the fact that I'm using KDE Konsole terminal shell which isn't a login shell compaired to Gnomes terminal shell.

    My original problem was CAUSED by a change in /etc/profile
    before:


    Code:
    
    
     if [ "$SHELL" = '/bin/bash' ] || [ "$SHELL" = '/bin/sh' ] 
     * * * * then 
     * * * * * * * * * * * * * * * * export PS1='\[\033[01;32m\]\u@\h \[\033[01;34m\]\W \$ \[\033[00m\]' 
     * * * * fi

    now:


    Code:
    
    
     if [ "$TERM" != 'dumb'* ] && [ -n "$BASH" ] 
     * * * * then 
     * * * * * * * * export PS1='\[\033[01;32m\]\u@\h \[\033[01;34m\]\W \$ \[\033[00m\]' 
     * * * * fi
    The new if condition is no longer true when /etc/X11/startDM.sh sources /etc/profile. If you want to get back the old behaviour you can either change /etc/profile, ~/.bashrc or /etc/X11/Sessions/* (and probably some others too)

    Thanks for all the help Dolda.
    JB

  8. #27
    Just Joined!
    Join Date
    Sep 2003
    Location
    Toronto, ON., Canada
    Posts
    14
    I tried adding this code as well and it worked... partially.

    When I kick up a terminal, the prompt displays as expected [jmharkne @ alpha <dir>], but when I su - or when I telnet, the prompt is the annoying "-bash-2.05b$"

    Hrmmm....

  9. #28
    Just Joined!
    Join Date
    Sep 2003
    Location
    Toronto, ON., Canada
    Posts
    14
    I found the error in my ways. Telnet and su - are login shells, right?

  10. #29
    Linux Newbie
    Join Date
    Aug 2003
    Posts
    113
    Good question Blue.

    Quote Originally Posted by blue
    I found the error in my ways. Telnet and su - are login shells, right?
    I would assume so but I actually don't know.

    What did you find out?

    Hey Blue. I think you need to edit your signature buddy. Either that or I'm behind the times some how.
    JB

  11. #30
    Just Joined!
    Join Date
    Sep 2003
    Location
    Toronto, ON., Canada
    Posts
    14
    Quote Originally Posted by Mzzbizzsnatch
    Good question Blue.

    Quote Originally Posted by blue
    I found the error in my ways. Telnet and su - are login shells, right?
    I would assume so but I actually don't know.

    What did you find out?

    Hey Blue. I think you need to edit your signature buddy. Either that or I'm behind the times some how.
    su - and telnet run .bash_profile but not .bashrc so I assume that means they are login shells. I have added .bashrc to my .bash_profile so that it gets loaded as well. Be careful not to source .bash_profile in .bashrc as well or it will loop indefinitely.

    As for my signature, the wording was "open sourced" from an old image I had seen. A quck search found the image below. Perhaps I should update the wording...

Page 3 of 4 FirstFirst 1 2 3 4 LastLast

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •