LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux From Scratch (http://www.linuxquestions.org/questions/linux-from-scratch-13/)
-   -   BLFS: Error on chrooting into LFS environment (http://www.linuxquestions.org/questions/linux-from-scratch-13/blfs-error-on-chrooting-into-lfs-environment-347348/)

StevePhM 07-27-2005 01:01 PM

BLFS: Error on chrooting into LFS environment
 
I successfuly completed LFS and had a system that booted with no error messages. However, after completing the "Bash shell startup files" section of chapter 3 of BLFS I get the following error on boot and chroot.
Code:

: command not found
: command not found
: command not found
'ash: /root/.bash_profile: line 12: syntax error near unexpected token `{
'ash: /root/.bash_profile: line 12: `append () {

I know there are no typos in the /bash_profile file (or any of the others for that matter) since I have just went back over them and cut and paste the text from the manual!!

Can anyone point me in the right direction??

kjordan 07-27-2005 04:12 PM

What? You're trying to do a chroot in your new environment? Or did you restart into your host and you're trying to chroot into your LFS? What command are you typing when you get that error?

StevePhM 07-27-2005 04:24 PM

I'm back in my host system (SuSE9.2) and I created the config files as instructed in the BLFS manual. When I execute the following (again from the host system)
Code:

chroot "$LFS" /usr/bin/env -i HOME=/root TERM="$TERM" PS1='\u:\w$ ' PATH=/bin:/usr/bin:/sbin:/usr:sbin /bin/bash --login
I get the error message shown in my earlier post.

I also get this message when I boot into the LFS system and logon as root (the only user so far).

StevePhM 07-28-2005 03:25 PM

Anyone have any ideas??

The line of ~/.bash_profile it is complaining about is the first uncommented line and it reads as follows,
Code:

append () {
What is wrong with this command??

In the error message, why does it say
Code:

'ash:
instead of
Code:

bash
?? Perhaps that's the problem?

I'd really appreciate any help you can give me on this.

TruckStuff 07-28-2005 03:30 PM

Post your /etc/profile and ~/.bash_profile

StevePhM 07-28-2005 04:18 PM

I'm not at my linux box at the moment so I can't tell you the exact text.

When I first discovered this error I went through the book and cut'n'paste all the configuration files so I could be sure there were no typos, so (and I realise that it is a little rude to direct you to another page) you can see the text of /etc/profile on pages 55, and 56 of the BLFS book, and the text of ~/.bash_profile on page 61.

Again I apologise for not having the relevant info and for directing you to another web page, but I am sure that the contents of the files are the same as in the book.

Many thanks.

kjordan 07-28-2005 05:58 PM

Do an ls -l /bin/sh and see if you didn't mistype the symlink to /bin/bash.

StevePhM 07-28-2005 08:53 PM

Hmmm.... /bin/sh points to bash, and not /bin/bash. Is that the problem??

freegianghu 07-28-2005 09:12 PM

Quote:

Originally posted by StevePhM
Hmmm.... /bin/sh points to bash, and not /bin/bash. Is that the problem??
Did you miss export $LFS=/mnt/lfs before chroot?

Cheers,
GH

StevePhM 07-28-2005 09:27 PM

Thanks freegianghu!! I accidentally omitted the $ in that export command, and now that I have included it all is ok.

Thanks for your help.

StevePhM 07-28-2005 09:32 PM

Dammit. All is NOT OK.:mad:

The export command does NOT work with the $. So I'm back to square one....:(

Sorry for the hasty reply.

StevePhM 07-28-2005 09:39 PM

To answer an earlier query, the following is the contents of /etc/profile,
Code:

# Begin /etc/profile
# Written for Beyond Linux From Scratch
# by James Robertson <jameswrobertson@earthlink.net>
# modifications by Dagmar d'Surreal <rivyqntzne@pbzpnfg.arg>
 
# System wide environment variables and startup programs.
 
# System wide aliases and functions should go in /etc/bashrc.  Personal
# environment variables and startup programs should go into
# ~/.bash_profile.  Personal aliases and functions should go into
# ~/.bashrc.
 
# Functions to help us manage paths.  Second argument is the name of the
# path variable to be modified (default: PATH)
pathremove () {
        local IFS=':'
        local NEWPATH
        local DIR
        local PATHVARIABLE=${2:-PATH}
        for DIR in ${!PATHVARIABLE} ; do
                if [ "$DIR" != "$1" ] ; then
                  NEWPATH=${NEWPATH:+$NEWPATH:}$DIR
                fi
        done
        export $PATHVARIABLE="$NEWPATH"
}
 
pathprepend () {
        pathremove $1 $2
        local PATHVARIABLE=${2:-PATH}
        export $PATHVARIABLE="$1${!PATHVARIABLE:+:${!PATHVARIABLE}}"
}
 
pathappend () {
        pathremove $1 $2
        local PATHVARIABLE=${2:-PATH}
        export $PATHVARIABLE="${!PATHVARIABLE:+${!PATHVARIABLE}:}$1"
}
 

# Set the initial path
export PATH=/bin:/usr/bin

if [ $EUID -eq 0 ] ; then
        pathappend /sbin:/usr/sbin
        unset HISTFILE
fi
 
# Setup some environment variables.
export HISTSIZE=1000
export HISTIGNORE="&:[bf]g:exit"
#export PS1="[\u@\h \w]\\$ "
export PS1='\u@\h:\w\$ '
 
for script in /etc/profile.d/*.sh ; do
        if [ -r $script ] ; then
                . $script
        fi
done
 
# Now to clean up
unset pathremove pathprepend pathappend

and this is ~/.bash_profile,
Code:

# Begin ~/.bash_profile
# Written for Beyond Linux From Scratch
# by James Robertson <jameswrobertson@earthlink.net>
# updated by Bruce Dubbs <bdubbs@linuxfromscratch.org>

# Personal environment variables and startup programs.

# Personal aliases and functions should go in ~/.bashrc.  System wide
# environment variables and startup programs are in /etc/profile.
# System wide aliases and functions are in /etc/bashrc.

append () {
  # First remove the directory
  local IFS=':'
  local NEWPATH
  for DIR in $PATH; do
    if [ "$DIR" != "$1" ]; then
      NEWPATH=${NEWPATH:+$NEWPATH:}$DIR
    fi   
  done
 
  # Then append the directory
  export PATH=$NEWPATH:$1
}

if [ -f "$HOME/.bashrc" ] ; then
        source $HOME/.bashrc
fi

if [ -d "$HOME/bin" ] ; then
  append $HOME/bin     
fi

unset append

# End ~/.bash_profileroot


freegianghu 07-28-2005 09:39 PM

Quote:

Originally posted by StevePhM
Dammit. All is NOT OK.:mad:

The export command does NOT work with the $. So I'm back to square one....:(

Sorry for the hasty reply.

Sorry, its my typo mistake :(. I want to ask for export LFS=/mnt/lfs

Regards,
GH

StevePhM 08-01-2005 03:28 AM

Just wondering if anyone out there had an idea what was wrong here?? Could it be due to me cutting and pasting the files, which means that there is no EOF at the end?? I don't think so since the problem seems to be with the first line of code, but I'm not an expert!!!

All help is appreciated!!


All times are GMT -5. The time now is 02:15 AM.