From cacb470c97dd29c34e70826c12326694cda6d900 Mon Sep 17 00:00:00 2001 From: Xi Ruoyao Date: Sat, 11 Jan 2025 23:17:54 +0800 Subject: [PATCH 1/2] aboutlfs: Set umask to 022 I know some distros are using a different default and we are having reports of some mysterious permission issue via lfs-support those I highly suspect as some umask issue. Let's just explicitly set it (like setting $LFS) to protect us from such distros without changing every "mkdir -pv" to "install -vdm755". --- chapter02/aboutlfs.xml | 25 +++++++++++++++++++------ 1 file changed, 19 insertions(+), 6 deletions(-) diff --git a/chapter02/aboutlfs.xml b/chapter02/aboutlfs.xml index 4f3f6ba46..64229f114 100644 --- a/chapter02/aboutlfs.xml +++ b/chapter02/aboutlfs.xml @@ -8,7 +8,7 @@ - Setting The $LFS Variable + Setting the $LFS Variable and the Umask Throughout this book, the environment variable LFS will be used several times. You should ensure that this variable is always defined @@ -28,8 +28,14 @@ /mnt/lfs (or whatever value the variable was set to) when it processes the command line. + Now setting the file mode creation mask (umask) to + 022 in case the host distro uses a different + default: + +umask 022 - Do not forget to check that LFS is set whenever + Do not forget to check that LFS is set and the + umask is set to 022 whenever you leave and reenter the current working environment (such as when doing a su to root or another user). Check that the LFS variable is set up @@ -39,10 +45,17 @@ Make sure the output shows the path to your LFS system's build location, which is /mnt/lfs if the - provided example was followed. If the output is incorrect, use the command - given earlier on this page to set $LFS to the correct - directory name. - + provided example was followed. + + Check that the umask is set up properly with: + + umask + + The output should be 022. + + If any output of these two commands is incorrect, use the command + given earlier on this page to set $LFS to the correct + directory name and set umask to 022. One way to ensure that the LFS variable is always set is to edit the .bash_profile file in both your From 68b56a3c3303ceff24ac3373d17ac5401354527b Mon Sep 17 00:00:00 2001 From: Xi Ruoyao Date: Sat, 11 Jan 2025 23:31:54 +0800 Subject: [PATCH 2/2] creatingminlayout: Set the owner and permission of $LFS The host distro may have an insane default for root_owner and/or root_perms in /etc/mke2fs.conf, so let's make it sane on our own. Note that MKE2FS_CONFIG=/dev/null makes mke2fs refuse to run so we cannot suppress the host mke2fs.conf. --- chapter04/creatingminlayout.xml | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/chapter04/creatingminlayout.xml b/chapter04/creatingminlayout.xml index d4bfe9af1..96f0c591a 100644 --- a/chapter04/creatingminlayout.xml +++ b/chapter04/creatingminlayout.xml @@ -18,6 +18,15 @@ location. We do this so those temporary programs will be overwritten when the final versions are built in . + At first, set the owner and permission mode of the + $LFS directory (i.e. the root + directory in the newly created file system for the LFS system) to + &root; and 755 in case the host distro has been + configured to use a different default for mkfs: + +chown root:root $LFS +chmod 755 $LFS + Create the required directory layout by issuing the following commands as root: