Browse Source

Fix the location for mounting /dev/shm inside chroot
when /dev/shm is a symlink.


git-svn-id: http://svn.linuxfromscratch.org/LFS/trunk/BOOK@10083 4aa44e1e-78dd-0310-a6d2-fbcd4c07a689

Bruce Dubbs 12 years ago
parent
commit
409e7c850f
3 changed files with 25 additions and 11 deletions
  1. 5 0
      chapter01/changelog.xml
  2. 11 10
      chapter06/kernfs.xml
  3. 9 1
      chapter09/reboot.xml

+ 5 - 0
chapter01/changelog.xml

@@ -39,6 +39,11 @@
     <listitem>
       <para>2012-12-28</para>
       <itemizedlist>
+        <listitem>
+          <para>[bdubbs] - Fix the location for mounting /dev/shm 
+          inside chroot.  Fixes
+          <ulink url="&lfs-ticket-root;3258">#3258</ulink>.</para>
+        </listitem>
         <listitem>
           <para>[matthew] - Move the build of Procps to before E2fsprogs as the
           latter requires <command>ps</command> to be available during its

+ 11 - 10
chapter06/kernfs.xml

@@ -74,16 +74,17 @@ mount -vt sysfs sysfs $LFS/sys</userinput></screen>
 
       <para>In some host systems, <filename>/dev/shm</filename> is a 
       symbolic link to <filename class="directory">/run/shm</filename>.
-      Inside a chroot environment, this symbolic link needs to be
-      changed to a normal directory before mounting as a temporary
-      file system:</para>
-
-<screen><userinput>if [ -h /dev/shm ]; then
-   rm -f $LFS/dev/shm
-   mkdir $LFS/dev/shm
-fi
-
-mount -vt tmpfs shm $LFS/dev/shm</userinput></screen>
+      Inside a chroot environment, this temporary file system needs
+      to be mounted separate from the host file system:</para>
+
+<screen><userinput>if [ -h $LFS/dev/shm ]; then
+  link=$(readlink $LFS/dev/shm)
+  mkdir -p $LFS/$link
+  mount -vt tmpfs shm $LFS/$link
+  unset link
+else
+  mount -vt tmpfs shm $LFS/dev/shm
+fi</userinput></screen>
 
   </sect2>
 

+ 9 - 1
chapter09/reboot.xml

@@ -33,7 +33,15 @@
   <para>Then unmount the virtual file systems:</para>
 
 <screen><userinput>umount -v $LFS/dev/pts
-umount -v $LFS/dev/shm
+
+if [ -h $LFS/dev/shm ]; then 
+  link=$(readlink $LFS/dev/shm)
+  umount -v $LFS/$link
+  unset link
+else
+  umount -v $LFS/dev/shm
+fi 
+
 umount -v $LFS/dev
 umount -v $LFS/proc
 umount -v $LFS/sys</userinput></screen>