aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBruce Dubbs <bdubbs@linuxfromscratch.org>2022-09-20 12:20:58 -0500
committerBruce Dubbs <bdubbs@linuxfromscratch.org>2022-09-20 12:20:58 -0500
commit16cd09633edb80d587548ce3cd2296b4b803f210 (patch)
treea6a1c8b087bde5baeee7ad1ff0157d46697cde7d
parentcc8e57dc7ad8dd6acc35b050fbd2a92c352bb9e8 (diff)
Adjust instructions for /dev/shm when creating virtual filesystems.
Some host create /dev/shm as a tmpfs. Some have is as a symlink to a location in another directory. This change handles both cases. The change to the sysV bootscripts now creates /dev/shm as a separate tmpfs from /run. This makes LFS sysV and systemd versions treat /dev/shm the same.
-rw-r--r--bootscripts/ChangeLog3
-rw-r--r--bootscripts/lfs/init.d/mountvirtfs8
-rw-r--r--chapter01/changelog.xml11
-rw-r--r--chapter07/cleanup.xml3
-rw-r--r--chapter07/kernfs.xml7
-rw-r--r--chapter10/fstab.xml1
-rw-r--r--chapter11/afterlfs.xml7
-rw-r--r--packages.ent2
8 files changed, 36 insertions, 6 deletions
diff --git a/bootscripts/ChangeLog b/bootscripts/ChangeLog
index c1b590568..1fca16a65 100644
--- a/bootscripts/ChangeLog
+++ b/bootscripts/ChangeLog
@@ -1,3 +1,6 @@
+2022-09-30 Bruce Dubbs <bdubbs@linuxfromscratch.org>
+ * Mount /dev/shm as a tmpfs.
+
2022-07-23 Thomas Trepl <thomas@linuxfromscratch.org>
* Mark an raid array clean when root (/) has been remounted
r/o when system goes down. Otherwise, array does remain
diff --git a/bootscripts/lfs/init.d/mountvirtfs b/bootscripts/lfs/init.d/mountvirtfs
index 639634377..21d98a05d 100644
--- a/bootscripts/lfs/init.d/mountvirtfs
+++ b/bootscripts/lfs/init.d/mountvirtfs
@@ -38,8 +38,8 @@ case "${1}" in
mount /run || failed=1
fi
- mkdir -p /run/lock /run/shm
- chmod 1777 /run/shm /run/lock
+ mkdir -p /run/lock
+ chmod 1777 /run/lock
log_info_msg "Mounting virtual file systems: ${INFO}/run"
@@ -58,7 +58,9 @@ case "${1}" in
mount -o mode=0755,nosuid /dev || failed=1
fi
- ln -sfn /run/shm /dev/shm
+ mkdir -p /dev/shm
+ log_info_msg2 " ${INFO}/dev/shm"
+ mount -o nosuid,nodev /dev/shm || failed=1
(exit ${failed})
evaluate_retval
diff --git a/chapter01/changelog.xml b/chapter01/changelog.xml
index 3b0651f16..c3569d0a6 100644
--- a/chapter01/changelog.xml
+++ b/chapter01/changelog.xml
@@ -41,6 +41,17 @@
-->
<listitem>
+ <para>2022-09-20</para>
+ <itemizedlist>
+ <listitem>
+ <para>[bdubbs] - Adappt instructions depending on
+ host setup of /dev/shm when creating virtual filesystems
+ for chroot.</para>
+ </listitem>
+ </itemizedlist>
+ </listitem>
+
+ <listitem>
<para>2022-09-15</para>
<itemizedlist>
<listitem>
diff --git a/chapter07/cleanup.xml b/chapter07/cleanup.xml
index 7946d84eb..d5396208c 100644
--- a/chapter07/cleanup.xml
+++ b/chapter07/cleanup.xml
@@ -95,7 +95,8 @@
<para>Before making a backup, unmount the virtual file systems:</para>
-<screen role="nodump"><userinput>umount $LFS/dev/pts
+<screen role="nodump"><userinput>[ mountpoint -q $LFS/dev/shm ] &amp;&amp; umount $LFS/dev/shm
+umount $LFS/dev/pts
umount $LFS/{sys,proc,run,dev}</userinput></screen>
<para>
diff --git a/chapter07/kernfs.xml b/chapter07/kernfs.xml
index 64db54c24..c9721113d 100644
--- a/chapter07/kernfs.xml
+++ b/chapter07/kernfs.xml
@@ -89,8 +89,15 @@ mount -vt tmpfs tmpfs $LFS/run</userinput></screen>
The /run tmpfs was mounted above so in this case only a
directory needs to be created.</para>
+ <para>In other cases <filename>/dev/shm</filename> is a mountpoint
+ for a tmpfs. In that case the mount of /dev above will only create
+ /dev/shm in the chroot environment as a directory. In this situation
+ we explicitly mount a tmpfs,</para>
+
<screen><userinput>if [ -h $LFS/dev/shm ]; then
mkdir -pv $LFS/$(readlink $LFS/dev/shm)
+else
+ mount -t tmpfs -o nosuid,nodev tmpfs $LFS/dev/shm
fi</userinput></screen>
</sect2>
diff --git a/chapter10/fstab.xml b/chapter10/fstab.xml
index ebfae3aaf..f78b234db 100644
--- a/chapter10/fstab.xml
+++ b/chapter10/fstab.xml
@@ -32,6 +32,7 @@ sysfs /sys sysfs nosuid,noexec,nodev 0 0
devpts /dev/pts devpts gid=5,mode=620 0 0
tmpfs /run tmpfs defaults 0 0
devtmpfs /dev devtmpfs mode=0755,nosuid 0 0
+tmpfs /dev/shm tmpfs nosuid,nodev 0 0
# End /etc/fstab</literal>
EOF</userinput></screen>
diff --git a/chapter11/afterlfs.xml b/chapter11/afterlfs.xml
index 4afc8ecf7..279cc1108 100644
--- a/chapter11/afterlfs.xml
+++ b/chapter11/afterlfs.xml
@@ -129,7 +129,12 @@ mounttype dev/pts devpts devpts -o gid=5,mode=620
mounttype proc proc proc
mounttype sys sysfs sysfs
mounttype run tmpfs run
-mkdir $LFS/run/shm
+if [ -h $LFS/dev/shm ]; then
+ mkdir -pv $LFS/$(readlink $LFS/dev/shm)
+else
+ mounttype dev/shm tmpfs tmpfs -o nosuid,nodev
+fi
+
#mountbind usr/src
#mountbind boot
#mountbind home
diff --git a/packages.ent b/packages.ent
index 0fc7361a0..372603934 100644
--- a/packages.ent
+++ b/packages.ent
@@ -382,7 +382,7 @@
<!ENTITY less-fin-du "4.2 MB">
<!ENTITY less-fin-sbu "less than 0.1 SBU">
-<!ENTITY lfs-bootscripts-version "20220723"> <!-- Scripts depend on this format -->
+<!ENTITY lfs-bootscripts-version "20220920"> <!-- Scripts depend on this format -->
<!ENTITY lfs-bootscripts-size "BOOTSCRIPTS-SIZE KB">
<!ENTITY lfs-bootscripts-url "&downloads-root;lfs-bootscripts-&lfs-bootscripts-version;.tar.xz">
<!ENTITY lfs-bootscripts-md5 "BOOTSCRIPTS-MD5SUM">