On 10/25/2017 11:02 AM, Bruce Dubbs wrote:
Ken Moffat wrote:
On Tue, Oct 24, 2017 at 03:30:10PM -0700, Paul Rogers wrote:

(trimming to one point)
So, once LFS is finished, then there may be some "essentials" one needs
immediately, e.g. preferred editor, environment, iptables firewall,
etc., but soon after that one needs to get networking running, boot and
run in the new system.  Yes, the LFS system is so Spartan it's
unpleasant to use, but there's no good reason to put off booting too
long.  It's better done before there are too many added complications.

I have no problem accessing the internet from chroot.  You only have to
ensure that the virtual file systems are mounted as in LFS Section 6.2.2
and 6.2.3.


$ cat mount-virt.sh
#!/bin/bash

function mountbind
{
   if ! mountpoint $LFS/$1 >/dev/null; then
     $SUDO mount --bind /$1 $LFS/$1
     echo $LFS/$1 mounted
   else
     echo $LFS/$1 already mounted
   fi
}

function mounttype
{
   if ! mountpoint $LFS/$1 >/dev/null; then
     $SUDO mount -t $2 $3 $4 $5 $LFS/$1
     echo $LFS/$1 mounted
   else
     echo $LFS/$1 already mounted
   fi
}

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

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


mountbind dev
mounttype dev/pts devpts devpts -o gid=5,mode=620
mounttype proc    proc   proc
mounttype sys     sysfs  sysfs
mounttype run     tmpfs  run
mkdir $LFS/run/shm
# Add as appropriate
#mountbind usr/src
#mountbind boot
================================

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

  -- Bruce

P.S.  It's useful to have a unmount-virt.sh script also.



I use a lfs-chroot.sh script to do this in ~/bin. Probably not ideal for all users, but first one in umounts when it exits. Works for me.

#!/bin/bash
# Begin ~/bin/lfs-chroot.sh

UMOUNT=0

mount | grep /media/lfs/dev
if test "${?}" -ne "0"; then
   UMOUNT=1
   sudo mount --bind /dev /media/lfs/dev
   sudo mount --bind /dev/pts /media/lfs/dev/pts
   sudo mount --bind /dev/shm /media/lfs/dev/shm
   sudo mount --bind /sys /media/lfs/sys
   sudo mount --bind /proc /media/lfs/proc
fi

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

if test "${UMOUNT}" -eq "1"; then
    sudo umount /media/lfs/dev/{pts,shm}
    sudo umount /media/lfs/dev
    sudo umount /media/lfs/sys
    sudo umount /media/lfs/proc
fi


--DJ

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

Do not top post on this list.

A: Because it messes up the order in which people normally read text.
Q: Why is top-posting such a bad thing?
A: Top-posting.
Q: What is the most annoying thing in e-mail?

http://en.wikipedia.org/wiki/Posting_style

Reply via email to