1

I am following the LFS book and trying to get a clean shell using the following .bash_profile in arch (bash 5):

exec env -i HOME=$HOME TERM=$TERM PS1='\u:\w\$ ' /bin/bash

What this usually does is allow logging in via:

su - lfs

But for some reason, the shell immediately exits and I get:

[1]+  Stopped                 su - lfs

I am able to get into the session using:

fg

But then I have to exit twice. The exec and env documentation seem to agree with the LFS provided command that this should just create a bash environment with the 3 variables in it (HOME, TERM, and PS1). How do I get it to just replace bash with the cleaner version and let me log in?

3
  • Did you figure out the answer to this?
    – wally
    Commented Jan 15, 2020 at 20:03
  • 1
    Related answer here.
    – wally
    Commented Jan 15, 2020 at 20:29
  • @wally Nope, I don't even have my notes for this anymore, but... I found the related answer very informative and figure if I ever run across this again, I'll have a clue!
    – decuser
    Commented Oct 19, 2021 at 23:19

1 Answer 1

0

The bash provided by Arch Linux is compiled with -DSYS_BASHRC=\'\"/etc/bash.bashrc\"\' (c.f. its PKGBUILD file), which means it differs from the bash that is used in LFS because it is influenced by the provided /etc/bash.bashrc.

As explained by the added warning at the end of section 4.4 "Setting up the Environment" this file might influence the lfs user's environment:

Several commercial distributions add a non-documented instantiation of /etc/bash.bashrc to the initialization of bash. This file has the potential to modify the lfs user's environment in ways that can affect the building of critical LFS packages. To make sure the lfs user's environment is clean, check for the presence of /etc/bash.bashrc and, if present, move it out of the way.

I am not sure if this is the cause for your particular problem which I cannot reproduce on my Arch Linux system but moving the file out of the way as suggested by the updated LFS instructions might solve your problem.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .