LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Linux From Scratch
User Name
Password
Linux From Scratch This Forum is for the discussion of LFS.
LFS is a project that provides you with the steps necessary to build your own custom Linux system.

Notices


Reply
  Search this Thread
Old 07-27-2005, 01:01 PM   #1
StevePhM
Member
 
Registered: Oct 2003
Distribution: SuSE10.1
Posts: 36

Rep: Reputation: 15
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??
 
Old 07-27-2005, 04:12 PM   #2
kjordan
Member
 
Registered: Jul 2004
Distribution: LFS, I felt the itch and scratched it
Posts: 227

Rep: Reputation: 31
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?
 
Old 07-27-2005, 04:24 PM   #3
StevePhM
Member
 
Registered: Oct 2003
Distribution: SuSE10.1
Posts: 36

Original Poster
Rep: Reputation: 15
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).
 
Old 07-28-2005, 03:25 PM   #4
StevePhM
Member
 
Registered: Oct 2003
Distribution: SuSE10.1
Posts: 36

Original Poster
Rep: Reputation: 15
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.
 
Old 07-28-2005, 03:30 PM   #5
TruckStuff
Member
 
Registered: Apr 2002
Posts: 498

Rep: Reputation: 30
Post your /etc/profile and ~/.bash_profile
 
Old 07-28-2005, 04:18 PM   #6
StevePhM
Member
 
Registered: Oct 2003
Distribution: SuSE10.1
Posts: 36

Original Poster
Rep: Reputation: 15
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.
 
Old 07-28-2005, 05:58 PM   #7
kjordan
Member
 
Registered: Jul 2004
Distribution: LFS, I felt the itch and scratched it
Posts: 227

Rep: Reputation: 31
Do an ls -l /bin/sh and see if you didn't mistype the symlink to /bin/bash.
 
Old 07-28-2005, 08:53 PM   #8
StevePhM
Member
 
Registered: Oct 2003
Distribution: SuSE10.1
Posts: 36

Original Poster
Rep: Reputation: 15
Hmmm.... /bin/sh points to bash, and not /bin/bash. Is that the problem??
 
Old 07-28-2005, 09:12 PM   #9
freegianghu
Member
 
Registered: Oct 2004
Location: somewhere in the street
Distribution: Window$
Posts: 192

Rep: Reputation: 30
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
 
Old 07-28-2005, 09:27 PM   #10
StevePhM
Member
 
Registered: Oct 2003
Distribution: SuSE10.1
Posts: 36

Original Poster
Rep: Reputation: 15
Thanks freegianghu!! I accidentally omitted the $ in that export command, and now that I have included it all is ok.

Thanks for your help.
 
Old 07-28-2005, 09:32 PM   #11
StevePhM
Member
 
Registered: Oct 2003
Distribution: SuSE10.1
Posts: 36

Original Poster
Rep: Reputation: 15
Dammit. All is NOT OK.

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

Sorry for the hasty reply.
 
Old 07-28-2005, 09:39 PM   #12
StevePhM
Member
 
Registered: Oct 2003
Distribution: SuSE10.1
Posts: 36

Original Poster
Rep: Reputation: 15
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
 
Old 07-28-2005, 09:39 PM   #13
freegianghu
Member
 
Registered: Oct 2004
Location: somewhere in the street
Distribution: Window$
Posts: 192

Rep: Reputation: 30
Quote:
Originally posted by StevePhM
Dammit. All is NOT OK.

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
 
Old 08-01-2005, 03:28 AM   #14
StevePhM
Member
 
Registered: Oct 2003
Distribution: SuSE10.1
Posts: 36

Original Poster
Rep: Reputation: 15
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!!
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
BLFS using LFS Live CD? AxXium Linux From Scratch 6 07-25-2005 07:15 PM
LFS or BLFS masand Linux From Scratch 16 12-02-2004 02:31 PM
Lfs --> Blfs KptnKrill Linux From Scratch 3 10-11-2003 11:19 AM
Beyond BLFS. Pure LFS? SparceMatrix Linux From Scratch 8 06-17-2003 10:38 AM
blfs and lfs? newpenguin Linux From Scratch 7 12-04-2002 07:58 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Linux From Scratch

All times are GMT -5. The time now is 03:29 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration