On 2/2/2020 9:15 AM, Bruce Dubbs via blfs-support wrote:
On 2/2/20 12:10 AM, Alan Feuerbacher via blfs-support wrote:

Any clues what's going south?

The lfs alias is not meant to be run from lfs user.  The only time you need to be user lfs is when building LFS Chapter 5.

Ok. But I thought that, once you're done building LFS, user lfs is just another random user name.

Not quite.  If you change .bash_profile and .bashrc to more "normal" contents, then it would be OK. Notably, you do not want /tools/bin in the PATH and you do want the standard environment that .bash_profile removes.

Ooohhhh! Yes, user lfs still has the LFS .bash files. So I won't use it at all.

I created a new user to see what Fedora set as the defaults for the .bash files. Those for user alan are the same, aside from .bash_profile having your "lfs=..." alias.

I think I'm catching on to all this.


Can you run

sudo chroot /mnt/lfs /usr/bin/env -i   \
    HOME=/root TERM="$TERM"            \
    PS1='(lfs chroot) \u:\w\$ '        \
    PATH=/bin:/usr/bin:/sbin:/usr/sbin \
    /bin/bash --login

as user alan?

Done. Same result.

Then your build has a problem.

From your host,
ls /mnt/lfs/usr/bin/e*

It doesn't find anything.

But earlier today I more or less figured out why: After a reboot, the Fedora terminal environment does not contain the directories created by LFS such as user, bin, lib. But when I mount /mnt/lfs with this:

sudo mount -v -t ext4 /dev/mapper/lfslvm2-root $LFS

All those missing directories appear, and everything seems to work right -- including your "lfs=..." alias.


did it find env?  If not you didn't install coreutils properly.
I see below that you did that and it did not find env.
In view of the above information, would you still say that coreutils isn't installed properly?

I did some extra checking just for grins. The Fedora31 system has /usr/bin/env and /bin/env. They are identical.

Because on Fedora /bin and /usr/bin are symlinks.  Check
ls -ld /bin /usr/bin

Ah!

[alan@localhost ~]$ sudo chroot /mnt/lfs env -i   \
   HOME=/root TERM="$TERM"            \
   PS1='(lfs chroot) \u:\w\$ '        \
   PATH=/bin:/usr/bin:/sbin:/usr/sbin \
   /bin/bash --login

chroot: failed to run command ‘env’: No such file or directory


Based on Ken's response, here are some more results. Of course, this is in the Fedora 31 system:


[alan@localhost ~]$ ll /usr/bin/env
-rwxr-xr-x. 1 root root 54096 Oct 17 01:37 /usr/bin/env

[alan@localhost ~]$ ll /bin/env
-rwxr-xr-x. 1 root root 54096 Oct 17 01:37 /bin/env

The above are looking at your host, not your LFS build.
Right. Since I'm not in chroot or in the new running system, that's all there is.

[alan@localhost ~]$ echo $LFS
/mnt/lfs

[alan@localhost ~]$ ls -l $LFS/usr/bin/env
ls: cannot access '/mnt/lfs/usr/bin/env': No such file or directory

Run

chroot "$LFS" /tools/bin/env -i \
    HOME=/root                  \
    TERM="$TERM"                \
    PS1='(lfs chroot) \u:\w\$ ' \
    PATH=/bin:/usr/bin:/sbin:/usr/sbin:/tools/bin \
    /tools/bin/bash --login +h

and reinstall coreutils.  Watch for possible errors.

I ran it, but had to precede it by the above mount:

sudo mount -v -t ext4 /dev/mapper/lfslvm2-root $LFS

Also I did "sudo chroot ..."

So, I don't see why reinstalling coreutils will have done any good.

Below are the results of what appears to work for me:

Final results, after a reboot of Fedora:

[alan@localhost ~]$ echo $LFS
/mnt/lfs

[alan@localhost ~]$ alias
alias egrep='egrep --color=auto'
alias fgrep='fgrep --color=auto'
alias grep='grep --color=auto'
alias l.='ls -d .* --color=auto'
alias la='ls -la'
alias lfs='sudo /usr/sbin/chroot /mnt/lfs /usr/bin/env -i HOME=/root
TERM="$TERM" PS1="(lfs chroot) \u:\w\$ "
PATH=/bin:/usr/bin:/sbin:/usr/sbin /bin/bash --login'
alias ll='ls -l'
alias ls='ls --color=auto'
alias vi='vim'
alias which='(alias; declare -f) | /usr/bin/which --tty-only --read-
alias --read-functions --show-tilde --show-dot'
alias xzegrep='xzegrep --color=auto'
alias xzfgrep='xzfgrep --color=auto'
alias xzgrep='xzgrep --color=auto'
alias zegrep='zegrep --color=auto'
alias zfgrep='zfgrep --color=auto'
alias zgrep='zgrep --color=auto'

[alan@localhost ~]$ sudo mount -v -t ext4 /dev/mapper/lfslvm2-root $LFS
[sudo] password for alan:
mount: /dev/mapper/lfslvm2-root mounted on /mnt/lfs.
[alan@localhost ~]$ sudo mount -v -t ext4 /dev/mapper/lfslvm2-boot
$LFS/boot
mount: /dev/mapper/lfslvm2-boot mounted on /mnt/lfs/boot.
[alan@localhost ~]$ sudo mount -v -t vfat /dev/sdc1 $LFS/boot/efi
mount: /dev/sdc1 mounted on /mnt/lfs/boot/efi.
[alan@localhost ~]$ sudo mount -v -t ext4 /dev/mapper/lfslvm2-opt
$LFS/opt
mount: /dev/mapper/lfslvm2-opt mounted on /mnt/lfs/opt.
[alan@localhost ~]$ sudo mount -v -t ext4 /dev/mapper/lfslvm2-home
$LFS/home
mount: /dev/mapper/lfslvm2-home mounted on /mnt/lfs/home.

[alan@localhost ~]$ bash ~/mount-virt.sh
/mnt/lfs/dev mounted
/mnt/lfs/dev/pts mounted
/mnt/lfs/proc mounted
/mnt/lfs/sys mounted
/mnt/lfs/run mounted

[alan@localhost ~]$ lfs
(lfs chroot) root:/$ export LFS=/mnt/lfs
(lfs chroot) root:/$ alias ll='ls -l'
(lfs chroot) root:/$ cd /sources
(lfs chroot) root:/sources$

(lfs chroot) root:/sources$ printenv
PWD=/sources
HOME=/root
TERM=xterm-256color
SHLVL=1
PS1=(lfs chroot) \u:\w$
LFS=/mnt/lfs
PATH=/bin:/usr/bin:/sbin:/usr/sbin
OLDPWD=/
_=/usr/bin/printenv
(lfs chroot) root:/sources$

What do you think?

Alan



--
http://lists.linuxfromscratch.org/listinfo/blfs-support
FAQ: http://www.linuxfromscratch.org/blfs/faq.html
Unsubscribe: See the above information page

Reply via email to