LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
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 01-25-2007, 06:11 AM   #1
ChrisScott
Member
 
Registered: Nov 2006
Location: St Albans, England
Distribution: Fedora c3/5, Suse pro 10/openSuse 10.2, RHES, Zenwalk.....
Posts: 97

Rep: Reputation: 15
Getting a clean enviroment...


Hi All,

I've attempted to build a LFS system several times now and I always end up with some kind of installation error at some point. So this time I want to be very precise...

Right at the begining, when setting up the tempory system, I have written the .bash_profile & .bashrc files then
Code:
source .bash_profile
I have noticed two things:
1) the PS1 variable has not changed from the host one, and
2) if I enter 'env' I get a massive list of enviroment variables (including some that I declared e.g. 'LFS=/mnt/lfs')

the book says:
Quote:
The exec env -i.../bin/bash command in the .bash_profile file replaces the running shell with a new one with a completely empty environment, except for the HOME, TERM, and PS1 variables.
I have not made any typos I've checked lots of times. My host system is SuSE pro 10. I want to be sure that this step has been done correctly so I can rule it out as a cause of the install errors I have experienced later in the process.

Any help or ideas would be greatly appreciated.

Chris
 
Old 01-25-2007, 11:25 AM   #2
Daws
Member
 
Registered: May 2006
Location: UK
Distribution: Debian
Posts: 447

Rep: Reputation: 39
Quote:
I have noticed two things:
1) the PS1 variable has not changed from the host one, and
2) if I enter 'env' I get a massive list of enviroment variables (including some that I declared e.g. 'LFS=/mnt/lfs')
1) I have a similar problem on Debian, it is all to do with the /etc/profile and /etc/bash.bashrc files. I have a dirty workaround see below.

2) is normal, bash will set some needed default variables if it can't find them in the rc/profile files.

The workaround:

is fairly simple. Basically you need to make all bash related files in /etc/ unreadable to the lfs user. Its a matter of simply changing ownership and permissions of these files.

First of all you need to find which files you need to change. For me (Debian) this is /etc/profile and /etc/bash.bashrc.

If this is a single account (besides root) machine, then its easy.

as root
Code:
chown -v root:username /etc/profile /etc/bash.bashrc
chmod -v o-rw /etc/profile /etc/bashrc
If you have more than one user account then you need to create a new group. Add all user accounts to said group, and do the above but replacing username with the name of the group.

Now, when you next login/su as lfs you will see a permission denied error from /etc/profile. Et voila bash uses defaults and everything you put in .bashrc only. A nice clean environment. You should notice the PS1 is as expected.
 
Old 01-25-2007, 02:52 PM   #3
ChrisScott
Member
 
Registered: Nov 2006
Location: St Albans, England
Distribution: Fedora c3/5, Suse pro 10/openSuse 10.2, RHES, Zenwalk.....
Posts: 97

Original Poster
Rep: Reputation: 15
Spot on. Thanks again (I think you helped me out last prob so thanks x2)

Chris
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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
enviroment variabile puppet Linux - General 9 10-23-2005 04:41 PM
I cant get into the chroot enviroment...help matthewa Linux From Scratch 2 06-02-2005 11:47 AM
How can I see all the enviroment variables? zvonSully Linux - Software 3 02-09-2005 07:39 AM
Enviroment variables johnnydangerous Fedora 3 02-07-2005 05:45 AM
best runtime enviroment rh 9 cool hat Linux - Software 8 08-08-2004 10:58 AM

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

All times are GMT -5. The time now is 10:43 PM.

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