From 1118b1757d67c5e7deb4c9e4b864b00f9d8a8b0c Mon Sep 17 00:00:00 2001 From: Bruce Dubbs Date: Tue, 24 May 2016 21:24:59 +0000 Subject: [PATCH] Create branches/merge in svn repo fo rtesting of merged LFS books git-svn-id: http://svn.linuxfromscratch.org/LFS/branches/merge@11073 4aa44e1e-78dd-0310-a6d2-fbcd4c07a689 --- Makefile | 75 ++++++- chapter01/changelog.xml | 6 + chapter01/how.xml | 2 +- chapter01/whatsnew.xml | 12 +- chapter02/creatingpartition.xml | 2 +- chapter03/packages.xml | 44 +--- chapter03/patches.xml | 10 +- chapter05/gcc-pass1.xml | 2 +- chapter05/glibc.xml | 40 +--- chapter06/acl.xml | 6 +- chapter06/attr.xml | 5 +- chapter06/autoconf.xml | 2 +- chapter06/chapter06d.xml | 87 ++++++++ chapter06/coreutils.xml | 8 +- chapter06/createfiles.xml | 54 ++++- chapter06/dbus.xml | 63 ++++-- chapter06/diffutils.xml | 2 +- chapter06/e2fsprogs.xml | 13 +- chapter06/findutils.xml | 15 +- chapter06/glibc.xml | 48 +--- chapter06/gmp.xml | 2 +- chapter06/m4.xml | 2 +- chapter06/man-db.xml | 4 + chapter06/mpfr.xml | 5 - chapter06/ncurses.xml | 6 +- chapter06/pkgmgt.xml | 24 +- chapter06/procps.xml | 10 +- chapter06/readline.xml | 2 +- chapter06/systemd.xml | 381 ++++++++++++++++++++------------ chapter06/util-linux.xml | 14 +- chapter07/chapter07d.xml | 25 +++ chapter07/clock.xml | 104 +++++++++ chapter07/consoled.xml | 137 ++++++++++++ chapter07/etcshellsd.xml | 48 ++++ chapter07/introductiond.xml | 73 ++++++ chapter07/locale.xml | 152 +++++++++++++ chapter07/networkd.xml | 270 ++++++++++++++++++++++ chapter07/symlinksd.xml | 63 ++++++ chapter07/sysd-custom.xml | 253 --------------------- chapter07/systemd-custom.xml | 175 +++++++++++++++ chapter07/udevd.xml | 337 ++++++++++++++++++++++++++++ chapter08/fstab.xml | 29 ++- chapter08/grub.xml | 12 +- chapter08/kernel.xml | 57 ++++- chapter09/reboot.xml | 4 +- chapter09/theend.xml | 42 +++- general.ent | 20 +- indexd.xml | 48 ++++ packages.ent | 16 ++ patches.ent | 5 + prologue/bookinfo.xml | 16 +- 51 files changed, 2192 insertions(+), 640 deletions(-) create mode 100644 chapter06/chapter06d.xml create mode 100644 chapter07/chapter07d.xml create mode 100644 chapter07/clock.xml create mode 100644 chapter07/consoled.xml create mode 100644 chapter07/etcshellsd.xml create mode 100644 chapter07/introductiond.xml create mode 100644 chapter07/locale.xml create mode 100644 chapter07/networkd.xml create mode 100644 chapter07/symlinksd.xml delete mode 100644 chapter07/sysd-custom.xml create mode 100644 chapter07/systemd-custom.xml create mode 100644 chapter07/udevd.xml create mode 100644 indexd.xml diff --git a/Makefile b/Makefile index c6f8f8e02..c1a0d8409 100644 --- a/Makefile +++ b/Makefile @@ -1,4 +1,5 @@ BASEDIR = ~/lfs-book +SYSDDIR = ~/lfs-systemd DUMPDIR = ~/lfs-commands RENDERTMP = $(HOME)/tmp CHUNK_QUIET = 1 @@ -13,11 +14,20 @@ else Q = @ endif -lfs: validate profile-html +sysv: validate profile-html + $(Q)xsltproc --nonet \ + --output $(RENDERTMP)/lfs-html2.xml \ + --stringparam profile.revision sysv \ + stylesheets/lfs-xsl/profile.xsl \ + $(RENDERTMP)/lfs-html.xml + @echo "Generating chunked XHTML files..." - $(Q)xsltproc --nonet -stringparam chunk.quietly $(CHUNK_QUIET) \ - -stringparam rootid "$(ROOT_ID)" -stringparam base.dir $(BASEDIR)/ \ - stylesheets/lfs-chunked.xsl $(RENDERTMP)/lfs-html.xml + $(Q)xsltproc --nonet \ + --stringparam chunk.quietly $(CHUNK_QUIET) \ + --stringparam rootid "$(ROOT_ID)" \ + --stringparam base.dir $(BASEDIR)/ \ + stylesheets/lfs-chunked.xsl \ + $(RENDERTMP)/lfs-html2.xml @echo "Copying CSS code and images..." $(Q)if [ ! -e $(BASEDIR)/stylesheets ]; then \ @@ -37,11 +47,51 @@ lfs: validate profile-html tidy -config tidy.conf $$filename; \ true; \ /bin/bash obfuscate.sh $$filename; \ - sed -i -e "s@text/html@application/xhtml+xml@g" $$filename; \ + sed -e "s@text/html@application/xhtml+xml@g" \ + -e "s/\xa9/\©/ " \ + -i $$filename; \ done; $(Q)$(MAKE) $(BASEDIR)/wget-list $(BASEDIR)/md5sums +systemd: validated profile-html + $(Q)xsltproc --nonet \ + --output $(RENDERTMP)/lfs-html2.xml \ + --stringparam profile.revision systemd \ + stylesheets/lfs-xsl/profile.xsl \ + $(RENDERTMP)/lfs-html.xml + + @echo "Generating chunked XHTML files..." + $(Q)xsltproc --nonet \ + --stringparam chunk.quietly $(CHUNK_QUIET) \ + --stringparam rootid "$(ROOT_ID)" \ + --stringparam base.dir $(SYSDDIR)/ \ + stylesheets/lfs-chunked.xsl \ + $(RENDERTMP)/lfs-html2.xml + + @echo "Copying CSS code and images..." + $(Q)if [ ! -e $(SYSDDIR)/stylesheets ]; then \ + mkdir -p $(SYSDDIR)/stylesheets; \ + fi; + $(Q)cp stylesheets/lfs-xsl/*.css $(SYSDDIR)/stylesheets + + $(Q)if [ ! -e $(SYSDDIR)/images ]; then \ + mkdir -p $(SYSDDIR)/images; \ + fi; + $(Q)cp images/*.png $(SYSDDIR)/images + + @echo "Running Tidy and obfuscate.sh..." + $(Q)for filename in `find $(SYSDDIR) -name "*.html"`; do \ + tidy -config tidy.conf $$filename; \ + true; \ + /bin/bash obfuscate.sh $$filename; \ + sed -e "s@text/html@application/xhtml+xml@g" \ + -e "s/\xa9/\©/ " \ + -i $$filename; \ + done; + +# $(Q)$(MAKE) $(SYSDDIR)/wget-list $(SYSDDIR)/md5sumsd + pdf: validate @echo "Generating profiled XML for PDF..." $(Q)xsltproc --nonet --stringparam profile.condition pdf \ @@ -94,7 +144,13 @@ validate: tmpdir $(Q)./aux-file-data.sh $(RENDERTMP)/lfs-full.xml @echo "Validation complete." -profile-html: validate +validated: tmpdir + @echo "Validating the book..." + $(Q)xmllint --nonet --noent --xinclude --postvalid \ + -o $(RENDERTMP)/lfs-full.xml indexd.xml + @echo "Validation complete." + +profile-html: @echo "Generating profiled XML for XHTML..." $(Q)xsltproc --nonet --stringparam profile.condition html \ --output $(RENDERTMP)/lfs-html.xml stylesheets/lfs-xsl/profile.xsl \ @@ -117,6 +173,13 @@ $(BASEDIR)/md5sums: stylesheets/wget-list.xsl chapter03/chapter03.xml packages.e "s/BOOTSCRIPTS-MD5SUM/$(shell md5sum lfs-bootscripts*.tar.bz2 | cut -d' ' -f1)/" \ $(BASEDIR)/md5sums +md5sumsd: $(SYSDDIR)/md5sumsd +$(SYSDDIR)/md5sumsd: stylesheets/wget-list.xsl chapter03/chapter03.xml packages.ent patches.ent + @echo "Generating md5sum file..." + $(Q)mkdir -p $(SYSDDIR) + $(Q)xsltproc --xinclude --nonet --output $(SYSDDIR)/md5sums \ + stylesheets/md5sum.xsl chapter03/chapter03.xml + dump-commands: validate @echo "Dumping book commands..." $(Q)xsltproc --output $(DUMPDIR)/ \ diff --git a/chapter01/changelog.xml b/chapter01/changelog.xml index 430fb33a1..ed0d08870 100644 --- a/chapter01/changelog.xml +++ b/chapter01/changelog.xml @@ -18,6 +18,8 @@ Below is a list of changes made since the previous release of the book. + A test + Changelog Entries: @@ -34,6 +36,10 @@ + + Note: If a change is only specific to sysv or systemd, then use + or as + appropriate for the entry or if needed the entire day's listitem. --> 2016-05-16 diff --git a/chapter01/how.xml b/chapter01/how.xml index c4f3a0a8b..a92a3fad7 100644 --- a/chapter01/how.xml +++ b/chapter01/how.xml @@ -81,7 +81,7 @@ for package compilations to complete, you can continue using your computer as normal. - To finish the installation, the LFS-Bootscripts are set up in + To finish the installation, the basic system configuration is set up in , and the kernel and boot loader are set up in . contains information on continuing the LFS experience beyond this book. diff --git a/chapter01/whatsnew.xml b/chapter01/whatsnew.xml index e043ec2a4..04b2f10c0 100644 --- a/chapter01/whatsnew.xml +++ b/chapter01/whatsnew.xml @@ -58,10 +58,13 @@ DejaGNU &dejagnu-version; + - - - + diff --git a/chapter02/creatingpartition.xml b/chapter02/creatingpartition.xml index 6d34531b3..4aa57e6c5 100644 --- a/chapter02/creatingpartition.xml +++ b/chapter02/creatingpartition.xml @@ -36,7 +36,7 @@ additional software will probably be installed which will require additional space. A 20 GB partition is a reasonable size to provide for growth. The LFS system itself will not take up this much room. A large portion of this - requirement is to provide sufficient free temporary storagei as well as + requirement is to provide sufficient free temporary storage as well as for adding additional capabilities after LFS is complete. Additionally, compiling packages can require a lot of disk space which will be reclaimed after the package is installed. diff --git a/chapter03/packages.xml b/chapter03/packages.xml index dfef86115..40febc0ae 100644 --- a/chapter03/packages.xml +++ b/chapter03/packages.xml @@ -112,8 +112,8 @@ MD5 sum: &coreutils-md5; - + DejaGNU (&dejagnu-version;) - &dejagnu-size;: @@ -140,22 +140,14 @@ - + Eudev (&eudev-version;) - &eudev-size;: Download: MD5 sum: &eudev-md5; - + E2fsprogs (&e2fsprogs-version;) - &e2fsprogs-size;: @@ -503,22 +495,6 @@ - - Patch (&patch-version;) - &patch-size;: @@ -594,7 +570,7 @@ - + Sysklogd (&sysklogd-version;) - &sysklogd-size;: Home page: @@ -602,8 +578,8 @@ MD5 sum: &sysklogd-md5; - - + + Sysvinit (&sysvinit-version;) - &sysvinit-size;: Home page: diff --git a/chapter03/patches.xml b/chapter03/patches.xml index 2161ae3b9..3d678ff0e 100644 --- a/chapter03/patches.xml +++ b/chapter03/patches.xml @@ -90,7 +90,15 @@ - + + Systemd Compat Patch - &systemd-compat-patch-size;: + + Download: + MD5 sum: &systemd-compat-patch-md5; + + + + Sysvinit Consolidated Patch - &sysvinit-consolidated-patch-size;: Download: diff --git a/chapter05/gcc-pass1.xml b/chapter05/gcc-pass1.xml index 64077a414..694bfe780 100644 --- a/chapter05/gcc-pass1.xml +++ b/chapter05/gcc-pass1.xml @@ -196,7 +196,7 @@ cd build --disable-decimal-float, --disable-threads, - --disable-libatomic, --disable-libgomp, --disable-libmpx + --disable-libatomic, --disable-libgomp, --disable-libmpx, --disable-libquadmath, --disable-libssp, --disable-libvtv, --disable-libstdcxx diff --git a/chapter05/glibc.xml b/chapter05/glibc.xml index 53865f690..2a72325c9 100644 --- a/chapter05/glibc.xml +++ b/chapter05/glibc.xml @@ -42,11 +42,7 @@ Installation of Glibc - Fix some problems identified upstream: patch -Np1 -i ../&glibc-upstream-patch; @@ -80,15 +76,7 @@ cd build cross-compiler in /tools. - + --enable-kernel=&min-kernel; @@ -97,16 +85,7 @@ cd build kernels are not enabled. - + --with-headers=/tools/include @@ -169,21 +148,6 @@ cd build make - Install the package: make install diff --git a/chapter06/acl.xml b/chapter06/acl.xml index 9dbc1b2a8..7d448c121 100644 --- a/chapter06/acl.xml +++ b/chapter06/acl.xml @@ -59,11 +59,15 @@ Prepare Acl for compilation: -./configure --prefix=/usr \ +./configure --prefix=/usr \ --bindir=/bin \ --disable-static \ --libexecdir=/usr/lib +./configure --prefix=/usr \ + --disable-static \ + --libexecdir=/usr/lib + Compile the package: make diff --git a/chapter06/attr.xml b/chapter06/attr.xml index 03044a745..65d509f9a 100644 --- a/chapter06/attr.xml +++ b/chapter06/attr.xml @@ -53,10 +53,13 @@ Prepare Attr for compilation: -./configure --prefix=/usr \ +./configure --prefix=/usr \ --bindir=/bin \ --disable-static +./configure --prefix=/usr \ + --disable-static + Compile the package: make diff --git a/chapter06/autoconf.xml b/chapter06/autoconf.xml index 519811692..bf3d9ac9a 100644 --- a/chapter06/autoconf.xml +++ b/chapter06/autoconf.xml @@ -56,7 +56,7 @@ This takes a long time, about &autoconf-ch6-sbu-tests; SBUs. In addition, several tests are skipped that use Automake. For full test coverage, Autoconf can be re-tested after Automake has been installed. In addition, - two fail due to changes in libtool-2.4.3 and later. + two tests fail due to changes in libtool-2.4.3 and later. Install the package: diff --git a/chapter06/chapter06d.xml b/chapter06/chapter06d.xml new file mode 100644 index 000000000..d08135f7e --- /dev/null +++ b/chapter06/chapter06d.xml @@ -0,0 +1,87 @@ + + + %general-entities; +]> + + + + + + Installing Basic System Software + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/chapter06/coreutils.xml b/chapter06/coreutils.xml index d40e4f716..18cfe5063 100644 --- a/chapter06/coreutils.xml +++ b/chapter06/coreutils.xml @@ -137,12 +137,16 @@ mv -v /usr/bin/chroot /usr/sbin mv -v /usr/share/man/man1/chroot.1 /usr/share/man/man8/chroot.8 sed -i s/\"1\"/\"8\"/1 /usr/share/man/man8/chroot.8 - Some of the scripts in the LFS-Bootscripts package depend on - head, sleep, and + Some of the scripts in the LFS-Bootscripts package + depend on head, sleep, and nice. As /usr may not be available during the early stages of booting, those binaries need to be on the root partition: + Some packages in BLFS and beyond expect the + following programs in /bin, so make + sure they are placed there: + mv -v /usr/bin/{head,sleep,nice,test,[} /bin diff --git a/chapter06/createfiles.xml b/chapter06/createfiles.xml index 842336ab2..4c88468c3 100644 --- a/chapter06/createfiles.xml +++ b/chapter06/createfiles.xml @@ -146,12 +146,28 @@ ln -sv bash /bin/sh Create the /etc/passwd file by running the following command: -cat > /etc/passwd << "EOF" +cat > /etc/passwd << "EOF" root:x:0:0:root:/root:/bin/bash bin:x:1:1:bin:/dev/null:/bin/false daemon:x:6:6:Daemon User:/dev/null:/bin/false messagebus:x:18:18:D-Bus Message Daemon User:/var/run/dbus:/bin/false nobody:x:99:99:Unprivileged User:/dev/null:/bin/false +EOF + +cat > /etc/passwd << "EOF" +root:x:0:0:root:/root:/bin/bash +bin:x:1:1:bin:/dev/null:/bin/false +daemon:x:6:6:Daemon User:/dev/null:/bin/false +messagebus:x:18:18:D-Bus Message Daemon User:/var/run/dbus:/bin/false +systemd-bus-proxy:x:72:72:systemd Bus Proxy:/:/bin/false +systemd-journal-gateway:x:73:73:systemd Journal Gateway:/:/bin/false +systemd-journal-remote:x:74:74:systemd Journal Remote:/:/bin/false +systemd-journal-upload:x:75:75:systemd Journal Upload:/:/bin/false +systemd-network:x:76:76:systemd Network Management:/:/bin/false +systemd-resolve:x:77:77:systemd Resolver:/:/bin/false +systemd-timesync:x:78:78:systemd Time Synchronization:/:/bin/false +systemd-coredump:x:79:79:systemd Core Dumper:/:/bin/false +nobody:x:99:99:Unprivileged User:/dev/null:/bin/false EOF The actual password for root @@ -160,7 +176,7 @@ EOF Create the /etc/group file by running the following command: -cat > /etc/group << "EOF" +cat > /etc/group << "EOF" root:x:0: bin:x:1:daemon sys:x:2: @@ -184,6 +200,40 @@ input:x:24: mail:x:34: nogroup:x:99: users:x:999: +EOF + +cat > /etc/group << "EOF" +root:x:0: +bin:x:1:daemon +sys:x:2: +kmem:x:3: +tape:x:4: +tty:x:5: +daemon:x:6: +floppy:x:7: +disk:x:8: +lp:x:9: +dialout:x:10: +audio:x:11: +video:x:12: +utmp:x:13: +usb:x:14: +cdrom:x:15: +adm:x:16: +messagebus:x:18: +systemd-journal:x:23: +input:x:24: +mail:x:34: +systemd-bus-proxy:x:72: +systemd-journal-gateway:x:73: +systemd-journal-remote:x:74: +systemd-journal-upload:x:75: +systemd-network:x:76: +systemd-resolve:x:77: +systemd-timesync:x:78: +systemd-coredump:x:79: +nogroup:x:99: +users:x:999: EOF The created groups are not part of any standard—they are groups diff --git a/chapter06/dbus.xml b/chapter06/dbus.xml index 46f0439e4..ee5390137 100644 --- a/chapter06/dbus.xml +++ b/chapter06/dbus.xml @@ -48,11 +48,14 @@ Prepare D-Bus for compilation: -./configure --prefix=/usr \ - --sysconfdir=/etc \ - --localstatedir=/var \ - --docdir=/usr/share/doc/dbus-&dbus-version; \ - --with-console-auth-dir=/run/console + ./configure --prefix=/usr \ + --sysconfdir=/etc \ + --localstatedir=/var \ + --disable-static \ + --disable-doxygen-docs \ + --disable-xml-docs \ + --docdir=/usr/share/doc/dbus-&dbus-version; \ + --with-console-auth-dir=/run/console The meaning of the configure options: @@ -74,7 +77,7 @@ This package does come with a test suite, but it requires several packages that are not included in LFS. Instructions for running the test suite can be found in the BLFS book at - . + . Install the package: @@ -88,15 +91,10 @@ mv -v /usr/lib/libdbus-1.so.* /lib ln -sfv ../../lib/$(readlink /usr/lib/libdbus-1.so) /usr/lib/libdbus-1.so - Create a symlink, so that D-Bus and Systemd can use the same + Create a symlink, so that D-Bus and systemd can use the same machine-id file: -ln -sv /etc/machine-id /var/lib/dbus - - Finally, generate a D-Bus UUID to avoid possible warnings - when building some packages in BLFS: - -dbus-uuidgen --ensure +ln -sfv /etc/machine-id /var/lib/dbus @@ -110,11 +108,11 @@ ln -sfv ../../lib/$(readlink /usr/lib/libdbus-1.so) /usr/lib/libdbus-1.so dbus-cleanup-sockets, dbus-daemon, dbus-launch, dbus-monitor, - dbus-send, and dbus-uuidgen + dbus-run-session, dbus-send, and dbus-uuidgen libdbus-1.{a,so} /etc/dbus-1, /usr/include/dbus-1.0, /usr/lib/dbus-1.0, /usr/share/dbus-1, /usr/share/doc/dbus-&dbus-version;, - /var/lib/dbus + and /var/lib/dbus @@ -126,7 +124,7 @@ ln -sfv ../../lib/$(readlink /usr/lib/libdbus-1.so) /usr/lib/libdbus-1.so dbus-cleanup-sockets - Used to clean up leftover sockets in a directory. + Used to clean up leftover sockets in a directory dbus-cleanup-sockets @@ -136,7 +134,7 @@ ln -sfv ../../lib/$(readlink /usr/lib/libdbus-1.so) /usr/lib/libdbus-1.so dbus-daemon - The D-Bus message bus daemon. + The D-Bus message bus daemon dbus-daemon @@ -147,7 +145,7 @@ ln -sfv ../../lib/$(readlink /usr/lib/libdbus-1.so) /usr/lib/libdbus-1.sodbus-launch Starts dbus-daemon from a shell - script. + script dbus-launch @@ -157,17 +155,29 @@ ln -sfv ../../lib/$(readlink /usr/lib/libdbus-1.so) /usr/lib/libdbus-1.so dbus-monitor - Monitors messages passing through a D-Bus message bus. + Monitors messages passing through a D-Bus message bus dbus-monitor + + dbus-run-session + + Starts a session bus instance of dbus-daemon + from a shell script and starts a specified program in that + session + + dbus-run-session + + + + dbus-send - Sends a message to a D-Bus message bus. + Sends a message to a D-Bus message bus dbus-send @@ -177,13 +187,24 @@ ln -sfv ../../lib/$(readlink /usr/lib/libdbus-1.so) /usr/lib/libdbus-1.so dbus-uuidgen - Generates a universally unique ID. + Generates a universally unique ID dbus-uuidgen + + libdbus-1 + + Contains API functions used to communicate with the D-Bus + message bus + + libdbus-1 + + + + diff --git a/chapter06/diffutils.xml b/chapter06/diffutils.xml index 782f2eb03..89bd81be7 100644 --- a/chapter06/diffutils.xml +++ b/chapter06/diffutils.xml @@ -57,7 +57,7 @@ make check - The test-update-copyright.sh failure can be ignored. + The test-update-copyright.sh failure can be safely ignored. Install the package: diff --git a/chapter06/e2fsprogs.xml b/chapter06/e2fsprogs.xml index 5927b3eb0..e7f7cf39b 100644 --- a/chapter06/e2fsprogs.xml +++ b/chapter06/e2fsprogs.xml @@ -521,18 +521,7 @@ install-info --dir-file=/usr/share/info/dir /usr/share/info/com_err.info - + libss diff --git a/chapter06/findutils.xml b/chapter06/findutils.xml index 8c6d77a2b..8eb46d515 100644 --- a/chapter06/findutils.xml +++ b/chapter06/findutils.xml @@ -73,11 +73,16 @@ make install - Some of the scripts in the LFS-Bootscripts package depend on - find. As /usr - may not be available during the early stages of booting, this program - needs to be on the root partition. The updatedb - script also needs to be modified to correct an explicit path: + Some of the scripts in the LFS-Bootscripts package + depend on find. As /usr may not be available during the early + stages of booting, this program needs to be on the root partition. The + updatedb script also needs to be modified to correct an + explicit path: + + Some packages in BLFS and beyond expect the + find program in /bin, so make sure it's placed there: mv -v /usr/bin/find /bin sed -i 's|find:=${BINDIR}|find:=/bin|' /usr/bin/updatedb diff --git a/chapter06/glibc.xml b/chapter06/glibc.xml index e577e229a..02abb3dad 100644 --- a/chapter06/glibc.xml +++ b/chapter06/glibc.xml @@ -153,6 +153,12 @@ cd build cp -v ../nscd/nscd.conf /etc/nscd.conf mkdir -pv /var/cache/nscd + Install the systemd support files for + nscd: + + install -v -Dm644 ../nscd/nscd.tmpfiles /usr/lib/tmpfiles.d/nscd.conf +install -v -Dm644 ../nscd/nscd.service /lib/systemd/system/nscd.service + Next, install the locales that can make the system respond in a different language. None of the locales are required, but if some of them are missing, the test suites of future packages would skip important @@ -326,7 +332,9 @@ unset ZONEINFO Then create the /etc/localtime file by running: -cp -v /usr/share/zoneinfo/<xxx> /etc/localtime +cp -v /usr/share/zoneinfo/<xxx> /etc/localtime + +ln -sfv /usr/share/zoneinfo/<xxx> /etc/localtime Replace <xxx> with the name of the time zone selected (e.g., Canada/Eastern). @@ -562,17 +570,7 @@ mkdir -pv /etc/ld.so.conf.d - + pldd @@ -582,18 +580,7 @@ mkdir -pv /etc/ld.so.conf.d - + rpcgen @@ -837,18 +824,7 @@ mkdir -pv /etc/ld.so.conf.d - + libpthread diff --git a/chapter06/gmp.xml b/chapter06/gmp.xml index da655db6a..2950b6715 100644 --- a/chapter06/gmp.xml +++ b/chapter06/gmp.xml @@ -92,7 +92,7 @@ make html make check 2>&1 | tee gmp-check-log The code in gmp is highly optimized for the processor where - it is built. Occasionally the code that detects the processor misidentifies + it is built. Occasionally, the code that detects the processor misidentifies the system capabilities and there will be errors in the tests or other applications using the gmp libraries with the message "Illegal instruction". In this case, gmp should be reconfigured with the option diff --git a/chapter06/m4.xml b/chapter06/m4.xml index 29c6e8c49..804173a8f 100644 --- a/chapter06/m4.xml +++ b/chapter06/m4.xml @@ -52,7 +52,7 @@ make check - The test-update-copyright.sh failure can be ignored. + The test-update-copyright.sh failure can safely be ignored. Install the package: diff --git a/chapter06/man-db.xml b/chapter06/man-db.xml index 364074867..4e81cc998 100644 --- a/chapter06/man-db.xml +++ b/chapter06/man-db.xml @@ -91,6 +91,10 @@ make install + Remove a reference to a non-existent user: + +sed -i "s:man root:root root:g" /usr/lib/tmpfiles.d/man-db.conf + diff --git a/chapter06/mpfr.xml b/chapter06/mpfr.xml index b43c3d9aa..ff8e323b7 100644 --- a/chapter06/mpfr.xml +++ b/chapter06/mpfr.xml @@ -40,12 +40,7 @@ Installation of MPFR - Prepare MPFR for compilation: ./configure --prefix=/usr \ diff --git a/chapter06/ncurses.xml b/chapter06/ncurses.xml index a78d573b2..b37f1f69c 100644 --- a/chapter06/ncurses.xml +++ b/chapter06/ncurses.xml @@ -142,9 +142,9 @@ cp -v -R doc/* /usr/share/doc/ncurses-&ncurses-version; The instructions above don't create non-wide-character Ncurses libraries since no package installed by compiling from sources would link - against them at runtime. Currently, the only known binary-only - applications that link against non-wide-character Ncurses require version - 5. If you must have such libraries because of some binary-only + against them at runtime. However, the only known binary-only + applications that link against non-wide-character Ncurses libraries + require version 5. If you must have such libraries because of some binary-only application or to be compliant with LSB, build the package again with the following commands: diff --git a/chapter06/pkgmgt.xml b/chapter06/pkgmgt.xml index a451f2162..d004e1e7c 100644 --- a/chapter06/pkgmgt.xml +++ b/chapter06/pkgmgt.xml @@ -260,21 +260,27 @@ make DESTDIR=/usr/pkg/libfoo/1.1 install /etc/fstab, /etc/passwd, /etc/group, - /etc/shadow, - /etc/ld.so.conf, - /etc/sysconfig/rc.site, - /etc/sysconfig/network, and - /etc/sysconfig/ifconfig.eth0. + + /etc/shadow, and + /etc/ld.so.conf. + + + /etc/shadow, + /etc/ld.so.conf, + /etc/sysconfig/rc.site, + /etc/sysconfig/network, and + /etc/sysconfig/ifconfig.eth0. + A custom kernel may need to be built for the new system depending on differences in system hardware and the original kernel configuration. - There have been some reports of issues when copying between - similar but not identical architectures. For instance the instruction set - for Intel architectures is not identical with AMD processors and later - versions of some processors may have instructions not available in + There have been some reports of issues when copying between + similar but not identical architectures. For instance, the instruction set + for an Intel system is not identical with an AMD processor and later + versions of some processors may have instructions that are unavailable in earlier versions. Finally the new system has to be made bootable via Now prepare procps-ng for compilation: -./configure --prefix=/usr \ +./configure --prefix=/usr \ --exec-prefix= \ --libdir=/usr/lib \ --docdir=/usr/share/doc/procps-ng-&procps-ng-version; \ --disable-static \ --disable-kill +./configure --prefix=/usr \ + --exec-prefix= \ + --libdir=/usr/lib \ + --docdir=/usr/share/doc/procps-ng-&procps-ng-version; \ + --disable-static \ + --disable-kill \ + --with-systemd + The meaning of the configure options: diff --git a/chapter06/readline.xml b/chapter06/readline.xml index 8ec5cddf1..3b162d5ea 100644 --- a/chapter06/readline.xml +++ b/chapter06/readline.xml @@ -106,7 +106,7 @@ ln -sfv ../../lib/$(readlink /usr/lib/libhistory.so ) /usr/lib/libhistory.so libhistory.so and libreadline.so - /usr/include/readline and + /usr/include/readline, /usr/share/readline, and /usr/share/doc/readline-&readline-version; diff --git a/chapter06/systemd.xml b/chapter06/systemd.xml index 107500f8f..bbfac9c61 100644 --- a/chapter06/systemd.xml +++ b/chapter06/systemd.xml @@ -17,13 +17,13 @@ Systemd-&systemd-version; - Systemd + systemd - <para>The Systemd package contains programs for controlling the startup, + <para>The systemd package contains programs for controlling the startup, running, and shutdown of the system.</para> <segmentedlist> @@ -38,51 +38,67 @@ </sect2> <sect2 role="installation"> - <title>Installation of Systemd + Installation of systemd - If systemd is not desired at all, it can be skipped. However a - udev replacement must be installed. See the hint at - to find procedures to install - eudev. - - First, create a file to allow Systemd to build when using Util-Linux - built in Chapter 5: - -cat > config.cache << "EOF" -KILL=/bin/kill -HAVE_BLKID=1 -BLKID_LIBS="-lblkid" -BLKID_CFLAGS="-I/tools/include/blkid" -cc_cv_CFLAGS__flto=no -EOF - - Additionally, fix a build error when using Util-Linux built in + First, fix a build error when using Util-Linux built in Chapter 5: sed -i "s:blkid/::" $(grep -rl "blkid/blkid.h") - Apply a patch so that compat pkg-config files get - installed without installing compat libs which are useless on LFS: + Apply the following patch so that compat + pkg-config files get installed without installing compat + libs which are useless on LFS: patch -Np1 -i ../&systemd-compat-patch; - Prepare Systemd for compilation: + Disable two tests that always fail: -./configure --prefix=/usr \ - --sysconfdir=/etc \ - --localstatedir=/var \ - --config-cache \ - --with-rootprefix= \ - --with-rootlibdir=/lib \ - --enable-split-usr \ - --disable-gudev \ - --without-python \ - --docdir=/usr/share/doc/systemd-&systemd-version; \ - --with-dbuspolicydir=/etc/dbus-1/system.d \ - --with-dbusinterfacedir=/usr/share/dbus-1/interfaces \ - --with-dbussessionservicedir=/usr/share/dbus-1/services \ - --with-dbussystemservicedir=/usr/share/dbus-1/system-services +sed -e 's@test/udev-test.pl @@' \ + -e 's@test-copy$(EXEEXT) @@' \ + -i Makefile.in + + Rebuild generated files after modifying Makefile.am and + Makefile.in: + +autoreconf -fi + + Create a file to allow systemd to build when using Util-Linux + built in Chapter 5, to disable LTO by default, and to build without + xlstproc: + +cat > config.cache << "EOF" +KILL=/bin/kill +MOUNT_PATH=/bin/mount +UMOUNT_PATH=/bin/umount +HAVE_BLKID=1 +BLKID_LIBS="-lblkid" +BLKID_CFLAGS="-I/tools/include/blkid" +HAVE_LIBMOUNT=1 +MOUNT_LIBS="-lmount" +MOUNT_CFLAGS="-I/tools/include/libmount" +cc_cv_CFLAGS__flto=no +XSLTPROC="/usr/bin/xsltproc" +EOF + + LTO is disabled by default because it causes + systemd and other auxiliary programs to link to + libgcc_s.so, slows the build down + and makes the compiled code larger. + + Prepare systemd for compilation: + +./configure --prefix=/usr \ + --sysconfdir=/etc \ + --localstatedir=/var \ + --config-cache \ + --with-rootprefix= \ + --with-rootlibdir=/lib \ + --enable-split-usr \ + --disable-firstboot \ + --disable-ldconfig \ + --disable-sysusers \ + --without-python \ + --docdir=/usr/share/doc/systemd-&systemd-version; The meaning of the configure options: @@ -108,25 +124,50 @@ EOF --enable-split-usr - This switch ensures that Systemd will work on + This switch ensures that systemd will work on systems where /bin, /lib and /sbin directories are not symlinks to their /usr counterparts. - --disable-gudev --without-python + --without-python - These switches disable optional features because - LFS does not provide their dependencies. + This switch prevents configure + from trying to use Python which isn't built + in LFS. - --with-dbus* + --disable-firstboot - These switches ensure that D-Bus configuratil files - get installed in the correct locations. + This switch prevents installation of systemd + services responsible for setting up the system for + the first time. They are not useful for LFS because + everything is done manually. + + + + + --disable-ldconfig + + This switch prevents installation of a systemd + unit that runs ldconfig at + boot, making the boot time longer. Remove it if the + described feature is desired, even though it's not + useful for source distributions such as LFS. + + + + + --disable-sysusers + + This switch prevents installation of systemd + services responsible for setting up the + /etc/group and + /etc/passwd files. Both files + were created early in this chapter. @@ -136,64 +177,52 @@ EOF make LIBRARY_PATH=/tools/lib - First prevent few broken test cases from running: - -sed -e "s:test/udev-test.pl::g" \ - -e "s:test-bus-cleanup\$(EXEEXT) ::g" \ - -e "s:test-bus-gvariant\$(EXEEXT) ::g" \ - -i Makefile - - To test the results, issue: - -make -k check - - Note that some tests might fail because the test are being run in a - chroot environment. For full test coverage, the test suite should be run - from a system booted using Systemd. + This package has a test suite, but it can only be run after the + package has been installed. Install the package: make LD_LIBRARY_PATH=/tools/lib install - Move NSS myhostname library to /lib: + Move NSS libraries to /lib: -mv -v /usr/lib/libnss_myhostname.so.2 /lib +mv -v /usr/lib/libnss_{myhostname,mymachines,resolve}.so.2 /lib Remove an unnecessary directory: rm -rfv /usr/lib/rpm - Create the Sysvinit compatibility symlinks, and move some man pages - and a library that conflict with so - both systems can be installed side-by-side: + Create the Sysvinit compatibility symlinks, so systemd is used + as the default init system: for tool in runlevel reboot shutdown poweroff halt telinit; do - ln -sfv ../bin/systemctl /sbin/${tool}-systemd - mv -v /usr/share/man/man8/${tool}.8 /usr/share/man/man8/${tool}-systemd.8 + ln -sfv ../bin/systemctl /sbin/${tool} done +ln -sfv ../lib/systemd/systemd /sbin/init -ln -sfv ../lib/systemd/systemd /sbin/init-systemd -mv -v /etc/init.d /etc/init.d-systemd - + Create the /etc/machine-id file needed by - Journald: + systemd-journald: systemd-machine-id-setup - Finally install some LFS specific udev rules: + Since the testsuite largely depends on the host system kernel + configuration, some tests may fail. It also needs a modification in + order not to look for a program that will be installed by Util-Linux + package later in this chapter. To test the results, issue: -tar -xf ../&udev-lfs-version;.tar.bz2 -make -f &udev-lfs-version;/Makefile.lfs install +sed -i "s:minix:ext4:g" src/test/test-path-util.c +make LD_LIBRARY_PATH=/tools/lib -k check - Contents of Systemd + Contents of systemd Installed programs @@ -201,22 +230,24 @@ make -f &udev-lfs-version;/Makefile.lfs install Installed directories - bootctl, busctl, halt, hostnamectl, init, journalctl, kernel-install, - localectl, loginctl, machinectl, poweroff, reboot, runlevel, shutdown, - systemctl, systemd-analyze, systemd-ask-password, systemd-cat, systemd-cgls, - systemd-cgtop, systemd-coredumpctl, systemd-delta, systemd-detect-virt, - systemd-inhibit, systemd-machine-id-setup, systemd-notify, systemd-nspawn, - systemd-run, systemd-stdio-bridge, systemd-tmpfiles, systemd-tty-ask-password-agent, + bootctl, busctl, coredumpctl, halt, hostnamectl, init, journalctl, + kernel-install, localectl, loginctl, machinectl, networkctl, poweroff, + reboot, runlevel, shutdown, systemctl, systemd-analyze, + systemd-ask-password, systemd-cat, systemd-cgls, systemd-cgtop, + systemd-delta, systemd-detect-virt, systemd-escape, systemd-hwdb, + systemd-inhibit, systemd-machine-id-setup, systemd-notify, + systemd-nspawn, systemd-path, systemd-resolve, systemd-run, + systemd-stdio-bridge, systemd-tmpfiles, systemd-tty-ask-password-agent, telinit, timedatectl, and udevadm - - libnss_myhostname.so.2, libsystemd.so, libudev.so + libnss_myhostname.so.2, libnss_mymachines.so.2, + libnss_resolve.so.2, libsystemd.so, and libudev.so /etc/binfmt.d, /etc/init.d, /etc/kernel, /etc/modules-load.d, /etc/sysctl.d, /etc/systemd, /etc/tmpfiles.d, /etc/udev, /etc/xdg/systemd, /lib/systemd, /lib/udev, /usr/include/systemd, /usr/lib/binfmt.d, /usr/lib/kernel, /usr/lib/modules-load.d, /usr/lib/sysctl.d, /usr/lib/systemd, /usr/lib/tmpfiles.d, - /usr/share/doc/systemd-&systemd-version;, /usr/share/systemd, - /var/lib/systemd, /var/log/journal + /usr/share/doc/systemd-&systemd-version;, /usr/share/factory, + /usr/share/systemd, /var/lib/systemd, and /var/log/journal @@ -228,7 +259,7 @@ make -f &udev-lfs-version;/Makefile.lfs install bootctl - used to query the firmware and boot manager settings. + used to query the firmware and boot manager settings bootctl @@ -238,13 +269,23 @@ make -f &udev-lfs-version;/Makefile.lfs install busctl - used to introspect and monitor the D-Bus bus. + Used to introspect and monitor the D-Bus bus busctl + + coredumpctl + + Used to retrieve coredumps from the systemd Journal + + coredumpctl + + + + halt @@ -252,7 +293,7 @@ make -f &udev-lfs-version;/Makefile.lfs install -h option, except when already in run-level 0, then it tells the kernel to halt the system; it notes in the file /var/log/wtmp that the system is being - brought down. + brought down halt @@ -262,8 +303,8 @@ make -f &udev-lfs-version;/Makefile.lfs install hostnamectl - used to query and change the system hostname and related - settings. + Used to query and change the system hostname and related + settings hostnamectl @@ -275,7 +316,7 @@ make -f &udev-lfs-version;/Makefile.lfs install The first process to be started when the kernel has initialized the hardware which takes over the boot process and starts all the - proceses it is instructed to. + proceses it is instructed to init @@ -285,7 +326,7 @@ make -f &udev-lfs-version;/Makefile.lfs install journalctl - used to query the contents of the Systemd Journal. + Used to query the contents of the systemd Journal journalctl @@ -295,8 +336,8 @@ make -f &udev-lfs-version;/Makefile.lfs install kernel-install - used to add and remove kernel and initramfs images to and - from /boot. + Used to add and remove kernel and initramfs images to and + from /boot kernel-install @@ -306,8 +347,8 @@ make -f &udev-lfs-version;/Makefile.lfs install localectl - used to query and change the system locale and keyboard layout - settings. + Used to query and change the system locale and keyboard layout + settings localectl @@ -317,8 +358,8 @@ make -f &udev-lfs-version;/Makefile.lfs install loginctl - used to introspect and control the state of the Systemd Login - Manager. + Used to introspect and control the state of the systemd Login + Manager loginctl @@ -328,7 +369,7 @@ make -f &udev-lfs-version;/Makefile.lfs install machinectl - used to introspect and control the state of the Systemd Virtual + Used to introspect and control the state of the systemd Virtual Machine and Container Registration Manager machinectl @@ -336,11 +377,22 @@ make -f &udev-lfs-version;/Makefile.lfs install + + networkctl + + Used to introspect the state of the network links as seen by + systemd-networkd + + networkctl + + + + poweroff Tells the kernel to halt the system and switch off the computer - (see halt). + (see halt) poweroff @@ -351,7 +403,7 @@ make -f &udev-lfs-version;/Makefile.lfs install reboot Tells the kernel to reboot the system (see - halt). + halt) reboot @@ -362,7 +414,7 @@ make -f &udev-lfs-version;/Makefile.lfs install runlevel Reports the previous and the current run-level, as noted in the - last run-level record in /var/run/utmp. + last run-level record in /var/run/utmp runlevel @@ -373,7 +425,7 @@ make -f &udev-lfs-version;/Makefile.lfs install shutdown Brings the system down in a secure way, signaling all processes - and notifying all logged-in users. + and notifying all logged-in users shutdown @@ -383,8 +435,8 @@ make -f &udev-lfs-version;/Makefile.lfs install systemctl - used to introspect and control the state of the Systemd system and - service manager. + Used to introspect and control the state of the systemd system + and service manager systemctl @@ -394,8 +446,8 @@ make -f &udev-lfs-version;/Makefile.lfs install systemd-analyze - used to determine system boot-up performance of the current boot. - + Used to determine system boot-up performance of the current + boot systemd-analyze @@ -405,8 +457,8 @@ make -f &udev-lfs-version;/Makefile.lfs install systemd-ask-password - used to query a system password or passphrase from the user, using a - question message specified on the command line. + Used to query a system password or passphrase from the user, + using a question message specified on the command line systemd-ask-password @@ -416,7 +468,7 @@ make -f &udev-lfs-version;/Makefile.lfs install systemd-cat - used to connect STDOUT and STDERR of a process with the Journal. + Used to connect STDOUT and STDERR of a process with the Journal systemd-cat @@ -427,8 +479,8 @@ make -f &udev-lfs-version;/Makefile.lfs install systemd-cgls - recursively shows the contents of the selected Linux control group - hierarchy in a tree. + Recursively shows the contents of the selected Linux control + group hierarchy in a tree systemd-cgls @@ -438,30 +490,20 @@ make -f &udev-lfs-version;/Makefile.lfs install systemd-cgtop - shows the top control groups of the local Linux control group hierarchy, - ordered by their CPU, memory and disk I/O load. + Shows the top control groups of the local Linux control group + hierarchy, ordered by their CPU, memory and disk I/O load systemd-cgtop - - systemd-coredumpctl - - used to retrieve coredumps from the Systemd Journal - - systemd-coredumpctl - - - - systemd-delta - used to identify and compare configuration files in + Used to identify and compare configuration files in /etc that override default - counterparts in /usr. + counterparts in /usr systemd-delta @@ -471,18 +513,39 @@ make -f &udev-lfs-version;/Makefile.lfs install systemd-detect-virt - detects execution in a virtualized environment. + Detects execution in a virtualized environment systemd-detect-virt + + systemd-escape + + Used to escape strings for inclusion in systemd unit + names + + systemd-escape + + + + + + systemd-hwdb + + Used to manage hardware database (hwdb) + + systemd-hwdb + + + + systemd-inhibit - used to execute a program with a shutdown, sleep or idle inhibitor lock - taken. + Used to execute a program with a shutdown, sleep or idle + inhibitor lock taken systemd-inhibit @@ -492,9 +555,9 @@ make -f &udev-lfs-version;/Makefile.lfs install systemd-machine-id-setup - used by system installer tools to initialize the machine ID stored in - /etc/machine-id at install time with a randomly - generated ID. + Used by system installer tools to initialize the machine ID + stored in /etc/machine-id at install time with a + randomly generated ID systemd-machine-id-setup @@ -504,8 +567,8 @@ make -f &udev-lfs-version;/Makefile.lfs install systemd-notify - used by daemon scripts to notify the init system about status changes. - + Used by daemon scripts to notify the init system about status + changes systemd-notify @@ -515,25 +578,47 @@ make -f &udev-lfs-version;/Makefile.lfs install systemd-nspawn - used to run a command or OS in a light-weight namespace container. + Used to run a command or OS in a light-weight namespace + container systemd-nspawn + + systemd-path + + Used to query system and user paths + + systemd-path + + + + + + systemd-resolve + + Used to resolve domain names, IPV4 and IPv6 addresses, DNS + resource records, and services + + systemd-resolve + + + + systemd-run - used to create and start a transient .service or a .scope unit and - run the specified command in it. + Used to create and start a transient .service or a .scope unit + and run the specified command in it systemd-run - Prepare Util-linux for compilation: -./configure ADJTIME_PATH=/var/lib/hwclock/adjtime \ +./configure ADJTIME_PATH=/var/lib/hwclock/adjtime \ --docdir=/usr/share/doc/util-linux-&util-linux-version; \ --disable-chfn-chsh \ --disable-login \ @@ -76,6 +76,18 @@ --without-systemd \ --without-systemdsystemunitdir +./configure ADJTIME_PATH=/var/lib/hwclock/adjtime \ + --docdir=/usr/share/doc/util-linux-&util-linux-version; \ + --disable-chfn-chsh \ + --disable-login \ + --disable-nologin \ + --disable-su \ + --disable-setpriv \ + --disable-runuser \ + --disable-pylibmount \ + --disable-static \ + --without-python + The --disable and --without options prevent warnings about building components that require packages not in LFS or are inconsistent with programs installed by other packages. diff --git a/chapter07/chapter07d.xml b/chapter07/chapter07d.xml new file mode 100644 index 000000000..a2c30abe0 --- /dev/null +++ b/chapter07/chapter07d.xml @@ -0,0 +1,25 @@ + + + %general-entities; +]> + + + + + + Basic System Configuration + + + + + + + + + + + + + diff --git a/chapter07/clock.xml b/chapter07/clock.xml new file mode 100644 index 000000000..0dbdc7eaf --- /dev/null +++ b/chapter07/clock.xml @@ -0,0 +1,104 @@ + + + %general-entities; +]> + + + + + Configuring the system clock + + + clock + configuring + + This section discusses how to configure the + systemd-timedated system service, which configures + system clock and timezone. + + If you cannot remember whether or not the hardware clock is set to UTC, + find out by running the hwclock --localtime --show + command. This will display what the current time is according to the hardware + clock. If this time matches whatever your watch says, then the hardware clock is + set to local time. If the output from hwclock is not local + time, chances are it is set to UTC time. Verify this by adding or subtracting + the proper amount of hours for the timezone to the time shown by + hwclock. For example, if you are currently in the MST + timezone, which is also known as GMT -0700, add seven hours to the local + time. + + systemd-timedated reads /etc/adjtime, + and depending on the contents of the file, it sets the clock to either UTC or + local time. + + Create the /etc/adjtime file with the following contents + if your hardware clock is set to local time: + +cat > /etc/adjtime << "EOF" +0.0 0 0.0 +0 +LOCAL +EOF + + If /etc/adjtime isn't present at first boot, + systemd-timedated will assume that hardware clock is + set to UTC and adjust the file according to that. + + You can also use the timedatectl utility to tell + systemd-timedated if your hardware clock is set to + UTC or local time: + +timedatectl set-local-rtc 1 + + timedatectl can also be used to change system time and + time zone. + + To change your current system time, issue: + +timedatectl set-time YYYY-MM-DD HH:MM:SS + + Hardware clock will also be updated accordingly. + + To change your current time zone, issue: + +timedatectl set-timezone TIMEZONE + + You can get list of available time zones by running: + +timedatectl list-timezones + + Please note that timedatectl command can + be used only on a system booted with systemd. + + + Network Time Synchronization + + Starting with version 213, systemd ships a daemon called + systemd-timesyncd which can be used to + synchronize the system time with remote NTP servers. + + The daemon is not intended as a replacement for the well + established NTP daemon, but as a client only implementation + of the SNTP protocol which can be used for less advanced + tasks and on resource limited systems. + + Starting with systemd version 216, the + systemd-timesyncd daemon is enabled by + default. If you want to disable it, issue the following + command: + +systemctl disable systemd-timesyncd + + The /etc/systemd/timesyncd.conf file + can be used to change the NTP servers that + systemd-timesyncd synchronizes with. + + Please note that when system clock is set to Local Time, + systemd-timesyncd won't update hardware + clock. + + + + diff --git a/chapter07/consoled.xml b/chapter07/consoled.xml new file mode 100644 index 000000000..ea1062c23 --- /dev/null +++ b/chapter07/consoled.xml @@ -0,0 +1,137 @@ + + + %general-entities; +]> + + + + + Configuring the Linux Console + + + console + configuring + + + This section discusses how to configure the + systemd-vconsole-setup system service, which configures + the virtual console font and console keymap. + + The systemd-vconsole-setup service reads the + /etc/vconsole.conf file for configuration + information. Decide which keymap and screen font will be used. Various + language-specific HOWTOs can also help with this, see . + Examine localectl list-keymaps output for a list of + valid console keymaps. Look in + /usr/share/consolefonts + directory for valid screen fonts. + + The /etc/vconsole.conf file should contain lines + of the form: VARIABLE="value". The following variables are recognized: + + + + + KEYMAP + + This variable specifies the key mapping table for the keyboard. If + unset, it defaults to us. + + + + + KEYMAP_TOGGLE + + This variable can be used to configure a second toggle keymap and + is unset by default. + + + + + FONT + + This variable specifies the font used by the virtual + console. + + + + + FONT_MAP + + This variable specifies the console map to be used. + + + + + FONT_UNIMAP + + This variable specifies the Unicode font map. + + + + + + An example for a German keyboard and console is given below: + +cat > /etc/vconsole.conf << "EOF" +KEYMAP=de-latin1 +FONT=Lat2-Terminus16 +EOF + + You can change KEYMAP value at runtime by using the + localectl utility: + +localectl set-keymap MAP + + Please note that localectl command can + be used only on a system booted with systemd. + + You can also use localectl utility with the + corresponding parameters to change X11 keyboard layout, model, variant + and options: + +localectl set-x11-keymap LAYOUT [MODEL] [VARIANT] [OPTIONS] + + To list possible values for localectl set-x11-keymap + parameters, run localectl with parameters listed below: + + + + + + list-x11-keymap-models + + Show known X11 keyboard mapping models. + + + + + list-x11-keymap-layouts + + Show known X11 keyboard mapping layouts. + + + + + list-x11-keymap-variants + + Show known X11 keyboard mapping variants. + + + + + list-x11-keymap-options + + Show known X11 keyboard mapping options. + + + + + + Using any of the parameters listed above requires + XKeyboard Config package from BLFS. + + diff --git a/chapter07/etcshellsd.xml b/chapter07/etcshellsd.xml new file mode 100644 index 000000000..ddccafa9b --- /dev/null +++ b/chapter07/etcshellsd.xml @@ -0,0 +1,48 @@ + + + %general-entities; +]> + + + + + + $LastChangedBy$ + $Date$ + + + Creating the /etc/shells File + + + /etc/shells + + + The shells file contains a list of + login shells on the system. Applications use this file to determine + whether a shell is valid. For each shell a single line should be + present, consisting of the shell's path, relative to the root of the + directory structure (/). + + For example, this file is consulted by chsh + to determine whether an unprivileged user may change the login shell for her + own account. If the command name is not listed, the user will be denied of + change. + + It is a requirement for applications such as + GDM which does not populate the + face browser if it can't find /etc/shells, or + FTP daemons which traditionally disallow access to users + with shells not included in this file. + +cat > /etc/shells << "EOF" +# Begin /etc/shells + +/bin/sh +/bin/bash + +# End /etc/shells +EOF + + diff --git a/chapter07/introductiond.xml b/chapter07/introductiond.xml new file mode 100644 index 000000000..59d618b8b --- /dev/null +++ b/chapter07/introductiond.xml @@ -0,0 +1,73 @@ + + + %general-entities; +]> + + + + + Introduction + + This chapter discusses configuration files and systemd services. + First, the general configuration files needed to set up networking are + presented. + + + + + + + + + + + + + + Second, issues that affect the proper setup of devices are + discussed. + + + + + + + + + + + Third, configuring the system clock and keyboard layout. + + + + + + + + + + + + Fourth, a brief introduction to the scripts and configuration + files used when the user logs into the system. + + + + + + + + + + + And finally, configuring the systemd behavior. + + + + + + + + diff --git a/chapter07/locale.xml b/chapter07/locale.xml new file mode 100644 index 000000000..76dbb7251 --- /dev/null +++ b/chapter07/locale.xml @@ -0,0 +1,152 @@ + + + %general-entities; +]> + + + + + Configuring the System Locale + + + /etc/locale.conf + + + The /etc/locale.conf below sets some + environment variables necessary for native language support. Setting + them properly results in: + + + + The output of programs translated into the native language + + + Correct classification of characters into letters, digits and other + classes. This is necessary for bash to properly accept + non-ASCII characters in command lines in non-English locales + + + The correct alphabetical sorting order for the country + + + Appropriate default paper size + + + Correct formatting of monetary, time, and date values + + + + Replace <ll> below with the two-letter code + for the desired language (e.g., en) and + <CC> with the two-letter code for the appropriate + country (e.g., GB). <charmap> should + be replaced with the canonical charmap for your chosen locale. Optional + modifiers such as @euro may also be present. + + The list of all locales supported by Glibc can be obtained by running + the following command: + +locale -a + + Charmaps can have a number of aliases, e.g., ISO-8859-1 + is also referred to as iso8859-1 and iso88591. + Some applications cannot handle the various synonyms correctly (e.g., require + that UTF-8 is written as UTF-8, not + utf8), so it is safest in most + cases to choose the canonical name for a particular locale. To determine + the canonical name, run the following command, where <locale + name> is the output given by locale -a for + your preferred locale (en_GB.iso88591 in our example). + +LC_ALL=<locale name> locale charmap + + For the en_GB.iso88591 locale, the above command + will print: + +ISO-8859-1 + + This results in a final locale setting of en_GB.ISO-8859-1. + It is important that the locale found using the heuristic above is tested prior + to it being added to the Bash startup files: + +LC_ALL=<locale name> locale language +LC_ALL=<locale name> locale charmap +LC_ALL=<locale name> locale int_curr_symbol +LC_ALL=<locale name> locale int_prefix + + The above commands should print the language name, the character + encoding used by the locale, the local currency, and the prefix to dial + before the telephone number in order to get into the country. If any of the + commands above fail with a message similar to the one shown below, this means + that your locale was either not installed in Chapter 6 or is not supported by + the default installation of Glibc. + +locale: Cannot set LC_* to default locale: No such file or directory + + If this happens, you should either install the desired locale using the + localedef command, or consider choosing a different locale. + Further instructions assume that there are no such error messages from + Glibc. + + + Some packages beyond LFS may also lack support for your chosen locale. One + example is the X library (part of the X Window System), which outputs the + following error message if the locale does not exactly match one of the character + map names in its internal files: + +Warning: locale not supported by Xlib, locale set to C + + In several cases Xlib expects that the character map will be listed in + uppercase notation with canonical dashes. For instance, "ISO-8859-1" rather + than "iso88591". It is also possible to find an appropriate specification by + removing the charmap part of the locale specification. This can be checked + by running the locale charmap command in both locales. + For example, one would have to change "de_DE.ISO-8859-15@euro" to + "de_DE@euro" in order to get this locale recognized by Xlib. + + Other packages can also function incorrectly (but may not necessarily + display any error messages) if the locale name does not meet their expectations. + In those cases, investigating how other Linux distributions support your locale + might provide some useful information. + + Once the proper locale settings have been determined, create the + /etc/locale.conf file: + +cat > /etc/locale.conf << "EOF" +LANG=<ll>_<CC>.<charmap><@modifiers> +EOF + + Note that you can modify /etc/locale.conf with + systemd localectl utility. To use localectl + for the example above, run: + +localectl set-locale LANG="<ll>_<CC>.<charmap><@modifiers>" + + You can also specify other language specific environment variables such + as LANG, LC_CTYPE, LC_NUMERIC or + any other environment variable from locale output. Just + separate them with a space. An example where LANG is set as + en_US.UTF-8 but LC_CTYPE is set as just en_US is: + +localectl set-locale LANG="en_US.UTF-8" LC_CTYPE="en_US" + + Please note that localectl command can + be used only on a system booted with systemd. + + The C (default) and en_US (the recommended + one for United States English users) locales are different. C + uses the US-ASCII 7-bit character set, and treats bytes with the high bit set + as invalid characters. That's why, e.g., the ls command + substitutes them with question marks in that locale. Also, an attempt to send + mail with such characters from Mutt or Pine results in non-RFC-conforming + messages being sent (the charset in the outgoing mail is indicated as unknown + 8-bit). So you can use the C locale only if you are sure that + you will never need 8-bit characters. + + UTF-8 based locales are not supported well by many programs. + Work is in progress to document and, if possible, fix such problems, see + . + + diff --git a/chapter07/networkd.xml b/chapter07/networkd.xml new file mode 100644 index 000000000..86dcb3e53 --- /dev/null +++ b/chapter07/networkd.xml @@ -0,0 +1,270 @@ + + + %general-entities; +]> + + + + + General Network Configuration + + + network + configuring + + This section only applies if a network card is to be + configured. + + + Network Interface Configuration Files + + Starting with version 209, systemd ships a network configuration + daemon called systemd-networkd which can be used for + basic network configuration. Additionally, since version 213, DNS name + resolution can be handled by systemd-resolved in place + of a static /etc/resolv.conf file. Both services are + enabled by defualt, and absolutely should not be disabled. + + Configuration files for systemd-networkd (and + systemd-resolved) can be placed in + /usr/lib/systemd/network + or /etc/systemd/network. Files in + /etc/systemd/network have a + higher priority than the ones in + /usr/lib/systemd/network. + There are three types of configuration files: + .link, + .netdev and + .network files. For detailed + descriptions and example contents of these configuration files, consult + the systemd-link(5), + systemd-netdev(5) and + systemd-network(5) manual pages. + + Udev may assign network card interface names based + on system physical characteristics such as enp2s1. If you are + not sure what your interface name is, you can always run + ip link after you have booted your system. + + + + Static IP Configuration + + The command below creates a basic configuration file for a + Static IP setup (using both systemd-networkd and + systemd-resolved): + +cat > /etc/systemd/network/10-eth0-static.network << "EOF" +[Match] +Name=eth0 + +[Network] +Address=192.168.0.2/24 +Gateway=192.168.0.1 +DNS=192.168.0.1 +Domains=<Your Domain Name> +EOF + + Multiple DNS entries can be added if you have more than one DNS + server. Do not include DNS or Domains entries if you intend to use a + static /etc/reslov.conf file. + + + + + DHCP Configuration + + The command below creates a basic configuration file for an IPv4 + DHCP setup: + +cat > /etc/systemd/network/10-eth0-dhcp.network << "EOF" +[Match] +Name=eth0 + +[Network] +DHCP=ipv4 + +[DHCP] +UseDomains=true +EOF + + + + + + + Creating the /etc/resolv.conf File + + + /etc/resolv.conf + + + If the system is going to be connected to the Internet, it will + need some means of Domain Name Service (DNS) name resolution to + resolve Internet domain names to IP addresses, and vice versa. This is + best achieved by placing the IP address of the DNS server, available + from the ISP or network administrator, into + /etc/resolv.conf. + + + systemd-resolved Configuration + + If using another means to configure your network + interfaces (ex: ppp, network-manager, etc.), or if using any type of + local resolver (ex: bind, dnsmasq, etc.), or any other software that + generates an /etc/resolv.conf (ex: resolvconf), the + systemd-resolved service should not be + used. + + When using systemd-resolved for DNS + configuration, it is responsible for creating the + /etc/resolv.conf file. Since version 226, the + symlink for /etc/resolv.conf is created by systemd + when needed, so no further configuration is necessary. + + + + + Static resolv.conf Configuration + + If a static /etc/resolv.conf is desired, + create it by running the following command: + +cat > /etc/resolv.conf << "EOF" +# Begin /etc/resolv.conf + +domain <Your Domain Name> +nameserver <IP address of your primary nameserver> +nameserver <IP address of your secondary nameserver> + +# End /etc/resolv.conf +EOF + + The domain statement can be omitted + or replaced with a search statement. See the man page + for resolv.conf for more details. + + Replace + <IP address of the nameserver> + with the IP address of the DNS most appropriate for the setup. There will + often be more than one entry (requirements demand secondary servers for + fallback capability). If you only need or want one DNS server, remove the + second nameserver line from the file. The IP address + may also be a router on the local network. + + The Google Public IPv4 DNS addresses are + 8.8.8.8 and 8.8.4.4 + for IPv4, and 2001:4860:4860::8888 and + 2001:4860:4860::8844 for IPv6. + + + + + + + Configuring the system hostname + + + hostname + configuring + + + During the boot process, the file /etc/hostname + is used for establishing the system's hostname. + + Create the /etc/hostname file and enter a + hostname by running: + +echo "<lfs>" > /etc/hostname + + <lfs> needs to be replaced with the + name given to the computer. Do not enter the Fully Qualified Domain Name + (FQDN) here. That information is put in the + /etc/hosts file. + + + + + Customizing the /etc/hosts File + + + /etc/hosts + + + + localnet + /etc/hosts + + + + network + /etc/hosts + + + Decide on a fully-qualified domain name (FQDN), and possible aliases + for use in the /etc/hosts file. If using static + addresses, you'll also need to decide on an IP address. The syntax + for a hosts file entry is: + +IP_address myhost.example.org aliases + + Unless the computer is to be visible to the Internet (i.e., there is + a registered domain and a valid block of assigned IP addresses—most + users do not have this), make sure that the IP address is in the private + network IP address range. Valid ranges are: + +Private Network Address Range Normal Prefix +10.0.0.1 - 10.255.255.254 8 +172.x.0.1 - 172.x.255.254 16 +192.168.y.1 - 192.168.y.254 24 + + x can be any number in the range 16-31. y can be any number in the + range 0-255. + + A valid private IP address could be 192.168.1.1. A valid FQDN for + this IP could be lfs.example.org. + + Even if not using a network card, a valid FQDN is still required. + This is necessary for certain programs to operate correctly. + + If using DHCP, DHCPv6, IPv6 Autoconfiguration, or if a network card + is not going to be configured, create the /etc/hosts + file by running the following command: + +cat > /etc/hosts << "EOF" +# Begin /etc/hosts + +127.0.0.1 <HOSTNAME.example.org> <HOSTNAME> localhost [alias1] [alias2] ... +::1 <HOSTNAME.example.org> <HOSTNAME> localhost [alias1] [alias2] ... + +# End /etc/hosts +EOF + + The ::1 entry is the IPv6 counterpart of 127.0.0.1 and represents +the IPv6 loopback interface. + + If ussing a staic address, create the /etc/hosts + file by running this command instead: + +cat > /etc/hosts << "EOF" +# Begin /etc/hosts + +127.0.0.1 localhost +::1 localhost +<192.168.0.2> <HOSTNAME.example.org> <HOSTNAME> [alias1] [alias2] ... + +# End /etc/hosts +EOF + + The <192.168.0.2>, + <HOSTNAME.example.org>, and + <HOSTNAME> values need to be + changed for specific uses or requirements (if assigned an IP address by a + network/system administrator and the machine will be connected to an + existing network). The optional alias name(s) can be omitted. + + + + diff --git a/chapter07/symlinksd.xml b/chapter07/symlinksd.xml new file mode 100644 index 000000000..354ae319a --- /dev/null +++ b/chapter07/symlinksd.xml @@ -0,0 +1,63 @@ + + + %general-entities; +]> + + + + + Creating Custom Symlinks to Devices + + + Dealing with duplicate devices + + As explained in , the order in + which devices with the same function appear in + /dev is essentially random. + E.g., if you have a USB web camera and a TV tuner, sometimes + /dev/video0 refers to the camera and + /dev/video1 refers to the tuner, and sometimes + after a reboot the order changes to the opposite one. + For all classes of hardware except sound cards and network cards, this is + fixable by creating udev rules for custom persistent symlinks. + The case of network cards is covered separately in + , and sound card configuration can + be found in BLFS. + + For each of your devices that is likely to have this problem + (even if the problem doesn't exist in your current Linux distribution), + find the corresponding directory under + /sys/class or + /sys/block. + For video devices, this may be + /sys/class/video4linux/videoX. + Figure out the attributes that identify the device uniquely (usually, + vendor and product IDs and/or serial numbers work): + +udevadm info -a -p /sys/class/video4linux/video0 + + Then write rules that create the symlinks, e.g.: + +cat > /etc/udev/rules.d/83-duplicate_devs.rules << "EOF" + +# Persistent symlinks for webcam and tuner +KERNEL=="video*", ATTRS{idProduct}=="1910", ATTRS{idVendor}=="0d81", \ + SYMLINK+="webcam" +KERNEL=="video*", ATTRS{device}=="0x036f", ATTRS{vendor}=="0x109e", \ + SYMLINK+="tvtuner" + +EOF + + The result is that /dev/video0 and + /dev/video1 devices still refer randomly to the tuner + and the web camera (and thus should never be used directly), but there are + symlinks /dev/tvtuner and + /dev/webcam that always point to the correct + device. + + + + diff --git a/chapter07/sysd-custom.xml b/chapter07/sysd-custom.xml deleted file mode 100644 index e5872ece9..000000000 --- a/chapter07/sysd-custom.xml +++ /dev/null @@ -1,253 +0,0 @@ - - - %general-entities; -]> - - - - - Systemd Usage and Confiuration - - - Systemd Customization - - - - Basic Configuration - - The /etc/systemd/system.conf file contains a set - of items to control basic operations. The default file has all entries - commented out with the default settings indicated. This file is where the - log level may be changed as well as some basic journal settings. - - - - - Disabling Screen Clearing at Boot Time - - The normal behavior for systemd is to clear the secreen at - the end of the boot sequence. If desired, this behavior may be - changed by the following: - -mkdir -p /etc/systemd/system/getty@tty1.service.d - -cat > /etc/systemd/system/getty@tty1.service.d/noclear.conf << EOF -[Service] -TTYVTDisallocate=no -EOF - - The boot messages can always be revied by using the - journalctl -b command as the root user. - - - - - Disabling tmpfs for /tmp - - By default, /tmp is created as - a tmpfs. If this is not desired, it can be overridden by the following: - -ln -s /dev/null /etc/systemd/system/tmp.mount - - This is not necessary if there is a separate partition for /tmp - specified in /etc/fstab. - - - - Configuring Automatic File Creation and Deletion - - There are several services that create or delete files or - directories: - - - systemd-tmpfiles-clean.service - systemd-tmpfiles-setup-dev.service - systemd-tmpfiles-setup.service - - - The system location for the configuration files is - /usr/lib/tmpfiles.d/*.conf. The local - configuration files are in /etc/tmpfiles.d/*.conf. - Files in /etc/tmpfiles.d override files with the same name in - /usr/lib/tmpfiles.d. See man tmpfiles.d - for file format details. - - - - - Adding Custom Units and Services - - A custom service can be added by creating a directory and - configuration file in /etc/systemd/system/. - For example: - -mkdir -p /etc/systemd/system/foobar.service.d - -cat > /etc/systemd/system/foobar.service.d/foobar.conf << EOF -[Service] -Restart=always -RestartSec=30 -EOF - - See the man page for systemd.unit for more information. After - creating the configuration file, run systemctl - daemon-reload and systemctl restart - foobar to activate a service or changes to a service. - - - - - Setting Console Fonts and Keyboard - - - systemd console - configuring - - - This section discusses how to configure the - systemd-vconsole-setup system service, which configures - the virtual console font and console keymap. - - The systemd-vconsole-setup service reads the - /etc/vconsole.conf file for configuration - information. Decide which keymap and screen font will be used. Various - language-specific HOWTOs can also help with this, see . - Examine localectl list-keymaps output for a list of - valid console keymaps. Look in - /usr/share/consolefonts - directory for valid screen fonts. - - The /etc/vconsole.conf file should contain lines - of the form: VARIABLE="value". The following variables are recognized: - - - - - KEYMAP - - This variable specifies the key mapping table for the keyboard. If - unset, it defaults to us. - - - - - KEYMAP_TOGGLE - - This variable can be used to configure a second toggle keymap and - is unset by default. - - - - FONT - - This variable specifies the font used by the virtual - console. - - - - FONT_MAP - - This variable specifies the console map to be used. - - - - - FONT_UNIMAP - - This variable specifies the unicode font map. - - - - - - An example for a German keyboard and console is given below: - -cat > /etc/vconsole.conf << "EOF" -KEYMAP=de-latin1 -FONT=Lat2-Terminus16 -EOF - - You can change KEYMAP value at runtime by using the - localectl utility: - -localectl set-keymap MAP - - Please note that localectl command can - be used only on a system booted with Systemd. - - - - - Clock Configuration - - - clock - configuring - - This section discusses how to configure the - systemd-timedated system service, which configures - system clock and timezone. - - systemd-timedated reads - /etc/adjtime, and depending on the contents of the file, - it sets the clock to either UTC or local time. Create the - /etc/adjtime file with the following contents if your - hardware clock is set to local time: - -cat > /etc/adjtime << "EOF" -0.0 0 0.0 -0 -LOCAL -EOF - - If /etc/adjtime isn't present at first boot, - systemd-timedated will assume that hardware clock is - set to UTC and create the file using that setting. - - You can also use the timedatectl utility to tell - systemd-timedated if your hardware clock is set to - UTC or local time: - -timedatectl set-local-rtc 1 - - timedatectl can also be used to change system time and - time zone. - - To change your current system time, issue: - -timedatectl set-time YYYY:MM:DD HH:MM:SS - - Hardware clock will also be updated accordingly. - - To change your current time zone, issue: - -timedatectl set-timezone TIMEZONE - - You can get list of available time zones by running: - -timedatectl list-timezones - - The timedatectl command can - be used only on a system booted with Systemd. - - - - - Debugging the Boot Sequence - - There are several commands that can be used to help debug the systemd - boot process. Here are some examples: - - - systemctl list-units -t service [--all] - systemctl list-units -t target [--all] - systemctl show -p Wants multi-user.target - systemctl status sshd.service - - - - - diff --git a/chapter07/systemd-custom.xml b/chapter07/systemd-custom.xml new file mode 100644 index 000000000..0c8ca75b9 --- /dev/null +++ b/chapter07/systemd-custom.xml @@ -0,0 +1,175 @@ + + + %general-entities; +]> + + + + + Systemd Usage and Configuration + + + Systemd Customization + + + + Basic Configuration + + The /etc/systemd/system.conf file contains a set + of options to control basic systemd operations. The default file has all + entries commented out with the default settings indicated. This file is + where the log level may be changed as well as some basic logging settings. + See systemd-system.conf(5) manual page for details on + each configuration option. + + + + + Disabling Screen Clearing at Boot Time + + The normal behavior for systemd is to clear the screen at + the end of the boot sequence. If desired, this behavior may be + changed by running the following command: + +mkdir -pv /etc/systemd/system/getty@tty1.service.d + +cat > /etc/systemd/system/getty@tty1.service.d/noclear.conf << EOF +[Service] +TTYVTDisallocate=no +EOF + + The boot messages can always be revied by using the + journalctl -b command as the root user. + + + + + Disabling tmpfs for /tmp + + By default, /tmp is created as + a tmpfs. If this is not desired, it can be overridden by the following: + +ln -sfv /dev/null /etc/systemd/system/tmp.mount + + This is not necessary if there is a separate partition for + /tmp specified in + /etc/fstab. + + + + + Configuring Automatic File Creation and Deletion + + There are several services that create or delete files or + directories: + + + systemd-tmpfiles-clean.service + systemd-tmpfiles-setup-dev.service + systemd-tmpfiles-setup.service + + + The system location for the configuration files is + /usr/lib/tmpfiles.d/*.conf. The local + configuration files are in + /etc/tmpfiles.d. Files in + /etc/tmpfiles.d override + files with the same name in + /usr/lib/tmpfiles.d. See + tmpfiles.d(5) manual page for file format + details. + + + + + Overriding Default Services Behavior + + A systemd service contents can be overriden by creating a directory + and a configuration file in /etc/systemd/system. For example: + +mkdir -pv /etc/systemd/system/foobar.service.d + +cat > /etc/systemd/system/foobar.service.d/foobar.conf << EOF +[Service] +Restart=always +RestartSec=30 +EOF + + See systemd.unit(5) manual page for more + information. After creating the configuration file, run + systemctl daemon-reload and systemctl + restart foobar to activate the changes to a service. + + + + + Debugging the Boot Sequence + + Rather than plain shell scripts used in SysVinit or BSD style init + systems, systemd uses a unified format for different type of startup + files (or units). The command systemctl is used to + enable, disable, controll state, and obtain status of unit files. Here + are some examples of frequently used commands: + + + + systemctl list-units -t <service> [--all]: + lists loaded unit files of type service. + + + systemctl list-units -t <target> [--all]: + lists loaded unit files of type target. + + + systemctl show -p Wants <multi-user.target>: + shows all units that depend on the multi-user target. Targets are + special unit files that are anogalous to runlevels under + SysVinit. + + + systemctl status <servicename.service>: + shows the status of the servicename service. The .service extension + can be omitted if there are no other unit files with the same name, + such as .socket files (which create a listening socket that provides + similar functionality to inetd/xinetd). + + + + + + + Working with the Systemd Journal + + Logging on a system booted with systemd is handled by + systemd-journald (default), rather than a typical unix syslog daemon. + systemd-journald write log entries to a binary file format, rather than + a plain text log file. To assist with parsing the file, the command + journalctl is provided. Here are some examples of + frequently used commands: + + + + journalctl -r: shows all contents of the + journal in reverse chronological order. + + + journalctl -u UNIT: + shows the journal entries associated with the specified UNIT + file. + + + journalctl -b[=ID] -r: shows the journal + entries since last successfull boot (or for boot ID) in reverse + chronological order. + + + journalctl -f: povides functionality similar + to tail -f (follow). + + + + + diff --git a/chapter07/udevd.xml b/chapter07/udevd.xml new file mode 100644 index 000000000..548a2d2ee --- /dev/null +++ b/chapter07/udevd.xml @@ -0,0 +1,337 @@ + + + %general-entities; +]> + + + + + Device and Module Handling on an LFS System + + + Udev + usage + + + In , we installed Udev + from the systemd source package. Before we go into the details regarding + how this works, a brief history of previous methods of handling devices + is in order. + + Linux systems in general traditionally use a static device creation + method, whereby a great many device nodes are created under /dev (sometimes literally thousands of nodes), + regardless of whether the corresponding hardware devices actually exist. This + is typically done via a MAKEDEV script, which contains a + number of calls to the mknod program with the relevant + major and minor device numbers for every possible device that might exist in + the world. + + Using the Udev method, only those devices which are detected by the + kernel get device nodes created for them. Because these device nodes will be + created each time the system boots, they will be stored on a devtmpfs file system (a virtual file system + that resides entirely in system memory). Device nodes do not require much + space, so the memory that is used is negligible. + + + History + + In February 2000, a new filesystem called devfs was merged into the 2.3.46 kernel + and was made available during the 2.4 series of stable kernels. Although + it was present in the kernel source itself, this method of creating devices + dynamically never received overwhelming support from the core kernel + developers. + + The main problem with the approach adopted by devfs was the way it handled device + detection, creation, and naming. The latter issue, that of device node + naming, was perhaps the most critical. It is generally accepted that if + device names are allowed to be configurable, then the device naming policy + should be up to a system administrator, not imposed on them by any + particular developer(s). The devfs file system also suffers from race + conditions that are inherent in its design and cannot be fixed without a + substantial revision to the kernel. It was marked as deprecated for a long + period – due to a lack of maintenance – and was finally removed + from the kernel in June, 2006. + + With the development of the unstable 2.5 kernel tree, later released + as the 2.6 series of stable kernels, a new virtual filesystem called + sysfs came to be. The job of + sysfs is to export a view of + the system's hardware configuration to userspace processes. With this + userspace-visible representation, the possibility of seeing a userspace + replacement for devfs became + much more realistic. + + + + + Udev Implementation + + + Sysfs + + The sysfs filesystem + was mentioned briefly above. One may wonder how sysfs knows about the devices present on + a system and what device numbers should be used for them. Drivers that + have been compiled into the kernel directly register their objects with a + sysfs (devtmpfs internally) + as they are detected by the kernel. For drivers compiled as modules, this + registration will happen when the module is loaded. Once the sysfs filesystem is mounted (on /sys), + data which the drivers register with sysfs are available to userspace + processes and to udevd for processing (including modifications to device + nodes). + + + + + Device Node Creation + + Device files are created by the kernel by the devtmpfs filesystem. Any driver that + wishes to register a device node will go through devtmpfs (via the driver core) to do it. + When a devtmpfs instance is + mounted on /dev, the device node + will initially be created with a fixed name, permissions, and + owner. + + A short time later, the kernel will send a uevent to + udevd. Based on the rules specified in the files within the + /etc/udev/rules.d, /lib/udev/rules.d, and /run/udev/rules.d directories, + udevd will create additional symlinks to the device node, or + change its permissions, owner, or group, or modify the internal + udevd database entry (name) for that object. + + The rules in these three directories are numbered in a similar + fashion to the LFS-Bootscripts package and all three directories are + merged together. If udevd can't find a rule for the + device it is creating, it will leave the permissions and ownership at + whatever devtmpfs used + initially. + + + + + Module Loading + + Device drivers compiled as modules may have aliases built into them. + Aliases are visible in the output of the modinfo + program and are usually related to the bus-specific identifiers of devices + supported by a module. For example, the snd-fm801 + driver supports PCI devices with vendor ID 0x1319 and device ID 0x0801, + and has an alias of pci:v00001319d00000801sv*sd*bc04sc01i*. + For most devices, the bus driver exports the alias of the driver that + would handle the device via sysfs. E.g., the + /sys/bus/pci/devices/0000:00:0d.0/modalias file + might contain the string + pci:v00001319d00000801sv00001319sd00001319bc04sc01i00. + The default rules provided with Udev will cause udevd + to call out to /sbin/modprobe with the contents of the + MODALIAS uevent environment variable (which should be the + same as the contents of the modalias file in sysfs), + thus loading all modules whose aliases match this string after wildcard + expansion. + + In this example, this means that, in addition to + snd-fm801, the obsolete (and unwanted) + forte driver will be loaded if it is + available. See below for ways in which the loading of unwanted drivers can + be prevented. + + The kernel itself is also able to load modules for network + protocols, filesystems and NLS support on demand. + + + + + Handling Hotpluggable/Dynamic Devices + + When you plug in a device, such as a Universal Serial Bus (USB) MP3 + player, the kernel recognizes that the device is now connected and + generates a uevent. This uevent is then handled by + udevd as described above. + + + + + + + Problems with Loading Modules and Creating Devices + + There are a few possible problems when it comes to automatically + creating device nodes. + + + A kernel module is not loaded automatically + + Udev will only load a module if it has a bus-specific alias and the + bus driver properly exports the necessary aliases to sysfs. In other cases, one should + arrange module loading by other means. With Linux-&linux-version;, Udev is + known to load properly-written drivers for INPUT, IDE, PCI, USB, SCSI, + SERIO, and FireWire devices. + + To determine if the device driver you require has the necessary + support for Udev, run modinfo with the module name as + the argument. Now try locating the device directory under + /sys/bus and check whether there is + a modalias file there. + + If the modalias file exists in sysfs, the driver supports the device and + can talk to it directly, but doesn't have the alias, it is a bug in the + driver. Load the driver without the help from Udev and expect the issue + to be fixed later. + + If there is no modalias file in the relevant + directory under /sys/bus, this + means that the kernel developers have not yet added modalias support to + this bus type. With Linux-&linux-version;, this is the case with ISA + busses. Expect this issue to be fixed in later kernel versions. + + Udev is not intended to load wrapper drivers such as + snd-pcm-oss and non-hardware drivers such as + loop at all. + + + + + A kernel module is not loaded automatically, and Udev is not + intended to load it + + If the wrapper module only enhances the functionality + provided by some other module (e.g., snd-pcm-oss + enhances the functionality of snd-pcm by making the + sound cards available to OSS applications), configure + modprobe to load the wrapper after Udev loads the + wrapped module. To do this, add a softdep line in any + /etc/modprobe.d/<filename>.conf + file. For example: + +softdep snd-pcm post: snd-pcm-oss + + Note that the softdep command also allows + pre: dependencies, or a mixture of both + pre: and post:. See the + modprobe.d(5) manual page for more information + on softdep syntax and capabilities. + + If the module in question is not a wrapper and is useful by itself, + configure the modules bootscript to load this + module on system boot. To do this, add the module name to the + /etc/sysconfig/modules file on a separate line. + This works for wrapper modules too, but is suboptimal in that case. + + + + + Udev loads some unwanted module + + Either don't build the module, or blacklist it in a + /etc/modprobe.d/blacklist.conf file as done with the + forte module in the example below: + +blacklist forte + + Blacklisted modules can still be loaded manually with the + explicit modprobe command. + + + + + Udev creates a device incorrectly, or makes a wrong symlink + + This usually happens if a rule unexpectedly matches a device. For + example, a poorly-written rule can match both a SCSI disk (as desired) + and the corresponding SCSI generic device (incorrectly) by vendor. + Find the offending rule and make it more specific, with the help of the + udevadm info command. + + + + + Udev rule works unreliably + + This may be another manifestation of the previous problem. If not, + and your rule uses sysfs + attributes, it may be a kernel timing issue, to be fixed in later kernels. + For now, you can work around it by creating a rule that waits for the used + sysfs attribute and appending + it to the /etc/udev/rules.d/10-wait_for_sysfs.rules + file (create this file if it does not exist). Please notify the LFS + Development list if you do so and it helps. + + + + + Udev does not create a device + + Further text assumes that the driver is built statically into the + kernel or already loaded as a module, and that you have already checked + that Udev doesn't create a misnamed device. + + Udev has no information needed to create a device node if a kernel + driver does not export its data to sysfs. + This is most common with third party drivers from outside the kernel + tree. Create a static device node in + /lib/udev/devices with the appropriate major/minor + numbers (see the file devices.txt inside the kernel + documentation or the documentation provided by the third party driver + vendor). The static device node will be copied to + /dev by the + udev bootscript. + + + + + Device naming order changes randomly after rebooting + + This is due to the fact that Udev, by design, handles uevents and + loads modules in parallel, and thus in an unpredictable order. This will + never be fixed. You should not rely upon the kernel device + names being stable. Instead, create your own rules that make symlinks with + stable names based on some stable attributes of the device, such as a + serial number or the output of various *_id utilities installed by Udev. + See and + for examples. + + + + + + + Useful Reading + + Additional helpful documentation is available at the following + sites: + + + + + A Userspace Implementation of devfs + + + + + The sysfs Filesystem + + + + + + + + diff --git a/chapter08/fstab.xml b/chapter08/fstab.xml index d1be334ee..91ad2dfe0 100644 --- a/chapter08/fstab.xml +++ b/chapter08/fstab.xml @@ -19,7 +19,7 @@ which must be checked (for integrity errors) prior to mounting. Create a new file systems table like this: -cat > /etc/fstab << "EOF" +cat > /etc/fstab << "EOF" # Begin /etc/fstab # file system mount-point type options dump fsck @@ -33,6 +33,18 @@ devpts /dev/pts devpts gid=5,mode=620 0 0 tmpfs /run tmpfs defaults 0 0 devtmpfs /dev devtmpfs mode=0755,nosuid 0 0 +# End /etc/fstab +EOF + +cat > /etc/fstab << "EOF" +# Begin /etc/fstab + +# file system mount-point type options dump fsck +# order + +/dev/<xxx> / <fff> defaults 1 1 +/dev/<yyy> swap swap pri=1 0 0 + # End /etc/fstab EOF @@ -44,19 +56,6 @@ EOF class="filesystem">ext4. For details on the six fields in this file, see man 5 fstab. - - Filesystems with MS-DOS or Windows origin (i.e.: vfat, ntfs, smbfs, cifs, iso9660, udf) need the iocharset mount option in order for non-ASCII characters in file names to be interpreted properly. The value @@ -96,8 +95,6 @@ EOF Default iocharset for FAT (). There is no way to specify these settings for the ntfs filesystem at kernel compilation time. - It is possible to make the ext3 filesystem reliable across power failures for some hard disk types. To do this, add the diff --git a/chapter08/grub.xml b/chapter08/grub.xml index c0bc1d983..a8e484bd8 100644 --- a/chapter08/grub.xml +++ b/chapter08/grub.xml @@ -39,13 +39,13 @@ grub-mkrescue --output=grub-img.iso xorriso -as cdrecord -v dev=/dev/cdrw blank=as_needed grub-img.iso Most newer systems now come with system firmware that is in - UEFI ((Unified Extensible Firmware Interface) mode by default. To boot LFS + UEFI (Unified Extensible Firmware Interface) mode by default. To boot LFS on these systems using the instructions here, the UEFI Mode and Secure Boot - capabilities need to be turned off. There are ways to boot with these - capabilities still enabled, but are not covered here. For details, see - the - lfs-uefi.txt hint at + capabilities need to be turned off. There are ways to boot with these + capabilities still enabled, but then are not covered here. For details, + see + the lfs-uefi.txt hint at http://www.linuxfromscratch.org/hints/downloads/files/lfs-uefi.txt. diff --git a/chapter08/kernel.xml b/chapter08/kernel.xml index d487327b4..d955625d7 100644 --- a/chapter08/kernel.xml +++ b/chapter08/kernel.xml @@ -65,24 +65,57 @@ information about configuring and building the kernel can be found at - A good starting place for setting up the kernel configuration - is to run make defconfig. This will set the base - configuration to a good state that takes your current system architecture - into account. + + + A good starting place for setting up the kernel configuration is to + run make defconfig. This will set the base + configuration to a good state that takes your current system architecture + into account. - Be sure to configure the following features as shown: + Be sure to enable or disable following features or the system might + not work correctly or boot at all: - + Device Drivers ---> Generic Driver Options ---> [ ] Support for uevent helper [CONFIG_UEVENT_HELPER] - [*] Maintain a devtmpfs filesystem to mount at /dev [CONFIG_DEVTMPFS] + [*] Maintain a devtmpfs filesystem to mount at /dev [CONFIG_DEVTMPFS] - There are several other options that may be desired depending - on the requirements for the system. For a list of options needed - for BLFS packages, see the BLFS - Index of Kernel Settings + + [*] open by fhandle syscalls [CONFIG_FHANDLE] + [ ] Auditing support [CONFIG_AUDIT] + [*] Control Group support [CONFIG_CGROUPS] +Processor type and features ---> + [*] Enable seccomp to safely compute untrusted bytecode [CONFIG_SECCOMP] +Networking support ---> + Networking options ---> + <*> The IPv6 protocol [CONFIG_IPV6] +Device Drivers ---> + Generic Driver Options ---> + [ ] Support for uevent helper [CONFIG_UEVENT_HELPER] + [*] Maintain a devtmpfs filesystem to mount at /dev [CONFIG_DEVTMPFS] + [ ] Fallback user-helper invocation for firmware loading [CONFIG_FW_LOADER_USER_HELPER] +Firmware Drivers ---> + [*] Export DMI identification via sysfs to userspace [CONFIG_DMIID] +File systems ---> + [*] Inotify support for userspace [CONFIG_INOTIFY_USER] + <*> Kernel automounter version 4 support (also supports v3) [CONFIG_AUTOFS4_FS] + Pseudo filesystems ---> + [*] Tmpfs POSIX Access Control Lists [CONFIG_TMPFS_POSIX_ACL] + [*] Tmpfs extended attributes [CONFIG_TMPFS_XATTR] + + + + + While "The IPv6 Protocol" is not strictly + required, it is highly recommended by the systemd developers. + + + There are several other options that may be desired + depending on the requirements for the system. For a list of options needed + for BLFS packages, see the BLFS + Index of Kernel Settings (&lfs-root;blfs/view/&short-version;/longindex.html#kernel-config-index). diff --git a/chapter09/reboot.xml b/chapter09/reboot.xml index 7bba9015b..590244d23 100644 --- a/chapter09/reboot.xml +++ b/chapter09/reboot.xml @@ -73,8 +73,8 @@ /etc/vimrc /root/.bash_profile /root/.bashrc - /etc/sysconfig/network - /etc/sysconfig/ifconfig.eth0 + /etc/sysconfig/network + /etc/sysconfig/ifconfig.eth0 diff --git a/chapter09/theend.xml b/chapter09/theend.xml index e7d9f3068..2d29242b0 100644 --- a/chapter09/theend.xml +++ b/chapter09/theend.xml @@ -18,25 +18,55 @@ /etc/lsb-release + + /etc/os-release + + Well done! The new LFS system is installed! We wish you much success with your shiny new custom-built Linux system. - It may be a good idea to create an /etc/lfs-release - file. By having this file, it is very easy for you (and for us if you need to - ask for help at some point) to find out which LFS version is installed on the - system. Create this file by running: + Create an /etc/os-release + file required by systemd: -echo &version; > /etc/lfs-release +cat > /etc/os-release << "EOF" +NAME="Linux From Scratch" +VERSION="&versiond;" +ID=lfs +PRETTY_NAME="Linux From Scratch &versiond;" +EOF + + It may be a good idea to create an + /etc/lfs-release file. By having this file, it is very + easy for you (and for us if you need to ask for help at some point) to find + out which LFS version is installed on the system. Create this file by + running: + +echo &version; > /etc/lfs-release + + Creating the file + /etc/lfs-release is recommended for compatibility with + the non-systemd branch. By having this file, it is very easy for you (and for + us if you need to ask for help at some point) to find out which LFS version + is installed on the system. Create this file by running: + +echo &version; > /etc/lfs-release It is also a good idea to create a file to show the status of your new system with respect to the Linux Standards Base (LSB). To create this file, run: -cat > /etc/lsb-release << "EOF" +cat > /etc/lsb-release << "EOF" DISTRIB_ID="Linux From Scratch" DISTRIB_RELEASE="&version;" DISTRIB_CODENAME="<your name here>" DISTRIB_DESCRIPTION="Linux From Scratch" +EOF + +cat > /etc/lsb-release << "EOF" +DISTRIB_ID="Linux From Scratch" +DISTRIB_RELEASE="&versiond;" +DISTRIB_CODENAME="<your name here>" +DISTRIB_DESCRIPTION="Linux From Scratch" EOF Be sure to put some sort of customization for the field diff --git a/general.ent b/general.ent index aba0995e5..2a0eb55f7 100644 --- a/general.ent +++ b/general.ent @@ -1,10 +1,15 @@ - - + + + + + + + + - @@ -18,7 +23,12 @@ - + + + + + + diff --git a/indexd.xml b/indexd.xml new file mode 100644 index 000000000..a733fb3c8 --- /dev/null +++ b/indexd.xml @@ -0,0 +1,48 @@ + + + %general-entities; +]> + + + + + + +Introduction + + + + + + +Preparing for the Build + + + + + + + + +Building the LFS System + + + + + + + + +Appendices + + + + + + + + + + + diff --git a/packages.ent b/packages.ent index dd6b2dd04..485ddb409 100644 --- a/packages.ent +++ b/packages.ent @@ -106,6 +106,14 @@ + + + + + + + + @@ -541,6 +549,14 @@ + + + + + + + + diff --git a/patches.ent b/patches.ent index c5a871847..f3632da58 100644 --- a/patches.ent +++ b/patches.ent @@ -41,3 +41,8 @@ + + + + + diff --git a/prologue/bookinfo.xml b/prologue/bookinfo.xml index a44a137a5..6887ace1d 100644 --- a/prologue/bookinfo.xml +++ b/prologue/bookinfo.xml @@ -7,8 +7,8 @@ Linux From Scratch - Version &version; - + Version &version; + Version &versiond; @@ -16,18 +16,26 @@ Beekmans - Managing Editor is Bruce + Managing Editor: Bruce Dubbs + + Editor: Douglas R. + Reno + + + Editor: DJ + Lucas + - ©rightdate; Gerard Beekmans + Copyright © ©rightdate;, Gerard Beekmans All rights reserved.