The new build process in LFS 10.0 changed a few things.
Especially as the tools directory is not in use anymore,
getting the ownership of the build tools right using the package user system
has become significantly more complicated.

A patch to the more_control_and_pkg_man.txt 
currently hostet at linuxfromscratch.org is attached.
In this patch I tried to adress the issues stated previously.

Maybe a general overhaul of the hint is due aswell...

Best regards,
Daniel Mowitz
diff --git a/more_control_and_pkg_man.txt b/more_control_and_pkg_man-patched.txt
index 43bfd86..b2fda94 100644
--- a/more_control_and_pkg_man.txt
+++ b/more_control_and_pkg_man-patched.txt
@@ -1002,53 +1002,44 @@ try anything funky with them.
 
 
 #############################################################################
- 6. Pre-Chroot Phase (Chapter 5)
+ 6. Pre-Chroot Phase (Chapter 6)
 #############################################################################
 
 Build Chapter 5 explained by the LFS book with the following changes:
-
-coreutils:
-  After running `make install' for the coreutils
-  package, issue the following command (still from within the coreutils
-  build directory):
-
-    cp src/su /tools/bin
-    
-  This installs the su binary. Coreutils doesn't install su when working as
-  non-root (which we do in Chapter 5), because su needs to be setuid root for
-  normal operation and a non-root user cannot install setuid root binaries. 
-  But for our purposes (i.e. su'ing from root to a package user) a non-setuid 
-  su is enough, so we just copy coreutils' su to /tools/bin without making it
-  setuid root.
-  
+ 
 more_control_helpers:
   When you have reached the end of Chapter 5, before you begin with Chapter 6 
   you will need to install the helper scripts in the /tools directory so that
   they are available once you've entered the chroot environment. Use the
   following commands to install the more_control_helpers in /tools:
 
-    cd /tools &&
+    cd $LFS/tools &&
     tar xjf /path/to/more_control_helpers.tar.bz2 &&
     cd  more_control_helpers &&
-    cp ./sbin/* /tools/bin
-    
-  Note that the target directory is "/tools/bin" in the cp command and 
-  *not* "/tools/sbin", although the latter location would be more appropriate.
-  The reason for this is simply that the LFS instructions do not add 
-  "/tools/sbin" to the PATH (and neither do the instructions in this hint).
+    cp ./sbin/* $LFS/sbin
 
 
 #############################################################################
- 7. Chroot Phase (Chapter 6)
+ 7. Chroot Phase (Chapter 7)
 #############################################################################
 
  7.1 Preparations
  ----------------
 
+Skip the chapter in which the ownership of installed files is changed. 
Currently
+this is "7.2. Changing Ownership".
+
 Enter the chroot environment and follow the instructions from the book up to
-but *not* including the installation of the first package (which at the time of
-this writing is linux-libc-headers). Now install the more_control_helpers
-files in their proper locations on the new LFS system:
+but *not* including the installation of the first package, unless is is
+libstdc++
+
+Install libstdc++ and then compile the shadow package (currently
+chapter 8.25) and copy the su binary into its proper location:
+
+    cp src/su /usr/bin
+
+Now install the more_control_helpers files in their proper
+locations on the new LFS system:
 
     cp -a /tools/more_control_helpers/etc /etc/pkgusr &&
     chown -R 0:0 /etc/pkgusr &&
@@ -1078,10 +1069,30 @@ The GID 9999 has been chosen because the default range 
used by
 add_package_user for package user GIDs starts at 10000. Choose whatever number
 you like.
 
-Once the install group has been created you have to turn all the directories
-that packages will install files in into install directories. To make this
-easier I have compiled a list of install directories that can be found in
-the file /tools/more_control_helpers/installdirs.lst. The following command
+Once the install group has been created you have to create a temporary user
+that owns all currently installed tools:
+
+    useradd useradd -s /bin/bash -g lfs -m -k /dev/null -u 9999 lfs
+
+The UID 9999 has been chosen because the default range used by
+add_package_user for package user UIDs starts at 10000. Choose whatever number
+you like. This user will be deleted after the install process is finished.
+
+Now change the ownership of all currently installed tools and make them
+group-writeable:
+
+    chown -R lfs:install /{usr,lib,var,etc,bin,sbin,tools}
+    chmod -R ug=rwx /{usr,lib,var,etc,bin,sbin,tools}
+    case $(uname -m) in
+      x86_64) chown -R lfs:install $LFS/lib64
+      chmod -R ug=rwx $LFS/lib64
+      ;;
+    esac
+
+After this, turn all the directories that packages will install files in into
+install directories. To make this easier I have compiled a list of install
+directories that can be found in the file
+/tools/more_control_helpers/installdirs.lst. The following command
 uses this list to assign the necessary directories to the install group.
 Note that you will get several error messages because of non-existent
 directories. This is because the list contains some directories not created
@@ -1091,10 +1102,12 @@ by LFS.
 
 To be usable by package users, the directories will have to be group-writable
 and should be sticky as has been explained in the beginning of this hint.
+However, for now the sticky bit must not be set, as this would prevent the
+temporary from being overwritten by the package users.
 The following command sets the permissions appropriately.
 You will get the same error messages as for the previous command.
 
-    chmod ug=rwx,o=rxt $(cat /tools/more_control_helpers/installdirs.lst)
+    chmod ug=rwx,o=rx $(cat /tools/more_control_helpers/installdirs.lst)
 
 
  7.2 Walkthrough: Installing linux-libc-headers
@@ -1161,11 +1174,41 @@ Once you're satisfied with your setup, install the rest 
of the packages.
 The following section will help you with some problems that you will run into.
 
 
- 7.3 Known Issues with LFS Packages
- ----------------------------------
+ 7.3 Cleaning up
+ ---------------
+
+
+When you reach the end of the chroot phase, you will need to do some manual
+cleanup of file ownership. List all remaining files owned by the temporary lfs
+user by using the following command:
+
+    find / -user lfs
+
+Many of the listed files belong to the linux api headers and glibc packages.
+The following commands correct their ownership:
+
+    chown -R linux: 
/usr/include/{asm,asm-generic,drm,linux,misc,mtd,rdma,scsi,\
+    sound,video,xen}
+    chown -R glibc: /usr/include/{arpa,bits,gnu,net,netash,netatalk,netax25,\
+    neteconet,netinet,netipx,netiucv,nepacket,netrom,netrose,nfs,protocols,\
+    rpc,sys,audit,gconv}
+
+Use the apropriate package names for your install.
+
+TIP:
+    You will need to use chown -h to reassign symlinks.
+
+Finally, add the sticky bit to all install directories
+to complete the chroot stage:
+
+    chmod o+t $(cat /tools/more_control_helpers/installdirs.lst)
+
+
+ 7.4 Known Issues with LFS Packages
+ ----------------------------------
 
 This section has details on the package user related problems you will face
 when building your LFS system. You should copy the information from this
 section to the INSTALL NOTES of the relevant .project files for the packages 
 concerned, together with any of your own notes.
-- 
http://lists.linuxfromscratch.org/listinfo/hints
FAQ: http://www.linuxfromscratch.org/blfs/faq.html
Unsubscribe: See the above information page

Reply via email to