On Mon, Mar 07, 2016 at 03:40:57PM -0600, Bruce Dubbs wrote:
> Pierre Labastie wrote:
> >On 07/03/2016 05:28, Ken Moffat wrote:
> >>On Mon, Mar 07, 2016 at 12:46:48AM +0000, Ken Moffat wrote:
> >>>>
> >>>Eventually, I found a make bug report : /dev/pts needs to be mounted
> >>>(well, duh!) with an upstream commit.  I'm sure you will remember
> >>>that my bind mounts did not work [ after user ken had su'd to user
> >>>lfs for chapter 5, and then su'd ] - that looks as if su in fedora
> >>>has been hacked in some way, but I assumed that binding /dev, /proc/
> >>>and /sys [ by user ken who had su'd to root ] would suffice - I
> >>>forgot about mounting /dev/pts (and anyway, I sort of thought it
> >>>would be there from the bind.
> >>>
[...]
> >>
> >>1. 'su' might not work as expected - when user ken uses 'su', root
> >>can mount /mnt/lfs and bind /dev etc.  But when user ken su's to
> >>user lfs and then su's, that session can chroot (so, that implies it
> >>really is root), but attempts to mount --bind and mount -vt on the
> >>way in to chroot fail.
> >>
[...]
> >
> >I'm ashamed I forgot! This was the same issue here. When I started again in
> >the morning, I forgot to re-mount the virtual kernel filesystems. I have now
> >restarted with no problem (and selinux enabled).
> >
[...]
> 
> I do not understand the problem with jhalfs.  Doesn't it automatically mount
> all the needed virtual file systems?
> 
> I will note that I use a couple of scripts to mount or umount needed fs
> manually when needed.  I add /boot and /usr/src to the standard LFS set of
> virtual fs.
> 

For good measure, here are some parts of my 'intochroot.sh' script

#!/bin/bash
# after building ch05, enter chroot
set +h
set -e
export KM_STAGE=intochroot

# check LFS is set
if [ -z $LFS ]; then
        echo "Cannot procede, you need to set/export LFS"
        exit 1
fi &&
export LFS &&

# check we are root
if [ "$EUID" -ne 0 ]; then
        echo "You need to be root to run this - you are $EUID"
        exit 1
fi &&

[ ... standard stuff to handle how I do things, including working
out where this "driver" script lives, so that it can find the client
scripts for packages, or in this case for creating /etc/passwd and
/etc/group, getting my functions, sorting out logging, etc : and
then start the actual job : ]

# stop user LFS from being able to write to /misc, so that he
# doesn't
# accidentally overwrite the current system's hostfile and packages
# when setting up a new build.
chown root $LFS/misc

# some of this script needs to be run each time
mkdir -p $LFS/{dev,proc,sys} &&
test -c $LFS/dev/console || mknod -m 600 $LFS/dev/console c 5 1 &&
test -c $LFS/dev/null    || mknod -m 666 $LFS/dev/null c 1 3 &&

mount | grep $LFS/dev      || mount --bind /dev $LFS/dev &&
mount | grep $LFS/dev/pts  || mount -vt devpts devpts $LFS/dev/pts
-o gid=5,mode=620 &&
mount | grep $LFS/proc     || mount -vt proc proc $LFS/proc &&
mount | grep $LFS/sys      ||mount -vt sysfs sysfs $LFS/sys &&

# /dev/shm used to only be mounted as part of /dev
# now we do things differently if it is a symlink to /run
# so add || true for reruns (it should report 'already mounted')
if [ -h $LFS/dev/shm ]; then
        link=$(readlink $LFS/dev/shm)
        mkdir -p $LFS/$link
        mount -vt tmpfs shm $LFS/$link || true
        unset link
else
        mount -vt tmpfs shm $LFS/dev/shm || true
fi

[ ... ]

This all works fine on an lfs host, and early on I have tested that
I was root : but the mount error messages I eventually found showed
that was not good enough for fedora.

If people are actually building the book by hand, they will notice
those error messages if they get them.  For those of us who script
(I hope that is everybody one this list), when it breaks we get to
keep all the pieces.

ĸen
-- 
This email was written using 100% recycled letters.
-- 
http://lists.linuxfromscratch.org/listinfo/lfs-dev
FAQ: http://www.linuxfromscratch.org/faq/
Unsubscribe: See the above information page

Reply via email to