Remove section disussing configuration without a network card.

Update boot scripts to unmount network file systems before bringing down the network.



git-svn-id: http://svn.linuxfromscratch.org/LFS/trunk/BOOK@11260 4aa44e1e-78dd-0310-a6d2-fbcd4c07a689
This commit is contained in:
Bruce Dubbs 2017-06-24 19:33:48 +00:00
parent b2a5112963
commit 94cea1d886
7 changed files with 53 additions and 88 deletions

View File

@ -1,3 +1,7 @@
2015-06-24 Bruce Dubbs <bdubbs@linuxfromscratch.org>
* Unmount network file systems before bringing down the network
* Spell out some mount/umount options
2017-03-25 DJ Lucas <dj@linuxfromscratch.org> 2017-03-25 DJ Lucas <dj@linuxfromscratch.org>
* Bash-4.4 changes no longer allow continue in function to pass to calling * Bash-4.4 changes no longer allow continue in function to pass to calling
loop. loop.

View File

@ -33,7 +33,7 @@
case "${1}" in case "${1}" in
start) start)
log_info_msg "Remounting root file system in read-write mode..." log_info_msg "Remounting root file system in read-write mode..."
mount -o remount,rw / >/dev/null mount --options remount,rw / >/dev/null
evaluate_retval evaluate_retval
# Remove fsck-related file system watermarks. # Remove fsck-related file system watermarks.
@ -46,7 +46,7 @@ case "${1}" in
# their option list. _netdev denotes a network filesystem. # their option list. _netdev denotes a network filesystem.
log_info_msg "Mounting remaining file systems..." log_info_msg "Mounting remaining file systems..."
mount -a -O no_netdev >/dev/null mount --all --test-opts no_netdev >/dev/null
evaluate_retval evaluate_retval
exit $failed exit $failed
;; ;;
@ -54,11 +54,12 @@ case "${1}" in
stop) stop)
# Don't unmount virtual file systems like /run # Don't unmount virtual file systems like /run
log_info_msg "Unmounting all other currently mounted file systems..." log_info_msg "Unmounting all other currently mounted file systems..."
umount -a -d -r -t notmpfs,nosysfs,nodevtmpfs,noproc,nodevpts >/dev/null umount --all --detach-loop --read-only \
--types notmpfs,nosysfs,nodevtmpfs,noproc,nodevpts >/dev/null
evaluate_retval evaluate_retval
# Make sure / is mounted read only (umount bug) # Make sure / is mounted read only (umount bug)
mount -o remount,ro / mount --test-opts remount,ro /
# Make all LVM volume groups unavailable, if appropriate # Make all LVM volume groups unavailable, if appropriate
# This fails if swap or / are on an LVM partition # This fails if swap or / are on an LVM partition

View File

@ -45,6 +45,9 @@ case "${1}" in
;; ;;
stop) stop)
# Unmount any network mounted file systems
umount --all --force --types nfs,cifs,nfs4
# Reverse list # Reverse list
net_files="" net_files=""
for file in /etc/sysconfig/ifconfig.* for file in /etc/sysconfig/ifconfig.*

View File

@ -42,6 +42,20 @@
<listitem revision="sysv"> or <listitem revision="systemd"> as <listitem revision="sysv"> or <listitem revision="systemd"> as
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 revision='sysv'>
<para>2017-06-24</para>
<itemizedlist>
<listitem>
<para>[bdubbs] - Remove section disussing configuration
without a network card.</para>
</listitem>
<listitem>
<para>[bdubbs] - Update boot scripts to unmount network
file systems before bringing down the network.</para>
</listitem>
</itemizedlist>
</listitem>
<listitem> <listitem>
<para>2017-06-21</para> <para>2017-06-21</para>
<itemizedlist> <itemizedlist>

View File

@ -13,7 +13,7 @@
<indexterm zone="ch-scripts-network"> <indexterm zone="ch-scripts-network">
<primary sortas="d-network">network</primary> <primary sortas="d-network">network</primary>
<secondary>configuring</secondary></indexterm> <secondary>configuring</secondary></indexterm>
<!--
<para>This section only applies if a network card is to be <para>This section only applies if a network card is to be
configured.</para> configured.</para>
@ -23,7 +23,7 @@
from all run-level directories (<filename from all run-level directories (<filename
class="directory">/etc/rc.d/rc*.d</filename>) after the bootscripts are class="directory">/etc/rc.d/rc*.d</filename>) after the bootscripts are
installed in <xref linkend="ch-scripts-bootscripts"/>.</para> installed in <xref linkend="ch-scripts-bootscripts"/>.</para>
-->
<sect2> <sect2>
<title>Creating Network Interface Configuration Files</title> <title>Creating Network Interface Configuration Files</title>
@ -31,20 +31,18 @@
usually depends on the files in <filename usually depends on the files in <filename
class="directory">/etc/sysconfig/</filename>. This directory should class="directory">/etc/sysconfig/</filename>. This directory should
contain a file for each interface to be configured, such as contain a file for each interface to be configured, such as
<filename>ifconfig.xyz</filename>, where <quote>xyz</quote> is required to <filename>ifconfig.xyz</filename>, where <quote>xyz</quote> should describe
be a Network Card Interface name (e.g. eth0). Inside this file are the network card. The interface name (e.g. eth0) is usually appropriate.
attributes to this interface, such as its IP address(es), subnet masks, and Inside this file are attributes to this interface, such as its IP
so forth. It is necessary that the stem of the filename be address(es), subnet masks, and so forth. It is necessary that the stem of
<emphasis>ifconfig</emphasis>.</para> the filename be <emphasis>ifconfig</emphasis>.</para>
<note><para>If the procedure in the previous section was not used, Udev <note><para>If the procedure in the previous section was not used, Udev
will assign network card interface names based on system physical will assign network card interface names based on system physical
characteristics such as enp2s1. If you are not sure what your interface characteristics such as enp2s1. If you are not sure what your interface
name is, you can always run <command>ip link</command> after you have name is, you can always run <command>ip link</command> or <command>ls
booted your system. Again, it is important that ifconfig.xyz is named /sys/class/net</command> after you have booted your system.
after correct network card interface name (e.g. ifconfig.enp2s1 or </para></note>
ifconfig.eth0) or your network interface will not be initialized during
the boot process.</para></note>
<para>The following command creates a sample file for the <para>The following command creates a sample file for the
<emphasis>eth0</emphasis> device with a static IP address:</para> <emphasis>eth0</emphasis> device with a static IP address:</para>
@ -98,64 +96,6 @@ EOF</userinput></screen>
<para>For more information see the <command>ifup</command> man page.</para> <para>For more information see the <command>ifup</command> man page.</para>
</sect2> </sect2>
<!--
<sect2 id="systemd-net-enable">
<title>Configuring the Network Interface Card at boot (systemd)</title>
<para>Enabling of the network interface card configuration
in systemd is done per interface. To enable network interface card
configuration at boot, run:</para>
<screen><userinput>systemctl enable ifupdown@eth0</userinput></screen>
<para>To disable a previously enabled network interface
card configuration at boot, run:</para>
<screen role="nodump"><userinput>systemctl disable ifupdown@eth0</userinput></screen>
<para>To manually start the network interface card configuration,
run:</para>
<screen role="nodump"><userinput>systemctl start ifupdown@eth0</userinput></screen>
<para>Replace eth0 with the correct network interface card
name as described on the beginning of this page.</para>
<note><para>These procedures require the configuration files as specified
in the previous section.</para></note>
<note><para>The network card can also be started or stopped
with the traditional <command>ifup &lt;device&gt;</command> or
<command>ifdown &lt;device&gt;</command> commands.</para></note>
</sect2>
<sect2 id="systemd2-net-enable">
<title>Configuring the Network Interface Card for systemd-networkd</title>
<para>An alternative way to configure a NIC when booting with with
systemd is to create a configuration file recognized by the
systemd-networkd daemon. To configure the device create a file similar
to this:</para>
<screen role="nodump"><userinput>cat &gt; /etc/systemd/network/10-static-eth0.network &lt;&lt; "EOF"
[Match]
Name=eth0
[Network]
Address=192.168.0.2/24
Gateway=192.168.0.1
EOF</userinput></screen>
<para>You can use multiple .network files if desired. You can also specify
DHCP=yes instead of the Address and Gateway settings. See the man page for
systemd.network for more details,</para>
<note><para>If this method is used, be sure to disable ifupdown@eth0 as
described in the previous section (if it was enabled).</para></note>
</sect2>
-->
<sect2 id="resolv.conf"> <sect2 id="resolv.conf">
<title>Creating the /etc/resolv.conf File</title> <title>Creating the /etc/resolv.conf File</title>
@ -163,11 +103,10 @@ EOF</userinput></screen>
<primary sortas="e-/etc/resolv.conf">/etc/resolv.conf</primary> <primary sortas="e-/etc/resolv.conf">/etc/resolv.conf</primary>
</indexterm> </indexterm>
<para>If the system is going to be connected to the Internet, it will <para>The system will need some means of obtaining Domain Name Service
need some means of Domain Name Service (DNS) name resolution to (DNS) name resolution to resolve Internet domain names to IP addresses, and
resolve Internet domain names to IP addresses, and vice versa. This is vice versa. This is best achieved by placing the IP address of the DNS
best achieved by placing the IP address of the DNS server, available server, available from the ISP or network administrator, into
from the ISP or network administrator, into
<filename>/etc/resolv.conf</filename>. Create the file by running the <filename>/etc/resolv.conf</filename>. Create the file by running the
following:</para> following:</para>
@ -192,7 +131,9 @@ EOF</userinput></screen>
second <emphasis>nameserver</emphasis> line from the file. The IP address second <emphasis>nameserver</emphasis> line from the file. The IP address
may also be a router on the local network.</para> may also be a router on the local network.</para>
<note><para>The Google Public IPv4 DNS addresses are 8.8.8.8 and 8.8.4.4.</para></note> <note>
<para>The Google Public IPv4 DNS addresses are 8.8.8.8 and 8.8.4.4.</para>
</note>
</sect2> </sect2>
@ -264,7 +205,7 @@ EOF</userinput></screen>
<para>Create the <filename>/etc/hosts</filename> file by running:</para> <para>Create the <filename>/etc/hosts</filename> file by running:</para>
<screen><userinput>cat &gt; /etc/hosts &lt;&lt; "EOF" <screen><userinput>cat &gt; /etc/hosts &lt;&lt; "EOF"
<literal># Begin /etc/hosts (network card version) <literal># Begin /etc/hosts
127.0.0.1 localhost 127.0.0.1 localhost
127.0.1.1 <replaceable>&lt;FQDN&gt;</replaceable> <replaceable>&lt;HOSTNAME&gt;</replaceable> 127.0.1.1 <replaceable>&lt;FQDN&gt;</replaceable> <replaceable>&lt;HOSTNAME&gt;</replaceable>
@ -273,7 +214,7 @@ EOF</userinput></screen>
ff02::1 ip6-allnodes ff02::1 ip6-allnodes
ff02::2 ip6-allrouters ff02::2 ip6-allrouters
# End /etc/hosts (network card version)</literal> # End /etc/hosts</literal>
EOF</userinput></screen> EOF</userinput></screen>
<para>The <replaceable>&lt;192.168.1.1&gt;</replaceable>, <para>The <replaceable>&lt;192.168.1.1&gt;</replaceable>,
@ -283,6 +224,8 @@ EOF</userinput></screen>
network/system administrator and the machine will be connected to an network/system administrator and the machine will be connected to an
existing network). The optional alias name(s) can be omitted.</para> existing network). The optional alias name(s) can be omitted.</para>
<!-- This is not very useful
<para>If a network card is not going to be configured, create the <para>If a network card is not going to be configured, create the
<filename>/etc/hosts</filename> file by running:</para> <filename>/etc/hosts</filename> file by running:</para>
@ -296,7 +239,7 @@ ff02::1 ip6-allnodes
ff02::2 ip6-allrouters ff02::2 ip6-allrouters
# End /etc/hosts (no network card version)</literal> # End /etc/hosts (no network card version)</literal>
EOF</userinput></screen> EOF</userinput></screen> -->
</sect2> </sect2>

View File

@ -1,13 +1,13 @@
<!ENTITY version "SVN-20170621"> <!ENTITY version "SVN-20170624">
<!ENTITY short-version "svn"> <!-- Used below in &blfs-book; <!ENTITY short-version "svn"> <!-- Used below in &blfs-book;
Change to x.y for release but not -rc releases --> Change to x.y for release but not -rc releases -->
<!ENTITY generic-version "development"> <!-- Use "development" or "x.y[-pre{x}]" --> <!ENTITY generic-version "development"> <!-- Use "development" or "x.y[-pre{x}]" -->
<!ENTITY versiond "20170602-systemd"> <!ENTITY versiond "20170621-systemd">
<!ENTITY short-versiond "systemd"> <!ENTITY short-versiond "systemd">
<!ENTITY generic-versiond "systemd"> <!ENTITY generic-versiond "systemd">
<!ENTITY releasedate "June 21, 2017"> <!ENTITY releasedate "June 24, 2017">
<!ENTITY copyrightdate "1999-2017"><!-- jhalfs needs a literal dash, not &ndash; --> <!ENTITY copyrightdate "1999-2017"><!-- jhalfs needs a literal dash, not &ndash; -->
<!ENTITY milestone "8.1"> <!ENTITY milestone "8.1">

View File

@ -366,7 +366,7 @@
<!ENTITY less-ch6-du "3.5 MB"> <!ENTITY less-ch6-du "3.5 MB">
<!ENTITY less-ch6-sbu "less than 0.1 SBU"> <!ENTITY less-ch6-sbu "less than 0.1 SBU">
<!ENTITY lfs-bootscripts-version "20170325"> <!-- Scripts depend on this format --> <!ENTITY lfs-bootscripts-version "20170624"> <!-- 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.bz2"> <!ENTITY lfs-bootscripts-url "&downloads-root;lfs-bootscripts-&lfs-bootscripts-version;.tar.bz2">
<!ENTITY lfs-bootscripts-md5 "BOOTSCRIPTS-MD5SUM"> <!ENTITY lfs-bootscripts-md5 "BOOTSCRIPTS-MD5SUM">