On 1/18/20 10:57 AM, DJ Lucas via blfs-support wrote:


On 1/17/2020 11:11 PM, Alan Feuerbacher via blfs-support wrote:
# MUST EXPERIMENT WITH THESE but I'm pretty sure they need to be done
# Done after a complete reboot:
mount -v --bind /dev $LFS/dev
mount -vt devpts devpts $LFS/dev/pts -o gid=5,mode=620
mount -vt proc proc $LFS/proc
mount -vt sysfs sysfs $LFS/sys
mount -vt tmpfs tmpfs $LFS/run
if [ -h $LFS/dev/shm ]; then
  mkdir -pv $LFS/$(readlink $LFS/dev/shm)
fi

Separate from the problem, I notice that this is not inline with the book as we use bind mounts of the host's VFSs. On first glance, I think it should work, but am unsure (especially since the problem seems to be in /dev which does work). On that, does /dev/urandom exist on the host? I typically work from SSH until a system is complete. Here is my simple lfs-chroot.sh script for comparison, which accounts for the already mounted VFSs, since I might have multiple sessions open to the same host - note that this does not account for ending the first session in early (there is probably a way to check for that, but this works well enough for me):

dj@lfsdt2 [ ~/LFS/LFS/trunk ]$ cat ~/bin/lfs-chroot.sh
#!/bin/bash
export LFS=/media/lfs
FIRST_IN=0

mount | grep "${LFS}/dev" && FIRST_IN=1

if test "${FIRST_IN}" == "0"; then
     sudo mount --bind /dev "${LFS}/dev"
     sudo mount --bind /dev/pts "${LFS}/dev/pts"
     sudo mount --bind /dev/shm "${LFS}/dev/shm"
     sudo mount --bind /proc "${LFS}/proc"
     sudo mount --bind /sys "${LFS}/sys"
     sudo mount --bind /run "${LFS}/run"
fi

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

if test "${FIRST_IN}" == "0"; then
     sudo umount "${LFS}/run"
     sudo umount "${LFS}/sys"
     sudo umount "${LFS}/proc"
     sudo umount "${LFS}/dev/shm"
     sudo umount "${LFS}/dev/pts"
     sudo umount "${LFS}/dev"
fi
unset LFS

This is what I use:

http://www.linuxfromscratch.org/~bdubbs/basic-blfs-book/starting.html

And a corresponding
$ cat umount-virt.sh
#!/bin/bash

function unmount
{
   if mountpoint $LFS/$1 >/dev/null; then
     $SUDO umount $LFS/$1
     echo $LFS/$1 unmounted
   else
     echo $LFS/$1 was not mounted
   fi
}

if [ $EUID -ne 0 ]; then
  SUDO=sudo
else
  SUDO=""
fi

if [ x$LFS == x ]; then
  echo "LFS not set"
  exit 1
fi

unmount run
unmount sys
unmount proc
unmount dev/pts
unmount dev
unmount usr/src
unmount boot
unmount home
----------

--
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