[lfs-support] 2.4. Setting The $LFS Variable

Bruce Dubbs bruce.dubbs at gmail.com
Fri Nov 27 19:29:55 PST 2015


Pierre Labastie wrote:
> On 22/11/2015 04:06, Chris Staub wrote:
>> On 11/21/2015 06:15 PM, Felix wrote:
>>> 2.4. Setting The $LFS Variable
>>> http://www.linuxfromscratch.org/lfs/view/7.8-systemd/chapter02/aboutlfs
>>> .html
>>>
>>> Hi,
>>> after many years of knowing about LFS I finally decided to give it a
>>> try!.
>>> As you can see I am only just begun :-)
>>>
>>> My host system is Ubuntu Gnome 15.10.
>>> I believe that Ubuntu uses dash as default shell, however based upon
>>> the recommendation in the book I installed bash.
>>> I then deleted the link /bin/sh to dash and recreated it to /bin/bash.
>>>
>>> Then as section 2.4 I created the files .bash_profile for my user and
>>> for root with the line:
>>>> export LFS=/mnt/lfs
>>>
>>> However, testing this with echo $LFS in all sorts of ways, including
>>> rebooting, sudo su - , sudo echo $LFS , etc. showed that the
>>> .bash_profile was not being respected.
>>>
>>> I searched the mailing list archives and found the following post:
>>> http://lists.linuxfromscratch.org/pipermail/blfs-support/2013-February/
>>> 072064.html
>>>
>>> which gave me the answer to my problem.
>>>
>>> I would like to respectfully suggest that this information could be
>>> mentioned in Section 2.4 of the book.
>>>
>>> Thank you.
>>>
>> There is no need for that, it won't happen for the lfs user if you're
>> following the book. And, if you're referring to that being set for root,
>> there's no real need to put that in .bashrc or .bash_profile since they're
>> only used a few times. Plus, we don't know what shell you might be using for
>> root, so we can't be sure you're even using bash.
>
> Well, I respectfully disagree: the book tells explicitely in a note (page 2.4.
> Setting the $LFS variable) that "One way to ensure that the LFS variable is
> always set is to edit the .bash_profile file in both your personal home
> directory and in /root/.bash_profile and enter the export command above." So I
> think Felix's request is legitimate. Something like "if your shell is called
> /bin/sh, use .profile instead of .bash_profile" could be added to the note.

OK, I've added a sentence to the note:

In addition, the shell specified in the
<filename>/etc/passwd</filename> file for all users that need the
<envar>LFS</envar> variable needs to be bash to ensure that the
<filename>/root/.bash_profile</filename> file is incorporated as a part of
the login process.


I'll note here that placing 'export LFS=/mnt/lfs' in .profile doesn't work 
because the syntax is bash specific.

   -- Bruce




More information about the lfs-support mailing list