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.
This commit is contained in:
Bruce Dubbs 2022-09-20 12:20:58 -05:00
parent cc8e57dc7a
commit 16cd09633e
8 changed files with 36 additions and 6 deletions

View File

@ -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> 2022-07-23 Thomas Trepl <thomas@linuxfromscratch.org>
* Mark an raid array clean when root (/) has been remounted * Mark an raid array clean when root (/) has been remounted
r/o when system goes down. Otherwise, array does remain r/o when system goes down. Otherwise, array does remain

View File

@ -38,8 +38,8 @@ case "${1}" in
mount /run || failed=1 mount /run || failed=1
fi fi
mkdir -p /run/lock /run/shm mkdir -p /run/lock
chmod 1777 /run/shm /run/lock chmod 1777 /run/lock
log_info_msg "Mounting virtual file systems: ${INFO}/run" log_info_msg "Mounting virtual file systems: ${INFO}/run"
@ -58,7 +58,9 @@ case "${1}" in
mount -o mode=0755,nosuid /dev || failed=1 mount -o mode=0755,nosuid /dev || failed=1
fi 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}) (exit ${failed})
evaluate_retval evaluate_retval

View File

@ -40,6 +40,17 @@
appropriate for the entry or if needed the entire day's listitem. appropriate for the entry or if needed the entire day's listitem.
--> -->
<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> <listitem>
<para>2022-09-15</para> <para>2022-09-15</para>
<itemizedlist> <itemizedlist>

View File

@ -95,7 +95,8 @@
<para>Before making a backup, unmount the virtual file systems:</para> <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> umount $LFS/{sys,proc,run,dev}</userinput></screen>
<para> <para>

View File

@ -89,8 +89,15 @@ mount -vt tmpfs tmpfs $LFS/run</userinput></screen>
The /run tmpfs was mounted above so in this case only a The /run tmpfs was mounted above so in this case only a
directory needs to be created.</para> 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 <screen><userinput>if [ -h $LFS/dev/shm ]; then
mkdir -pv $LFS/$(readlink $LFS/dev/shm) mkdir -pv $LFS/$(readlink $LFS/dev/shm)
else
mount -t tmpfs -o nosuid,nodev tmpfs $LFS/dev/shm
fi</userinput></screen> fi</userinput></screen>
</sect2> </sect2>

View File

@ -32,6 +32,7 @@ sysfs /sys sysfs nosuid,noexec,nodev 0 0
devpts /dev/pts devpts gid=5,mode=620 0 0 devpts /dev/pts devpts gid=5,mode=620 0 0
tmpfs /run tmpfs defaults 0 0 tmpfs /run tmpfs defaults 0 0
devtmpfs /dev devtmpfs mode=0755,nosuid 0 0 devtmpfs /dev devtmpfs mode=0755,nosuid 0 0
tmpfs /dev/shm tmpfs nosuid,nodev 0 0
# End /etc/fstab</literal> # End /etc/fstab</literal>
EOF</userinput></screen> EOF</userinput></screen>

View File

@ -129,7 +129,12 @@ mounttype dev/pts devpts devpts -o gid=5,mode=620
mounttype proc proc proc mounttype proc proc proc
mounttype sys sysfs sysfs mounttype sys sysfs sysfs
mounttype run tmpfs run 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 usr/src
#mountbind boot #mountbind boot
#mountbind home #mountbind home

View File

@ -382,7 +382,7 @@
<!ENTITY less-fin-du "4.2 MB"> <!ENTITY less-fin-du "4.2 MB">
<!ENTITY less-fin-sbu "less than 0.1 SBU"> <!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-size "BOOTSCRIPTS-SIZE KB">
<!ENTITY lfs-bootscripts-url "&downloads-root;lfs-bootscripts-&lfs-bootscripts-version;.tar.xz"> <!ENTITY lfs-bootscripts-url "&downloads-root;lfs-bootscripts-&lfs-bootscripts-version;.tar.xz">
<!ENTITY lfs-bootscripts-md5 "BOOTSCRIPTS-MD5SUM"> <!ENTITY lfs-bootscripts-md5 "BOOTSCRIPTS-MD5SUM">