[lfs-dev] [lfs-book] r10440 - in trunk/BOOK: . chapter01 chapter06

xinglp xinglp at gmail.com
Fri Jan 17 08:16:43 PST 2014

2014/1/17 Bruce Dubbs <bruce.dubbs at gmail.com>:
> xinglp wrote:
>> 2014/1/17 Bruce Dubbs <bruce.dubbs at gmail.com>:
>>> Armin K. wrote:
>>>> On 01/17/2014 05:03 AM, Bruce Dubbs wrote:
>>>>> Moving to -dev.
>>>>> xinglp wrote:
>>>>>>> OK, thanks.  Can you test:
>>>>>>> rm -rf --one-file-system /run/* /tmp/*
>>>>>> Same error.
>>>>> For background see
>>>>> http://www.mail-archive.com/lfs-book@linuxfromscratch.org/msg18517.html
>>>>> I'm not sure how to handle this.  At the end of Chapter 6 we don't need
>>>>> either /dev/shm or /run/shm.
>>>>> What we do when mounting virtual file systems is:
>>>>> if [ -h $LFS/dev/shm ]; then
>>>>>      link=$(readlink $LFS/dev/shm)
>>>>>      mkdir -pv $LFS/$link
>>>>>      mount -vt tmpfs shm $LFS/$link
>>>>>      unset link
>>>>> else
>>>>>      mount -vt tmpfs shm $LFS/dev/shm
>>>>> fi
>>>>> This means that /run/shm only exists if /dev/shm is a symlink.
>>>>> We are still in chroot when cleaning up but we can still umount /run/shm
>>>>> before deleting.  Probably something like:
>>>>> [ -e /run/shm ] && umount /run/shm
>>>>> rm -rf /run/* /tmp/*
>>>>> How does this sound?
>>>> Sorry to jump in, but I want to mention that maybe mounting a tmpfs at
>>>> /run itself during the build might be easier.
>>> I now remember you mentioning that before.  Let me run a test of that.
>> Or use "mount -o bind /run $LFS/run", which is better?
> I haven't finished testing yet as I'm also working on a util-linux
> integration with udev problem, but why would we want to bind mount /run?
>   The only place /run is used in the book is for the tests in
> util-linux.  Mounting a tmpfs is fairly painless.  I don't think a bind
> mount would be appropriate because of the potential of interfering with
> the host system.

We also bind /dev to $LFS/dev, and mounting {devpts,sysfs.procfs} to
$LFS/xxx is same as bind.
Use "mount -o bind xxx" make the the guest similar to host system, but
as you say, may interfer the host system.
I was use bind when I build blfs without reboot into it.

Since /run is special than others, it may be changed by guest system
while building.
We should use tmpfs, but do the same work as bootscript do.

      mkdir -p /run/var /run/lock /run/shm
      chmod 1777 /run/shm

>    -- Bruce
> --
> http://linuxfromscratch.org/mailman/listinfo/lfs-dev
> FAQ: http://www.linuxfromscratch.org/faq/
> Unsubscribe: See the above information page

More information about the lfs-dev mailing list